Page 1 of 1
PHP and DEB (AR) Files.
Posted: Mon Dec 07, 2009 8:38 am
by mofolo
Hey.
I'm working on a project that requires the breakdown of Deb files.
Basically, all I need to do is extract the "icon.png" from the deb file.
Is it possible with PHP? I've tried searching - googling, everything.
Thanks.
Re: PHP and DEB (AR) Files.
Posted: Mon Dec 07, 2009 1:25 pm
by AbraCadaver
You can unarchive the deb with the 'ar' command. Then the icon you need is in the data file (either data.tar, data.tar.gz or data.tar.bz2). You use tar and if needed use switches to have it run through bunzip2 or gunzip.
-Shawn
Re: PHP and DEB (AR) Files.
Posted: Mon Dec 07, 2009 10:28 pm
by mofolo
Thanks Shawn!
Could you link me to a tutorial that demonstrates the ar commands?
Re: PHP and DEB (AR) Files.
Posted: Tue Dec 08, 2009 7:54 am
by AbraCadaver
mofolo wrote:Thanks Shawn!
Could you link me to a tutorial that demonstrates the ar commands?
If you are on linux just type 'man ar' or check here:
http://linuxmanpages.com/man1/ar.1.php
Re: PHP and DEB (AR) Files.
Posted: Wed Dec 09, 2009 7:03 pm
by mofolo
Is there anyway of doing this thru php?
Re: PHP and DEB (AR) Files.
Posted: Wed Dec 09, 2009 7:13 pm
by AbraCadaver
mofolo wrote:Is there anyway of doing this thru php?
Try using php.net as a resource: exec()
Re: PHP and DEB (AR) Files.
Posted: Thu Dec 10, 2009 1:36 am
by mofolo
wow! it works!
Thanks for that Shawn!
Re: PHP and DEB (AR) Files.
Posted: Fri Dec 11, 2009 2:47 pm
by mofolo
mofolo wrote:wow! it works!
Thanks for that Shawn!
I've got a new Problem with this...
After I unpack the .DEB file, I also decompress the TAR files with gzip.
One of the Tar files have a "postinst" file which chmods my directory to 777, thus giving me 500 errors.
Here is what im doing:
Code: Select all
exec("gzip -dc control.tar.gz | tar xf -");
Is this extracting, and executing the files?
Thanks.
Re: PHP and DEB (AR) Files.
Posted: Fri Dec 11, 2009 2:52 pm
by AbraCadaver
You don't need the control file, just the data file.
Re: PHP and DEB (AR) Files.
Posted: Sat Dec 12, 2009 12:42 am
by mofolo
AbraCadaver wrote:You don't need the control file, just the data file.
Thats true, but it still is being extracted from the TAR file.
And as that is happening, it is been executed! How can i avoid extracted this file?
Re: PHP and DEB (AR) Files.
Posted: Sat Dec 12, 2009 10:30 am
by AbraCadaver
Something like:
Code: Select all
ar x data.tar.gz whatever.deb
tar zxf data.tar.gz