Re: [PHP] Protected ZIP file with password

2008-02-20 Thread Daniel Brown
On Feb 19, 2008 9:52 PM, Richard Lynch [EMAIL PROTECTED] wrote:
 For ultimate geekiness, you can install a custom PHP extension I wrote
 to print out the error message matching 127:
 http://l-i-e.com/perror
 :-)

Hmm that could come in handy.  I'm going to take advantage of
your generosity on this one, Lynch.

Thanks!

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-19 Thread Richard Lynch
You can dig out what 127 means from perror, or you can just go with
the usual suspects of paths and permissions.

PHP does not run as you from the command line and does not use
your shell and does not have your environment.

Use FULL PATH everywhere.  E.g.:
exec(/usr/bin/zip /home/www/bastos.com/example/files/, $output,
$error);

Also make sure the PHP User has read/write access to whatever it needs
to do the job.  And be VERY CAREFUL about who else then has access
because of this!!!

For ultimate geekiness, you can install a custom PHP extension I wrote
to print out the error message matching 127:
http://l-i-e.com/perror
:-)

On Mon, February 18, 2008 12:57 pm, Petrus Bastos wrote:
 Hey folks,

I got access to exec method for test! But, it's not working... :(
 the
 function returns 127 and don't create the zip file, I've tested on
 Linux
 command tool and works! Do you have any idea why didn't work?

 Thanks again and sorry for the inconvenience,
 Petrus Bastos.

 On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Richard,
 
   Unfortunately, I can't get out of the zip password rut
 because the
  destination system read only this file format. I can't change the
  destination system.
 
  Thanks,
  Petrus.
 
  On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED] wrote:
 
 
  On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 
  Thanks again for your worry. So, let's go, here goes my
 situation.
  I'm
  exporting data to another system. That system have an option to
 be
  feed by a
  password protected zip file. The export activity will be occur
 in this
  way:
  the user will generate the file on my application and will put
 this
  file
  into that another system. So, I need generate that file. Maybe
 one
  solution
  is to generate the file unzipped and determine that user should
 zip
  the file
  with password on his Windows or Linux operating system. But, I
 can't
  let
  that responsibility on user hands. So, because that I need to
 generate
  the
  file already protected.
 
  Perhaps you could use SCP (or SSH tunneling) to transfer the file
 from
  system to system, so that it need not ever be visible to the
 outside
  world, and thus not need the rather lame zip password.
 
  Another option would be to take the whole file and 2-way encrypt
 it
  with a public/private key pair, and install the private key on
 the
  receiving server.
 
  In other words, get out of the zip password rut, and protect the
 file
  some other way.
 
  --
  Some people have a gift link here.
  Know what I want?
  I want you to buy a CD from some indie artist.
  http://cdbaby.com/from/lynch
  Yeah, I get a buck. So?
 
 
 
 
 
 Sounds like a creative challenge... this is what makes programmers
 problem solvers. You can write the code, you have the knowledge..
 and
 then you get requirements like this one. How annoying!

 I found out some interesting information researching your issue. It
 seems that encryption by password is actually not built in to ZIP
 itself, but was an implementation detail apps like WinZip added to
 the
 mix. Because of that, the original ZIP libs don't have any notions
 of
 password protection.

 It seems like this isn't a language specific issue, either.

 I think it's time to get creative, Petros. You're in a bind, and I
 assume you need to get this done, so you have the following options
 (in
 the order I would do it in..)
  - Turn on exec()
  - You can use/modify an app I wrote (in python) which accepts UDP
 packets and executed commands based off of it. You can strip out the
 really insecure things and just accept 'zip' commands. The lib/app
 is
 really small and lightweight. There are no dependencies outside of I
 think 3 python modules. If I couldn't turn on exec(), this is the
 route
 I would go.
  - Use some form of file/directory montoring + zip.
  - Pass the request on to an environment that has zip()

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==






-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-19 Thread Richard Lynch


On Mon, February 18, 2008 4:16 pm, Shawn McKenzie wrote:
 In your php code you'll need the full path to biblioteca.php and to
 t.zip and the web user will need write permissions to the dir where
 you
 create t.zip.

nitpik:
The user needs write permission to just t.zip

Unless zip does something funky with temp files within the directory
containing t.zip or something weird-o like that?

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-19 Thread Richard Lynch
Use exec() and get any output that may be happening.

I also suspect that the PATH you are using isn't a TRUE path, but some
hacked up thing from your webhost.

Look at the output of ?php phpinfo();? in biblioteca and see what
PHP thinks is the current working directory.

I had one webhost where some kind of chroot jail thingie made the
paths look completely different in FTP, shell and PHP...

On Mon, February 18, 2008 4:32 pm, Petrus Bastos wrote:
 I've tried without success...

 system(/usr/local/bin/zip -P 
 /.automount/ipojuca/export/homeg03/golapa/public_html/mapdenguepe128/site/php/biblioteca/t.zip
 /.automount/ipojuca/export/homeg03/golapa/public_html/mapdenguepe128/site/php/biblioteca/biblioteca.php,$ret_val);


 On Feb 18, 2008 7:16 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:

 In your php code you'll need the full path to biblioteca.php and to
 t.zip and the web user will need write permissions to the dir where
 you
 create t.zip.

 -Shawn

 Petrus Bastos wrote:
  Wolf,
 
  I'm sure actually working from the command line.
 
   /usr/local/bin/zip -P  t.zip biblioteca.php
adding: biblioteca.php (deflated 73%)
  
 
 
  On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
 
   Petrus Bastos [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
   Actually, I don't know anything about FreeBSD. I never
 used
  this system.
   But, here my zip command works fine at command line, why
 doesn't
  works with
   PHP?
  
  
  ! -- SNIP --
 
  Have you talked with your server admins about the use of zip?
   Sounds like you have an environment set up by a blind monkey.
 
  Are you sure the command is actually working from the command
 line?
  What is the command and output?
 
  Wolf
 
 




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Nick,

Thanks again for your worry. So, let's go, here goes my situation. I'm
exporting data to another system. That system have an option to be feed by a
password protected zip file. The export activity will be occur in this way:
the user will generate the file on my application and will put this file
into that another system. So, I need generate that file. Maybe one solution
is to generate the file unzipped and determine that user should zip the file
with password on his Windows or Linux operating system. But, I can't let
that responsibility on user hands. So, because that I need to generate the
file already protected.

PS: Sorry my bad english. I'm Brazilian and I'm not fluent english.

Thanks one more time,
Petrus Bastos.

On Feb 18, 2008 12:26 AM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Chris,
 
  Thanks for your help, but I think that package can't make what I
 want.
  But , I appreciate your help anyway and if you have any other ideas,
 please
  let me know! :)
 
  Thanks,
  Petrus Bastos.
 
  On Feb 17, 2008 10:38 PM, Chris [EMAIL PROTECTED] wrote:
 
 
  Petrus Bastos wrote:
 
  Unfortunately I don't have access to this family of methods because
 
  security
 
  policy. Lefting this way out, I didn't find anyway on how to do that.
 If
 
  you
 
  have any idea or know any module can do that, I'll appreciate to know
 
  too!
 
  See if the pear package does what you want:
 
  http://pear.php.net/package/File_Archive
 
  --
  Postgresql  php tutorials
  http://www.designmagick.com/
 
 
 
 
 I'm sure you know what you're doing, but maybe you'd be better off
 letting us know the task / process to better understand what you'd like
 to accomplish. From there, since it's obvious that PHP does not have
 built in password functions, and that exec() is out of the question;
 maybe we can figure out how to move onward.

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==





RE: [PHP] Protected ZIP file with password

2008-02-18 Thread Bastien Koert

Hey, what about placing the unzipped folder into a dir that has a process 
watching it that will pick up the file, zip and protect it and then ftp (or 
another delivery mechanism) to the destination?
 
Bastien
 Date: Mon, 18 Feb 2008 08:59:02 -0300 From: [EMAIL PROTECTED] To: [EMAIL 
 PROTECTED] CC: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: 
 [PHP] Protected ZIP file with password  Nick,  Thanks again for your 
 worry. So, let's go, here goes my situation. I'm exporting data to another 
 system. That system have an option to be feed by a password protected zip 
 file. The export activity will be occur in this way: the user will generate 
 the file on my application and will put this file into that another system. 
 So, I need generate that file. Maybe one solution is to generate the file 
 unzipped and determine that user should zip the file with password on his 
 Windows or Linux operating system. But, I can't let that responsibility on 
 user hands. So, because that I need to generate the file already protected. 
  PS: Sorry my bad english. I'm Brazilian and I'm not fluent english.  
 Thanks one more time, Petrus Bastos.  On Feb 18, 2008 12:26 AM, Nick 
 Stinemates [EMAIL PROTECTED] wrote:   Petrus Bastos wrote:   Chris, 
 Thanks for your help, but I think that package can't make what I  
 want.   But , I appreciate your help anyway and if you have any other 
 ideas,  please   let me know! :) Thanks,   Petrus Bastos. 
 On Feb 17, 2008 10:38 PM, Chris [EMAIL PROTECTED] wrote:
Petrus Bastos wrote: Unfortunately I don't have access 
 to this family of methods because security policy. 
 Lefting this way out, I didn't find anyway on how to do that.  If
  you have any idea or know any module can do that, I'll 
 appreciate to know too! See if the pear package does 
 what you want: http://pear.php.net/package/File_Archive
  --   Postgresql  php tutorials   http://www.designmagick.com/  
 I'm sure you know what you're doing, but maybe you'd be 
 better off  letting us know the task / process to better understand what 
 you'd like  to accomplish. From there, since it's obvious that PHP does not 
 have  built in password functions, and that exec() is out of the question; 
  maybe we can figure out how to move onward.   --  == 
  Nick Stinemates ([EMAIL PROTECTED])  http://nick.stinemates.org   
 AIM: Nick Stinemates  MSN: [EMAIL PROTECTED]  Yahoo: [EMAIL PROTECTED]  
 ==   
_



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Bastien,

I thank your help, but I think that your idea doesn't resolve my problem
because I need generate that file online when user clicks on a link.The file
must be obtained at the time he clicks.

Thanks anyway,
Petrus Bastos.

On Feb 18, 2008 12:18 PM, Bastien Koert [EMAIL PROTECTED] wrote:


 Hey, what about placing the unzipped folder into a dir that has a process
 watching it that will pick up the file, zip and protect it and then ftp (or
 another delivery mechanism) to the destination?

 Bastien
  Date: Mon, 18 Feb 2008 08:59:02 -0300 From: [EMAIL PROTECTED] To:
 [EMAIL PROTECTED] CC: [EMAIL PROTECTED]; php-general@lists.php.net
 Subject: Re: [PHP] Protected ZIP file with password  Nick,  Thanks again
 for your worry. So, let's go, here goes my situation. I'm exporting data to
 another system. That system have an option to be feed by a password
 protected zip file. The export activity will be occur in this way: the user
 will generate the file on my application and will put this file into that
 another system. So, I need generate that file. Maybe one solution is to
 generate the file unzipped and determine that user should zip the file with
 password on his Windows or Linux operating system. But, I can't let that
 responsibility on user hands. So, because that I need to generate the file
 already protected.  PS: Sorry my bad english. I'm Brazilian and I'm not
 fluent english.  Thanks one more time, Petrus Bastos.  On Feb 18, 2008
 12:26 AM, Nick Stinemates [EMAIL PROTECTED] wrote:   Petrus Bastos
 wrote:   Chris, Thanks for your help, but I think that package
 can't make what I  want.   But , I appreciate your help anyway and if
 you have any other ideas,  please   let me know! :) Thanks,
   Petrus Bastos. On Feb 17, 2008 10:38 PM, Chris 
 [EMAIL PROTECTED] wrote:   Petrus Bastos wrote:   
  Unfortunately I don't have access to this family of methods because 
security policy. Lefting this way out, I didn't find
 anyway on how to do that.  If you have any idea
 or know any module can do that, I'll appreciate to know too! 
See if the pear package does what you want:
 http://pear.php.net/package/File_Archive --   Postgresql 
 php tutorials   http://www.designmagick.com/ 
 I'm sure you know what you're doing, but maybe you'd be better off 
 letting us know the task / process to better understand what you'd like 
 to accomplish. From there, since it's obvious that PHP does not have 
 built in password functions, and that exec() is out of the question; 
 maybe we can figure out how to move onward.   --  ==
  Nick Stinemates ([EMAIL PROTECTED])  http://nick.stinemates.org 
  AIM: Nick Stinemates  MSN: [EMAIL PROTECTED]  Yahoo:
 [EMAIL PROTECTED]  ==   
 _




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Wolf

 Petrus Bastos [EMAIL PROTECTED] wrote: 
 Bastien,
 
 I thank your help, but I think that your idea doesn't resolve my problem
 because I need generate that file online when user clicks on a link.The file
 must be obtained at the time he clicks.
 
 Thanks anyway,
 Petrus Bastos.
 
!-- SNIP --

What methods do you have available?  When you run phpinfo script (?php 
phpinfo() ? what does it say the compile statement is?  

If it was compiled --with-zip then you should be good with the PECL usage
http://us3.php.net/zip

Otherwise, you are probably SOL...

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Wolf,

I thank your help! I have all zip methods available, but don't have any
method that generate password protected zip file.

Thanks anyway,
Petrus Bastos.

On Feb 18, 2008 1:10 PM, Wolf [EMAIL PROTECTED] wrote:


  Petrus Bastos [EMAIL PROTECTED] wrote:
  Bastien,
 
  I thank your help, but I think that your idea doesn't resolve my
 problem
  because I need generate that file online when user clicks on a link.Thefile
  must be obtained at the time he clicks.
 
  Thanks anyway,
  Petrus Bastos.
 
 !-- SNIP --

 What methods do you have available?  When you run phpinfo script (?php
 phpinfo() ? what does it say the compile statement is?

 If it was compiled --with-zip then you should be good with the PECL usage
 http://us3.php.net/zip

 Otherwise, you are probably SOL...

 Wolf



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Daniel Brown
On Feb 18, 2008 11:18 AM, Petrus Bastos [EMAIL PROTECTED] wrote:
 Wolf,

 I thank your help! I have all zip methods available, but don't have any
 method that generate password protected zip file.

In all honesty, Petrus, since none of the suggestions made to you
will work in your situation, I'm afraid the answer is you can't do
it.

The only way you'll be able to do it is to move to a host that
allows exec() or at least has (or will allow you to install) a
PEAR/PECL module to perform more advanced zip operations.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Richard Lynch
On Sun, February 17, 2008 1:57 pm, Nick Stinemates wrote:
 Petrus Bastos wrote:
 Hi Nick,

 Sorry, but I forgot to tell you that I can't use this exec
 neither
 system commands because they are disabled for security precautions.
 So, Do
 you have any other ideas on how can I do that?

Sometimes, you can write a cron job that does what you want from the
shell, and that has less restrictions, since the php.ini file can be
specified/modified on the command line on the fly...

Perhaps that would help you here...


And a potentially truly UGLY hack...

I'm betting that the password protection of the zip file is just a
few different bytes in the header portion of a zip...

So take an un-protected zip, and password-protect it, and then do a
diff and see what changed.

Then take that diff output, and just paste it in as the front of the
other zip files...

Might work.

Might make hash of the zip files.

Won't know til you try.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Richard Lynch
On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 Thanks again for your worry. So, let's go, here goes my situation.
 I'm
 exporting data to another system. That system have an option to be
 feed by a
 password protected zip file. The export activity will be occur in this
 way:
 the user will generate the file on my application and will put this
 file
 into that another system. So, I need generate that file. Maybe one
 solution
 is to generate the file unzipped and determine that user should zip
 the file
 with password on his Windows or Linux operating system. But, I can't
 let
 that responsibility on user hands. So, because that I need to generate
 the
 file already protected.

Perhaps you could use SCP (or SSH tunneling) to transfer the file from
system to system, so that it need not ever be visible to the outside
world, and thus not need the rather lame zip password.

Another option would be to take the whole file and 2-way encrypt it
with a public/private key pair, and install the private key on the
receiving server.

In other words, get out of the zip password rut, and protect the file
some other way.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Daniel,

But I can install PEAR/PECL modules, but I didn't see any module that do
what I want. Do you know any module that create password protected zip
files?

Thanks again,
Petrus Bastos.

On Feb 18, 2008 1:29 PM, Daniel Brown [EMAIL PROTECTED] wrote:

 On Feb 18, 2008 11:18 AM, Petrus Bastos [EMAIL PROTECTED] wrote:
  Wolf,
 
  I thank your help! I have all zip methods available, but don't have
 any
  method that generate password protected zip file.

In all honesty, Petrus, since none of the suggestions made to you
 will work in your situation, I'm afraid the answer is you can't do
 it.

The only way you'll be able to do it is to move to a host that
 allows exec() or at least has (or will allow you to install) a
 PEAR/PECL module to perform more advanced zip operations.

 --
 /Dan

 Daniel P. Brown
 Senior Unix Geek
 ? while(1) { $me = $mind--; sleep(86400); } ?



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Nick Stinemates
Richard Lynch wrote:
 On Sun, February 17, 2008 1:57 pm, Nick Stinemates wrote:
   
 Petrus Bastos wrote:
 
 Hi Nick,

 Sorry, but I forgot to tell you that I can't use this exec
 neither
 system commands because they are disabled for security precautions.
 So, Do
 you have any other ideas on how can I do that?
   

 Sometimes, you can write a cron job that does what you want from the
 shell, and that has less restrictions, since the php.ini file can be
 specified/modified on the command line on the fly...

 Perhaps that would help you here...


 And a potentially truly UGLY hack...

 I'm betting that the password protection of the zip file is just a
 few different bytes in the header portion of a zip...

 So take an un-protected zip, and password-protect it, and then do a
 diff and see what changed.

 Then take that diff output, and just paste it in as the front of the
 other zip files...

 Might work.

 Might make hash of the zip files.

 Won't know til you try.

   
Richard

Unfortunately,y our hypothesis is incorrect. ZIP files are 'encrypted'
using the password you provide. I was thinking along those lines as well.

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Nick Stinemates
Petrus Bastos wrote:
 Richard,

  Unfortunately, I can't get out of the zip password rut because the
 destination system read only this file format. I can't change the
 destination system.

 Thanks,
 Petrus.

 On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED] wrote:

   
 On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 
 Thanks again for your worry. So, let's go, here goes my situation.
 I'm
 exporting data to another system. That system have an option to be
 feed by a
 password protected zip file. The export activity will be occur in this
 way:
 the user will generate the file on my application and will put this
 file
 into that another system. So, I need generate that file. Maybe one
 solution
 is to generate the file unzipped and determine that user should zip
 the file
 with password on his Windows or Linux operating system. But, I can't
 let
 that responsibility on user hands. So, because that I need to generate
 the
 file already protected.
   
 Perhaps you could use SCP (or SSH tunneling) to transfer the file from
 system to system, so that it need not ever be visible to the outside
 world, and thus not need the rather lame zip password.

 Another option would be to take the whole file and 2-way encrypt it
 with a public/private key pair, and install the private key on the
 receiving server.

 In other words, get out of the zip password rut, and protect the file
 some other way.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/from/lynch
 Yeah, I get a buck. So?


 

   
Sounds like a creative challenge... this is what makes programmers
problem solvers. You can write the code, you have the knowledge.. and
then you get requirements like this one. How annoying!

I found out some interesting information researching your issue. It
seems that encryption by password is actually not built in to ZIP
itself, but was an implementation detail apps like WinZip added to the
mix. Because of that, the original ZIP libs don't have any notions of
password protection.

It seems like this isn't a language specific issue, either.

I think it's time to get creative, Petros. You're in a bind, and I
assume you need to get this done, so you have the following options (in
the order I would do it in..)
 - Turn on exec()
 - You can use/modify an app I wrote (in python) which accepts UDP
packets and executed commands based off of it. You can strip out the
really insecure things and just accept 'zip' commands. The lib/app is
really small and lightweight. There are no dependencies outside of I
think 3 python modules. If I couldn't turn on exec(), this is the route
I would go.
 - Use some form of file/directory montoring + zip.
 - Pass the request on to an environment that has zip()

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Casey
On Feb 18, 2008 9:07 AM, Richard Lynch [EMAIL PROTECTED] wrote:
 On Sun, February 17, 2008 1:57 pm, Nick Stinemates wrote:
  Petrus Bastos wrote:
  Hi Nick,
 
  Sorry, but I forgot to tell you that I can't use this exec
  neither
  system commands because they are disabled for security precautions.
  So, Do
  you have any other ideas on how can I do that?

 Sometimes, you can write a cron job that does what you want from the
 shell, and that has less restrictions, since the php.ini file can be
 specified/modified on the command line on the fly...

 Perhaps that would help you here...


 And a potentially truly UGLY hack...

 I'm betting that the password protection of the zip file is just a
 few different bytes in the header portion of a zip...

 So take an un-protected zip, and password-protect it, and then do a
 diff and see what changed.

 Then take that diff output, and just paste it in as the front of the
 other zip files...

 Might work.

 Might make hash of the zip files.

 Won't know til you try.


The RFC makes it sound so confusing.

-- 
-Casey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Richard,

 Unfortunately, I can't get out of the zip password rut because the
destination system read only this file format. I can't change the
destination system.

Thanks,
Petrus.

On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED] wrote:

 On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
  Thanks again for your worry. So, let's go, here goes my situation.
  I'm
  exporting data to another system. That system have an option to be
  feed by a
  password protected zip file. The export activity will be occur in this
  way:
  the user will generate the file on my application and will put this
  file
  into that another system. So, I need generate that file. Maybe one
  solution
  is to generate the file unzipped and determine that user should zip
  the file
  with password on his Windows or Linux operating system. But, I can't
  let
  that responsibility on user hands. So, because that I need to generate
  the
  file already protected.

 Perhaps you could use SCP (or SSH tunneling) to transfer the file from
 system to system, so that it need not ever be visible to the outside
 world, and thus not need the rather lame zip password.

 Another option would be to take the whole file and 2-way encrypt it
 with a public/private key pair, and install the private key on the
 receiving server.

 In other words, get out of the zip password rut, and protect the file
 some other way.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/from/lynch
 Yeah, I get a buck. So?




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Hey folks,

   I got access to exec method for test! But, it's not working... :(  the
function returns 127 and don't create the zip file, I've tested on Linux
command tool and works! Do you have any idea why didn't work?

Thanks again and sorry for the inconvenience,
Petrus Bastos.

On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Richard,
 
   Unfortunately, I can't get out of the zip password rut because the
  destination system read only this file format. I can't change the
  destination system.
 
  Thanks,
  Petrus.
 
  On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED] wrote:
 
 
  On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 
  Thanks again for your worry. So, let's go, here goes my situation.
  I'm
  exporting data to another system. That system have an option to be
  feed by a
  password protected zip file. The export activity will be occur in this
  way:
  the user will generate the file on my application and will put this
  file
  into that another system. So, I need generate that file. Maybe one
  solution
  is to generate the file unzipped and determine that user should zip
  the file
  with password on his Windows or Linux operating system. But, I can't
  let
  that responsibility on user hands. So, because that I need to generate
  the
  file already protected.
 
  Perhaps you could use SCP (or SSH tunneling) to transfer the file from
  system to system, so that it need not ever be visible to the outside
  world, and thus not need the rather lame zip password.
 
  Another option would be to take the whole file and 2-way encrypt it
  with a public/private key pair, and install the private key on the
  receiving server.
 
  In other words, get out of the zip password rut, and protect the file
  some other way.
 
  --
  Some people have a gift link here.
  Know what I want?
  I want you to buy a CD from some indie artist.
  http://cdbaby.com/from/lynch
  Yeah, I get a buck. So?
 
 
 
 
 
 Sounds like a creative challenge... this is what makes programmers
 problem solvers. You can write the code, you have the knowledge.. and
 then you get requirements like this one. How annoying!

 I found out some interesting information researching your issue. It
 seems that encryption by password is actually not built in to ZIP
 itself, but was an implementation detail apps like WinZip added to the
 mix. Because of that, the original ZIP libs don't have any notions of
 password protection.

 It seems like this isn't a language specific issue, either.

 I think it's time to get creative, Petros. You're in a bind, and I
 assume you need to get this done, so you have the following options (in
 the order I would do it in..)
  - Turn on exec()
  - You can use/modify an app I wrote (in python) which accepts UDP
 packets and executed commands based off of it. You can strip out the
 really insecure things and just accept 'zip' commands. The lib/app is
 really small and lightweight. There are no dependencies outside of I
 think 3 python modules. If I couldn't turn on exec(), this is the route
 I would go.
  - Use some form of file/directory montoring + zip.
  - Pass the request on to an environment that has zip()

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==





Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Nick Stinemates
Petrus Bastos wrote:
 Hey folks,

I got access to exec method for test! But, it's not working... :( 
 the function returns 127 and don't create the zip file, I've tested on
 Linux command tool and works! Do you have any idea why didn't work?

 Thanks again and sorry for the inconvenience,
 Petrus Bastos.

 On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Richard,
 
   Unfortunately, I can't get out of the zip password rut
 because the
  destination system read only this file format. I can't change the
  destination system.
 
  Thanks,
  Petrus.
 
  On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
 
 
  On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 
  Thanks again for your worry. So, let's go, here goes my
 situation.
  I'm
  exporting data to another system. That system have an option to be
  feed by a
  password protected zip file. The export activity will be occur
 in this
  way:
  the user will generate the file on my application and will put
 this
  file
  into that another system. So, I need generate that file. Maybe one
  solution
  is to generate the file unzipped and determine that user
 should zip
  the file
  with password on his Windows or Linux operating system. But, I
 can't
  let
  that responsibility on user hands. So, because that I need to
 generate
  the
  file already protected.
 
  Perhaps you could use SCP (or SSH tunneling) to transfer the
 file from
  system to system, so that it need not ever be visible to the
 outside
  world, and thus not need the rather lame zip password.
 
  Another option would be to take the whole file and 2-way encrypt it
  with a public/private key pair, and install the private key on the
  receiving server.
 
  In other words, get out of the zip password rut, and protect
 the file
  some other way.
 
  --
  Some people have a gift link here.
  Know what I want?
  I want you to buy a CD from some indie artist.
  http://cdbaby.com/from/lynch
  Yeah, I get a buck. So?
 
 
 
 
 
 Sounds like a creative challenge... this is what makes programmers
 problem solvers. You can write the code, you have the knowledge.. and
 then you get requirements like this one. How annoying!

 I found out some interesting information researching your issue. It
 seems that encryption by password is actually not built in to ZIP
 itself, but was an implementation detail apps like WinZip added to the
 mix. Because of that, the original ZIP libs don't have any notions of
 password protection.

 It seems like this isn't a language specific issue, either.

 I think it's time to get creative, Petros. You're in a bind, and I
 assume you need to get this done, so you have the following
 options (in
 the order I would do it in..)
  - Turn on exec()
  - You can use/modify an app I wrote (in python) which accepts UDP
 packets and executed commands based off of it. You can strip out the
 really insecure things and just accept 'zip' commands. The lib/app is
 really small and lightweight. There are no dependencies outside of I
 think 3 python modules. If I couldn't turn on exec(), this is the
 route
 I would go.
  - Use some form of file/directory montoring + zip.
  - Pass the request on to an environment that has zip()

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED] mailto:[EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 ==



What platform are you testing on?

You got it to work under Linux but not on Windows? Am I understanding
that properly?

For windows, I read you should be using a tool called PkZIP.

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
I'm testing on FreeBSD. I can use any command through system(), but the zip
command doesn't works! I don't know why.


On Feb 18, 2008 4:06 PM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Hey folks,
 
 I got access to exec method for test! But, it's not working... :(
  the function returns 127 and don't create the zip file, I've tested on
  Linux command tool and works! Do you have any idea why didn't work?
 
  Thanks again and sorry for the inconvenience,
  Petrus Bastos.
 
  On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
  Petrus Bastos wrote:
   Richard,
  
Unfortunately, I can't get out of the zip password rut
  because the
   destination system read only this file format. I can't change the
   destination system.
  
   Thanks,
   Petrus.
  
   On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
  
  
   On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
  
   Thanks again for your worry. So, let's go, here goes my
  situation.
   I'm
   exporting data to another system. That system have an option to
 be
   feed by a
   password protected zip file. The export activity will be occur
  in this
   way:
   the user will generate the file on my application and will put
  this
   file
   into that another system. So, I need generate that file. Maybe
 one
   solution
   is to generate the file unzipped and determine that user
  should zip
   the file
   with password on his Windows or Linux operating system. But, I
  can't
   let
   that responsibility on user hands. So, because that I need to
  generate
   the
   file already protected.
  
   Perhaps you could use SCP (or SSH tunneling) to transfer the
  file from
   system to system, so that it need not ever be visible to the
  outside
   world, and thus not need the rather lame zip password.
  
   Another option would be to take the whole file and 2-way encrypt
 it
   with a public/private key pair, and install the private key on
 the
   receiving server.
  
   In other words, get out of the zip password rut, and protect
  the file
   some other way.
  
   --
   Some people have a gift link here.
   Know what I want?
   I want you to buy a CD from some indie artist.
   http://cdbaby.com/from/lynch
   Yeah, I get a buck. So?
  
  
  
  
  
  Sounds like a creative challenge... this is what makes programmers
  problem solvers. You can write the code, you have the knowledge..
 and
  then you get requirements like this one. How annoying!
 
  I found out some interesting information researching your issue. It
  seems that encryption by password is actually not built in to ZIP
  itself, but was an implementation detail apps like WinZip added to
 the
  mix. Because of that, the original ZIP libs don't have any notions
 of
  password protection.
 
  It seems like this isn't a language specific issue, either.
 
  I think it's time to get creative, Petros. You're in a bind, and I
  assume you need to get this done, so you have the following
  options (in
  the order I would do it in..)
   - Turn on exec()
   - You can use/modify an app I wrote (in python) which accepts UDP
  packets and executed commands based off of it. You can strip out the
  really insecure things and just accept 'zip' commands. The lib/app
 is
  really small and lightweight. There are no dependencies outside of I
  think 3 python modules. If I couldn't turn on exec(), this is the
  route
  I would go.
   - Use some form of file/directory montoring + zip.
   - Pass the request on to an environment that has zip()
 
  --
  ==
  Nick Stinemates ([EMAIL PROTECTED] mailto:[EMAIL PROTECTED])
  http://nick.stinemates.org
 
  AIM: Nick Stinemates
  MSN: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
  Yahoo: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
  ==
 
 
 
 What platform are you testing on?

 You got it to work under Linux but not on Windows? Am I understanding
 that properly?

 For windows, I read you should be using a tool called PkZIP.

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==





RE: [PHP] Protected ZIP file with password

2008-02-18 Thread Jay Blanchard
[snip]
I'm testing on FreeBSD. I can use any command through system(), but the
zip
command doesn't works! I don't know why.
[/snip]

Have you tried the command from the command line without PHP to make
sure it works?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Yes.

On Feb 18, 2008 5:50 PM, Jay Blanchard [EMAIL PROTECTED] wrote:

 [snip]
 I'm testing on FreeBSD. I can use any command through system(), but the
 zip
 command doesn't works! I don't know why.
 [/snip]

 Have you tried the command from the command line without PHP to make
 sure it works?


Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
zip program is installed. I'd type whereis and returned
/usr/ports/archivers/zip. I've change my zip command and put th whole path.
Now return error 126. :(

On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  I'm testing on FreeBSD. I can use any command through system(), but the
 zip
  command doesn't works! I don't know why.

 Is zip installed? AFAIK it's not by default.

 Do a system('whereis zip'); to see.

 -Stut

 --
 http://stut.net/



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Petrus Bastos wrote:
 zip program is installed. I'd type whereis and returned
 /usr/ports/archivers/zip. I've change my zip command and put th whole path.
 Now return error 126. :(

 On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
 I'm testing on FreeBSD. I can use any command through system(), but the
 zip
 command doesn't works! I don't know why.
 Is zip installed? AFAIK it's not by default.

 Do a system('whereis zip'); to see.

 -Stut

 --
 http://stut.net/

 
 Umm, it's been a while for me on BSD, but isn't
 '/usr/ports/archivers/zip' a directory holding sources to build zip?
 
 -Shawn

Maybe as root:

cd /usr/ports/archivers/zip
make install clean zip

-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Daniel Brown
On Feb 18, 2008 4:05 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 Umm, it's been a while for me on BSD, but isn't
 '/usr/ports/archivers/zip' a directory holding sources to build zip?

Yes, Shawn, you're correct.  Ports are (on BSD and MacOS) for
automated installations like DEBs and RPMs on other systems.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Unfortunately, I don't have access to root user here. It was a miracle get
access to system command. I have to resolve this problem without root user.
:(

On Feb 18, 2008 6:08 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:

 Shawn McKenzie wrote:
  Petrus Bastos wrote:
  zip program is installed. I'd type whereis and returned
  /usr/ports/archivers/zip. I've change my zip command and put th whole
 path.
  Now return error 126. :(
 
  On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:
 
  Petrus Bastos wrote:
  I'm testing on FreeBSD. I can use any command through system(), but
 the
  zip
  command doesn't works! I don't know why.
  Is zip installed? AFAIK it's not by default.
 
  Do a system('whereis zip'); to see.
 
  -Stut
 
  --
  http://stut.net/
 
 
  Umm, it's been a while for me on BSD, but isn't
  '/usr/ports/archivers/zip' a directory holding sources to build zip?
 
  -Shawn

 Maybe as root:

 cd /usr/ports/archivers/zip
 make install clean zip

 -Shawn

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Ok. I've tried the command again and returned /usr/local/bin/zip... but
return the same error...

On Feb 18, 2008 6:13 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Unfortunately, I don't have access to root user here. It was a miracle
 get
  access to system command. I have to resolve this problem without root
 user.
  :(
 
  On Feb 18, 2008 6:08 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 
  Shawn McKenzie wrote:
  Petrus Bastos wrote:
  zip program is installed. I'd type whereis and returned
  /usr/ports/archivers/zip. I've change my zip command and put th whole
  path.
  Now return error 126. :(
 
  On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:
 
  Petrus Bastos wrote:
  I'm testing on FreeBSD. I can use any command through system(), but
  the
  zip
  command doesn't works! I don't know why.
  Is zip installed? AFAIK it's not by default.
 
  Do a system('whereis zip'); to see.
 
  -Stut
 
  --
  http://stut.net/
 
  Umm, it's been a while for me on BSD, but isn't
  '/usr/ports/archivers/zip' a directory holding sources to build zip?
 
  -Shawn
  Maybe as root:
 
  cd /usr/ports/archivers/zip
  make install clean zip
 
  -Shawn
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 Well, have someone install zip.  You won't have any luck trying to
 execute that directory.

 -Shawn

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Greg Donald
On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
 cd /usr/ports/archivers/zip
 make install clean zip

pkg_add -r zip

done.


-- 
Greg Donald
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Wolf

 Petrus Bastos [EMAIL PROTECTED] wrote: 
 I'm testing on FreeBSD. I can use any command through system(), but the zip
 command doesn't works! I don't know why.
 
 
! -- SNIP --
According to Google:
http://www.google.com/search?q=php%3A+exec+zip+error+127ie=utf-8oe=utf-8aq=trls=com.ubuntu:en-US:officialclient=firefox-a
 

Using terms php: exec zip error 127

Try passthru and see what you get.

Have you done any looking for the error codes in the documentation?

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Stut

Petrus Bastos wrote:

I'm testing on FreeBSD. I can use any command through system(), but the zip
command doesn't works! I don't know why.


Is zip installed? AFAIK it's not by default.

Do a system('whereis zip'); to see.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
Greg Donald wrote:
 On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
 cd /usr/ports/archivers/zip
 make install clean zip
 
 pkg_add -r zip
 
 done.
 
 

Sure, if you want to miss all the linker and compiler goodies :-)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
Petrus Bastos wrote:
 Unfortunately, I don't have access to root user here. It was a miracle get
 access to system command. I have to resolve this problem without root user.
 :(
 
 On Feb 18, 2008 6:08 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 
 Shawn McKenzie wrote:
 Petrus Bastos wrote:
 zip program is installed. I'd type whereis and returned
 /usr/ports/archivers/zip. I've change my zip command and put th whole
 path.
 Now return error 126. :(

 On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
 I'm testing on FreeBSD. I can use any command through system(), but
 the
 zip
 command doesn't works! I don't know why.
 Is zip installed? AFAIK it's not by default.

 Do a system('whereis zip'); to see.

 -Stut

 --
 http://stut.net/

 Umm, it's been a while for me on BSD, but isn't
 '/usr/ports/archivers/zip' a directory holding sources to build zip?

 -Shawn
 Maybe as root:

 cd /usr/ports/archivers/zip
 make install clean zip

 -Shawn

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 
Well, have someone install zip.  You won't have any luck trying to
execute that directory.

-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
I'd look at parameters and my command is ok.

On Feb 18, 2008 5:51 PM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  I'm testing on FreeBSD. I can use any command through system(), but the
 zip
  command doesn't works! I don't know why.
 
 
  On Feb 18, 2008 4:06 PM, Nick Stinemates [EMAIL PROTECTED] wrote:
 
 
  Petrus Bastos wrote:
 
  Hey folks,
 
 I got access to exec method for test! But, it's not working... :(
  the function returns 127 and don't create the zip file, I've tested on
  Linux command tool and works! Do you have any idea why didn't work?
 
  Thanks again and sorry for the inconvenience,
  Petrus Bastos.
 
  On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
  Petrus Bastos wrote:
   Richard,
  
Unfortunately, I can't get out of the zip password rut
  because the
   destination system read only this file format. I can't change
 the
   destination system.
  
   Thanks,
   Petrus.
  
   On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
  
  
   On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
  
   Thanks again for your worry. So, let's go, here goes my
  situation.
   I'm
   exporting data to another system. That system have an option
 to
 
  be
 
   feed by a
   password protected zip file. The export activity will be occur
  in this
   way:
   the user will generate the file on my application and will put
  this
   file
   into that another system. So, I need generate that file. Maybe
 
  one
 
   solution
   is to generate the file unzipped and determine that user
  should zip
   the file
   with password on his Windows or Linux operating system. But, I
  can't
   let
   that responsibility on user hands. So, because that I need to
  generate
   the
   file already protected.
  
   Perhaps you could use SCP (or SSH tunneling) to transfer the
  file from
   system to system, so that it need not ever be visible to the
  outside
   world, and thus not need the rather lame zip password.
  
   Another option would be to take the whole file and 2-way
 encrypt
 
  it
 
   with a public/private key pair, and install the private key on
 
  the
 
   receiving server.
  
   In other words, get out of the zip password rut, and protect
  the file
   some other way.
  
   --
   Some people have a gift link here.
   Know what I want?
   I want you to buy a CD from some indie artist.
   http://cdbaby.com/from/lynch
   Yeah, I get a buck. So?
  
  
  
  
  
  Sounds like a creative challenge... this is what makes programmers
  problem solvers. You can write the code, you have the knowledge..
 
  and
 
  then you get requirements like this one. How annoying!
 
  I found out some interesting information researching your issue.
 It
  seems that encryption by password is actually not built in to ZIP
  itself, but was an implementation detail apps like WinZip added to
 
  the
 
  mix. Because of that, the original ZIP libs don't have any notions
 
  of
 
  password protection.
 
  It seems like this isn't a language specific issue, either.
 
  I think it's time to get creative, Petros. You're in a bind, and I
  assume you need to get this done, so you have the following
  options (in
  the order I would do it in..)
   - Turn on exec()
   - You can use/modify an app I wrote (in python) which accepts
 UDP
  packets and executed commands based off of it. You can strip out
 the
  really insecure things and just accept 'zip' commands. The lib/app
 
  is
 
  really small and lightweight. There are no dependencies outside of
 I
  think 3 python modules. If I couldn't turn on exec(), this is the
  route
  I would go.
   - Use some form of file/directory montoring + zip.
   - Pass the request on to an environment that has zip()
 
  --
  ==
  Nick Stinemates ([EMAIL PROTECTED] mailto:[EMAIL PROTECTED])
  http://nick.stinemates.org
 
  AIM: Nick Stinemates
  MSN: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 
  Yahoo: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
  ==
 
 
 
 
  What platform are you testing on?
 
  You got it to work under Linux but not on Windows? Am I understanding
  that properly?
 
  For windows, I read you should be using a tool called PkZIP.
 
  --
  ==
  Nick Stinemates ([EMAIL PROTECTED])
  http://nick.stinemates.org
 
  AIM: Nick Stinemates
  MSN: [EMAIL PROTECTED]
  Yahoo: [EMAIL PROTECTED]
  ==
 
 
 
 
 
 
 Do you have SSH access to the system?

 If so, 'man zip' and look at the params.

 --
 ==
 Nick 

Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
Petrus Bastos wrote:
 zip program is installed. I'd type whereis and returned
 /usr/ports/archivers/zip. I've change my zip command and put th whole path.
 Now return error 126. :(
 
 On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:
 
 Petrus Bastos wrote:
 I'm testing on FreeBSD. I can use any command through system(), but the
 zip
 command doesn't works! I don't know why.
 Is zip installed? AFAIK it's not by default.

 Do a system('whereis zip'); to see.

 -Stut

 --
 http://stut.net/

 

Umm, it's been a while for me on BSD, but isn't
'/usr/ports/archivers/zip' a directory holding sources to build zip?

-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Nick Stinemates
Petrus Bastos wrote:
 I'm testing on FreeBSD. I can use any command through system(), but the zip
 command doesn't works! I don't know why.


 On Feb 18, 2008 4:06 PM, Nick Stinemates [EMAIL PROTECTED] wrote:

   
 Petrus Bastos wrote:
 
 Hey folks,

I got access to exec method for test! But, it's not working... :(
 the function returns 127 and don't create the zip file, I've tested on
 Linux command tool and works! Do you have any idea why didn't work?

 Thanks again and sorry for the inconvenience,
 Petrus Bastos.

 On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Richard,
 
   Unfortunately, I can't get out of the zip password rut
 because the
  destination system read only this file format. I can't change the
  destination system.
 
  Thanks,
  Petrus.
 
  On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
 
 
  On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 
  Thanks again for your worry. So, let's go, here goes my
 situation.
  I'm
  exporting data to another system. That system have an option to
   
 be
 
  feed by a
  password protected zip file. The export activity will be occur
 in this
  way:
  the user will generate the file on my application and will put
 this
  file
  into that another system. So, I need generate that file. Maybe
   
 one
 
  solution
  is to generate the file unzipped and determine that user
 should zip
  the file
  with password on his Windows or Linux operating system. But, I
 can't
  let
  that responsibility on user hands. So, because that I need to
 generate
  the
  file already protected.
 
  Perhaps you could use SCP (or SSH tunneling) to transfer the
 file from
  system to system, so that it need not ever be visible to the
 outside
  world, and thus not need the rather lame zip password.
 
  Another option would be to take the whole file and 2-way encrypt
   
 it
 
  with a public/private key pair, and install the private key on
   
 the
 
  receiving server.
 
  In other words, get out of the zip password rut, and protect
 the file
  some other way.
 
  --
  Some people have a gift link here.
  Know what I want?
  I want you to buy a CD from some indie artist.
  http://cdbaby.com/from/lynch
  Yeah, I get a buck. So?
 
 
 
 
 
 Sounds like a creative challenge... this is what makes programmers
 problem solvers. You can write the code, you have the knowledge..
   
 and
 
 then you get requirements like this one. How annoying!

 I found out some interesting information researching your issue. It
 seems that encryption by password is actually not built in to ZIP
 itself, but was an implementation detail apps like WinZip added to
   
 the
 
 mix. Because of that, the original ZIP libs don't have any notions
   
 of
 
 password protection.

 It seems like this isn't a language specific issue, either.

 I think it's time to get creative, Petros. You're in a bind, and I
 assume you need to get this done, so you have the following
 options (in
 the order I would do it in..)
  - Turn on exec()
  - You can use/modify an app I wrote (in python) which accepts UDP
 packets and executed commands based off of it. You can strip out the
 really insecure things and just accept 'zip' commands. The lib/app
   
 is
 
 really small and lightweight. There are no dependencies outside of I
 think 3 python modules. If I couldn't turn on exec(), this is the
 route
 I would go.
  - Use some form of file/directory montoring + zip.
  - Pass the request on to an environment that has zip()

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED] mailto:[EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 ==



   
 What platform are you testing on?

 You got it to work under Linux but not on Windows? Am I understanding
 that properly?

 For windows, I read you should be using a tool called PkZIP.

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==



 

   
Do you have SSH access to the system?

If so, 'man zip' and look at the params.

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

-- 
PHP General Mailing List 

Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Actually, I don't know anything about FreeBSD. I never used this system.
But, here my zip command works fine at command line, why doesn't works with
PHP?


On Feb 18, 2008 6:28 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:

 Greg Donald wrote:
  On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
  Sure, if you want to miss all the linker and compiler goodies :-)
 
  I'm guessing that'd be non-issue for an obviously inexperienced FreeBSD
 user.
 
 
 But I'm guessing he'd think it was cool.  Also, he's not root so I
 assume that pkg_add won't work either.  The ftp error may be misleading,
 dunno.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Wolf

 Petrus Bastos [EMAIL PROTECTED] wrote: 
 Actually, I don't know anything about FreeBSD. I never used this system.
 But, here my zip command works fine at command line, why doesn't works with
 PHP?
 
 
! -- SNIP --

Have you talked with your server admins about the use of zip?  Sounds like you 
have an environment set up by a blind monkey.

Are you sure the command is actually working from the command line?
What is the command and output?

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Wolf

 Petrus Bastos [EMAIL PROTECTED] wrote: 
 Wolf,
 
 I'm sure actually working from the command line.
 
  /usr/local/bin/zip -P  t.zip biblioteca.php
   adding: biblioteca.php (deflated 73%)
 
 
 
 On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED] wrote:
 
 
   Petrus Bastos [EMAIL PROTECTED] wrote:
   Actually, I don't know anything about FreeBSD. I never used this
  system.
   But, here my zip command works fine at command line, why doesn't works
  with
   PHP?
  
  
  ! -- SNIP --
 
  Have you talked with your server admins about the use of zip?  Sounds like
  you have an environment set up by a blind monkey.
 
  Are you sure the command is actually working from the command line?
  What is the command and output?
 
  Wolf
 

What does your script command look like?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
Greg Donald wrote:
 On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
 Sure, if you want to miss all the linker and compiler goodies :-)
 
 I'm guessing that'd be non-issue for an obviously inexperienced FreeBSD user.
 
 
But I'm guessing he'd think it was cool.  Also, he's not root so I
assume that pkg_add won't work either.  The ftp error may be misleading,
dunno.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Greg Donald
On 2/18/08, Petrus Bastos [EMAIL PROTECTED] wrote:
 Error: FTP Unable to get
 ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.1-release/Latest/zip.tbz:
 File unavailable (e.g., file not found, no access)
  pkg_add: unable to fetch
 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.1-release/Latest/zip.tbz'
 by URL


Works fine for me on 6.3-RELEASE.


-- 
Greg Donald
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Wolf,

I'm sure actually working from the command line.

 /usr/local/bin/zip -P  t.zip biblioteca.php
  adding: biblioteca.php (deflated 73%)



On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED] wrote:


  Petrus Bastos [EMAIL PROTECTED] wrote:
  Actually, I don't know anything about FreeBSD. I never used this
 system.
  But, here my zip command works fine at command line, why doesn't works
 with
  PHP?
 
 
 ! -- SNIP --

 Have you talked with your server admins about the use of zip?  Sounds like
 you have an environment set up by a blind monkey.

 Are you sure the command is actually working from the command line?
 What is the command and output?

 Wolf



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Error: FTP Unable to get
ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.1-release/Latest/zip.tbz:
File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch '
ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.1-release/Latest/zip.tbz'
by URL

:(

On Feb 18, 2008 6:17 PM, Greg Donald [EMAIL PROTECTED] wrote:

 On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
  cd /usr/ports/archivers/zip
  make install clean zip

 pkg_add -r zip

 done.


 --
 Greg Donald
 http://destiney.com/

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Stut

Petrus Bastos wrote:

Actually, I don't know anything about FreeBSD. I never used this system.
But, here my zip command works fine at command line, why doesn't works with
PHP?


Is here the server or your local machine? If zip works fine on the 
command line on the server then it's installed and should work fine from 
PHP assuming the web user has permission to do it.


You need to use the full path to the zip exe (usually /usr/local/bin/zip 
on FreeBSD), and full paths to any other file references just to be sure.


Make sure you're using a function that's gives you the full output and 
not just the last line. I tend to use backticks for this. It would also 
help to add 21 to the end of the command so you get output to stderr 
as well as stdout.


Finally, if it's still not working might I suggest you share your code. 
The problem may be more obvious if we have that.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Greg Donald
On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
 Sure, if you want to miss all the linker and compiler goodies :-)

I'm guessing that'd be non-issue for an obviously inexperienced FreeBSD user.


-- 
Greg Donald
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
I've tried. returned

Array
(
)

127



On Feb 18, 2008 6:58 PM, Daniel Brown [EMAIL PROTECTED] wrote:

 On Feb 18, 2008 4:55 PM, Petrus Bastos [EMAIL PROTECTED] wrote:
  system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);
 
  that's my code and even zip with full path, return $ret_val = 127;

Try this instead:

 ?
 exec('/usr/local/bin/zip -P  t.zip biblioteca.php',$ret,$err);

 echo pre /\n;
 print_r($ret);
 echo /pre\n;

 echo pre /\n;
 print_r($err);
 echo /pre\n;
 ?

 --
 /Dan

 Daniel P. Brown
 Senior Unix Geek
 ? while(1) { $me = $mind--; sleep(86400); } ?



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Wolf

 Petrus Bastos [EMAIL PROTECTED] wrote: 
 system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);
 
 that's my code and even zip with full path, return $ret_val = 127;
 
 On Feb 18, 2008 6:43 PM, Wolf [EMAIL PROTECTED] wrote:
 
 
   Petrus Bastos [EMAIL PROTECTED] wrote:
   Wolf,
  
   I'm sure actually working from the command line.
  
/usr/local/bin/zip -P  t.zip biblioteca.php
 adding: biblioteca.php (deflated 73%)
   
  
  
   On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED] wrote:
  
   
 Petrus Bastos [EMAIL PROTECTED] wrote:
 Actually, I don't know anything about FreeBSD. I never used this
system.
 But, here my zip command works fine at command line, why doesn't
  works
with
 PHP?


! -- SNIP --
   
Have you talked with your server admins about the use of zip?  Sounds
  like
you have an environment set up by a blind monkey.
   
Are you sure the command is actually working from the command line?
What is the command and output?
   
Wolf
   
 
  What does your script command look like?
 
http://www.google.com/search?q=php%3A+exec+zip+error+127ie=utf-8oe=utf-8aq=trls=com.ubuntu:en-US:officialclient=firefox-a

Try using Passthru

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Results the same thing.

On Feb 18, 2008 6:59 PM, Wolf [EMAIL PROTECTED] wrote:


  Petrus Bastos [EMAIL PROTECTED] wrote:
  system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);
 
  that's my code and even zip with full path, return $ret_val = 127;
 
  On Feb 18, 2008 6:43 PM, Wolf [EMAIL PROTECTED] wrote:
 
  
    Petrus Bastos [EMAIL PROTECTED] wrote:
Wolf,
   
I'm sure actually working from the command line.
   
 /usr/local/bin/zip -P  t.zip biblioteca.php
  adding: biblioteca.php (deflated 73%)

   
   
On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED] wrote:
   

  Petrus Bastos [EMAIL PROTECTED] wrote:
  Actually, I don't know anything about FreeBSD. I never used
 this
 system.
  But, here my zip command works fine at command line, why doesn't
   works
 with
  PHP?
 
 
 ! -- SNIP --

 Have you talked with your server admins about the use of zip?
  Sounds
   like
 you have an environment set up by a blind monkey.

 Are you sure the command is actually working from the command
 line?
 What is the command and output?

 Wolf

  
   What does your script command look like?
  

 http://www.google.com/search?q=php%3A+exec+zip+error+127ie=utf-8oe=utf-8aq=trls=com.ubuntu:en-US:officialclient=firefox-a

 Try using Passthru



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);

that's my code and even zip with full path, return $ret_val = 127;

On Feb 18, 2008 6:43 PM, Wolf [EMAIL PROTECTED] wrote:


  Petrus Bastos [EMAIL PROTECTED] wrote:
  Wolf,
 
  I'm sure actually working from the command line.
 
   /usr/local/bin/zip -P  t.zip biblioteca.php
adding: biblioteca.php (deflated 73%)
  
 
 
  On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED] wrote:
 
  
    Petrus Bastos [EMAIL PROTECTED] wrote:
Actually, I don't know anything about FreeBSD. I never used this
   system.
But, here my zip command works fine at command line, why doesn't
 works
   with
PHP?
   
   
   ! -- SNIP --
  
   Have you talked with your server admins about the use of zip?  Sounds
 like
   you have an environment set up by a blind monkey.
  
   Are you sure the command is actually working from the command line?
   What is the command and output?
  
   Wolf
  

 What does your script command look like?



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Daniel Brown
On Feb 18, 2008 4:55 PM, Petrus Bastos [EMAIL PROTECTED] wrote:
 system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);

 that's my code and even zip with full path, return $ret_val = 127;

Try this instead:

?
exec('/usr/local/bin/zip -P  t.zip biblioteca.php',$ret,$err);

echo pre /\n;
print_r($ret);
echo /pre\n;

echo pre /\n;
print_r($err);
echo /pre\n;
?

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
I've tried without success...

system(/usr/local/bin/zip -P 
/.automount/ipojuca/export/homeg03/golapa/public_html/mapdenguepe128/site/php/biblioteca/t.zip
/.automount/ipojuca/export/homeg03/golapa/public_html/mapdenguepe128/site/php/biblioteca/biblioteca.php,$ret_val);


On Feb 18, 2008 7:16 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:

 In your php code you'll need the full path to biblioteca.php and to
 t.zip and the web user will need write permissions to the dir where you
 create t.zip.

 -Shawn

 Petrus Bastos wrote:
  Wolf,
 
  I'm sure actually working from the command line.
 
   /usr/local/bin/zip -P  t.zip biblioteca.php
adding: biblioteca.php (deflated 73%)
  
 
 
  On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
 
   Petrus Bastos [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
   Actually, I don't know anything about FreeBSD. I never used
  this system.
   But, here my zip command works fine at command line, why doesn't
  works with
   PHP?
  
  
  ! -- SNIP --
 
  Have you talked with your server admins about the use of zip?
   Sounds like you have an environment set up by a blind monkey.
 
  Are you sure the command is actually working from the command line?
  What is the command and output?
 
  Wolf
 
 



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Stut

Petrus Bastos wrote:

system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);


Try a full path . here - ^^^


that's my code and even zip with full path, return $ret_val = 127;


AFAIK that's the error code for command not found which probably means 
PHP doesn't have execute permissions on the zip binary. There could be 
lots of reasons for that but you need to ask your sysadmin about it.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
In your php code you'll need the full path to biblioteca.php and to
t.zip and the web user will need write permissions to the dir where you
create t.zip.

-Shawn

Petrus Bastos wrote:
 Wolf,

 I'm sure actually working from the command line.

  /usr/local/bin/zip -P  t.zip biblioteca.php
   adding: biblioteca.php (deflated 73%)
 


 On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:


  Petrus Bastos [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
  Actually, I don't know anything about FreeBSD. I never used
 this system.
  But, here my zip command works fine at command line, why doesn't
 works with
  PHP?
 
 
 ! -- SNIP --

 Have you talked with your server admins about the use of zip?
  Sounds like you have an environment set up by a blind monkey.

 Are you sure the command is actually working from the command line?
 What is the command and output?

 Wolf



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-17 Thread Nick Stinemates
Petrus Bastos wrote:
 Hey folks,

 Do you know how can I create a protected zip file with password? Is
 there anyway? I've search on the internet, but without success.

 Thank's in advance,
 Petrus Bastos.

   
The easiest way to accomplish this would be to write a wrapper function
using the zip tool provided by (almost every) Linux distribution.

?php

function zip($directory, $password, $saveAs) {
return exec(zip -r $saveAs -P $password $directory;
}

print zip(/home/nick, mypass, /tmp/homebackup.zip);

?

Please note: the -P flag can be monitored on the local system so it is
considered insecure.
If you're going to be accepting input, you should also wrap your
variables in escapeshellarg()

http://us3.php.net/zip
http://us.php.net/manual/en/function.exec.php

from the zip manual entry

THIS IS INSECURE!  Many multi-user operating  sys-tems
provide ways for any user to see the current command line of any other
user; even on stand-alone
systems there is always the threat of over-the-shoulder peeking. 
Storing the plaintext  password  as
part of a command line in an automated script is even worse.  Whenever
possible, use the non-echoing,
interactive prompt to enter passwords.  (And where security is truly
important, use strong encryption
such  as  Pretty  Good Privacy instead of the relatively weak encryption
provided by standard zipfile
utilities.)

==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-17 Thread Petrus Bastos
Hi Nick,

Sorry, but I forgot to tell you that I can't use this exec neither
system commands because they are disabled for security precautions. So, Do
you have any other ideas on how can I do that?

Thanks for your help,
Petrus Bastos.

On Feb 17, 2008 5:15 AM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Hey folks,
 
  Do you know how can I create a protected zip file with password? Is
  there anyway? I've search on the internet, but without success.
 
  Thank's in advance,
  Petrus Bastos.
 
 
 The easiest way to accomplish this would be to write a wrapper function
 using the zip tool provided by (almost every) Linux distribution.

 ?php

 function zip($directory, $password, $saveAs) {
return exec(zip -r $saveAs -P $password $directory;
 }

 print zip(/home/nick, mypass, /tmp/homebackup.zip);

 ?

 Please note: the -P flag can be monitored on the local system so it is
 considered insecure.
 If you're going to be accepting input, you should also wrap your
 variables in escapeshellarg()

 http://us3.php.net/zip
 http://us.php.net/manual/en/function.exec.php

 from the zip manual entry

 THIS IS INSECURE!  Many multi-user operating  sys-tems
 provide ways for any user to see the current command line of any other
 user; even on stand-alone
 systems there is always the threat of over-the-shoulder peeking.
 Storing the plaintext  password  as
 part of a command line in an automated script is even worse.  Whenever
 possible, use the non-echoing,
 interactive prompt to enter passwords.  (And where security is truly
 important, use strong encryption
 such  as  Pretty  Good Privacy instead of the relatively weak encryption
 provided by standard zipfile
 utilities.)

 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==



Re: [PHP] Protected ZIP file with password

2008-02-17 Thread Daniel Brown
On Feb 16, 2008 3:39 PM, Petrus Bastos [EMAIL PROTECTED] wrote:
 Hey folks,

 Do you know how can I create a protected zip file with password? Is
 there anyway? I've search on the internet, but without success.

If you have system() access, use something in the exec() family
(and be sure to properly sanitize that).  Otherwise, there is probably
a PEAR or PECL module that will do the work for you.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-17 Thread Nick Stinemates
Petrus Bastos wrote:
 Hi Nick,

 Sorry, but I forgot to tell you that I can't use this exec neither
 system commands because they are disabled for security precautions. So, Do
 you have any other ideas on how can I do that?

 Thanks for your help,
 Petrus Bastos.

 On Feb 17, 2008 5:15 AM, Nick Stinemates [EMAIL PROTECTED] wrote:

   
 Petrus Bastos wrote:
 
 Hey folks,

 Do you know how can I create a protected zip file with password? Is
 there anyway? I've search on the internet, but without success.

 Thank's in advance,
 Petrus Bastos.


   
 The easiest way to accomplish this would be to write a wrapper function
 using the zip tool provided by (almost every) Linux distribution.

 ?php

 function zip($directory, $password, $saveAs) {
return exec(zip -r $saveAs -P $password $directory;
 }

 print zip(/home/nick, mypass, /tmp/homebackup.zip);

 ?

 Please note: the -P flag can be monitored on the local system so it is
 considered insecure.
 If you're going to be accepting input, you should also wrap your
 variables in escapeshellarg()

 http://us3.php.net/zip
 http://us.php.net/manual/en/function.exec.php

 from the zip manual entry

 THIS IS INSECURE!  Many multi-user operating  sys-tems
 provide ways for any user to see the current command line of any other
 user; even on stand-alone
 systems there is always the threat of over-the-shoulder peeking.
 Storing the plaintext  password  as
 part of a command line in an automated script is even worse.  Whenever
 possible, use the non-echoing,
 interactive prompt to enter passwords.  (And where security is truly
 important, use strong encryption
 such  as  Pretty  Good Privacy instead of the relatively weak encryption
 provided by standard zipfile
 utilities.)

 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==

 

   
Unfortunately I don't have any other ideas. Since PHP's implementation
of ZIP does not have password features you're left with the following
options:

* Write your own implementation based on RFC
* Write an interface to another app which can zip the file for you
* Something else I can't think of ;x

Sorry I don't have any other ideas.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-17 Thread Petrus Bastos
Unfortunately I don't have access to this family of methods because security
policy. Lefting this way out, I didn't find anyway on how to do that. If you
have any idea or know any module can do that, I'll appreciate to know too!

Thanks in advance,
Petrus Bastos.

On Feb 17, 2008 2:30 PM, Daniel Brown [EMAIL PROTECTED] wrote:

 On Feb 16, 2008 3:39 PM, Petrus Bastos [EMAIL PROTECTED] wrote:
  Hey folks,
 
  Do you know how can I create a protected zip file with password? Is
  there anyway? I've search on the internet, but without success.

If you have system() access, use something in the exec() family
 (and be sure to properly sanitize that).  Otherwise, there is probably
 a PEAR or PECL module that will do the work for you.

 --
 /Dan

 Daniel P. Brown
 Senior Unix Geek
 ? while(1) { $me = $mind--; sleep(86400); } ?



Re: [PHP] Protected ZIP file with password

2008-02-17 Thread Petrus Bastos
Nick,

I thank you help! But unfortunalety I didn't find way to do this. I'll
continue trying. If you have any other idea, I'll appreciate to hear!

Best regards,
Petrus Bastos.

On Feb 17, 2008 4:57 PM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Hi Nick,
 
  Sorry, but I forgot to tell you that I can't use this exec neither
  system commands because they are disabled for security precautions. So,
 Do
  you have any other ideas on how can I do that?
 
  Thanks for your help,
  Petrus Bastos.
 
  On Feb 17, 2008 5:15 AM, Nick Stinemates [EMAIL PROTECTED] wrote:
 
 
  Petrus Bastos wrote:
 
  Hey folks,
 
  Do you know how can I create a protected zip file with password?
 Is
  there anyway? I've search on the internet, but without success.
 
  Thank's in advance,
  Petrus Bastos.
 
 
 
  The easiest way to accomplish this would be to write a wrapper function
  using the zip tool provided by (almost every) Linux distribution.
 
  ?php
 
  function zip($directory, $password, $saveAs) {
 return exec(zip -r $saveAs -P $password $directory;
  }
 
  print zip(/home/nick, mypass, /tmp/homebackup.zip);
 
  ?
 
  Please note: the -P flag can be monitored on the local system so it is
  considered insecure.
  If you're going to be accepting input, you should also wrap your
  variables in escapeshellarg()
 
  http://us3.php.net/zip
  http://us.php.net/manual/en/function.exec.php
 
  from the zip manual entry
 
  THIS IS INSECURE!  Many multi-user operating  sys-tems
  provide ways for any user to see the current command line of any other
  user; even on stand-alone
  systems there is always the threat of over-the-shoulder peeking.
  Storing the plaintext  password  as
  part of a command line in an automated script is even worse.  Whenever
  possible, use the non-echoing,
  interactive prompt to enter passwords.  (And where security is truly
  important, use strong encryption
  such  as  Pretty  Good Privacy instead of the relatively weak
 encryption
  provided by standard zipfile
  utilities.)
 
  ==
  Nick Stinemates ([EMAIL PROTECTED])
  http://nick.stinemates.org
 
  AIM: Nick Stinemates
  MSN: [EMAIL PROTECTED]
  Yahoo: [EMAIL PROTECTED]
  ==
 
 
 
 
 Unfortunately I don't have any other ideas. Since PHP's implementation
 of ZIP does not have password features you're left with the following
 options:

* Write your own implementation based on RFC
* Write an interface to another app which can zip the file for you
* Something else I can't think of ;x

 Sorry I don't have any other ideas.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Protected ZIP file with password

2008-02-17 Thread Chris

Petrus Bastos wrote:

Unfortunately I don't have access to this family of methods because security
policy. Lefting this way out, I didn't find anyway on how to do that. If you
have any idea or know any module can do that, I'll appreciate to know too!


See if the pear package does what you want:

http://pear.php.net/package/File_Archive

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Protected ZIP file with password

2008-02-17 Thread Petrus Bastos
Chris,

Thanks for your help, but I think that package can't make what I want.
But , I appreciate your help anyway and if you have any other ideas, please
let me know! :)

Thanks,
Petrus Bastos.

On Feb 17, 2008 10:38 PM, Chris [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Unfortunately I don't have access to this family of methods because
 security
  policy. Lefting this way out, I didn't find anyway on how to do that. If
 you
  have any idea or know any module can do that, I'll appreciate to know
 too!

 See if the pear package does what you want:

 http://pear.php.net/package/File_Archive

 --
 Postgresql  php tutorials
 http://www.designmagick.com/



Re: [PHP] Protected ZIP file with password

2008-02-17 Thread Nick Stinemates
Petrus Bastos wrote:
 Chris,

 Thanks for your help, but I think that package can't make what I want.
 But , I appreciate your help anyway and if you have any other ideas, please
 let me know! :)

 Thanks,
 Petrus Bastos.

 On Feb 17, 2008 10:38 PM, Chris [EMAIL PROTECTED] wrote:

   
 Petrus Bastos wrote:
 
 Unfortunately I don't have access to this family of methods because
   
 security
 
 policy. Lefting this way out, I didn't find anyway on how to do that. If
   
 you
 
 have any idea or know any module can do that, I'll appreciate to know
   
 too!

 See if the pear package does what you want:

 http://pear.php.net/package/File_Archive

 --
 Postgresql  php tutorials
 http://www.designmagick.com/

 

   
I'm sure you know what you're doing, but maybe you'd be better off
letting us know the task / process to better understand what you'd like
to accomplish. From there, since it's obvious that PHP does not have
built in password functions, and that exec() is out of the question;
maybe we can figure out how to move onward.

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php