473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

self extracting zipefile (windows) and (standard module) zipefile

Hi,
I try to read (and extract) some "self extracting" zipefiles on a
Windows system. The standard module zipefile seems not to be able to
handle this.
>>fName = r"C:\tmp\mySelfExtratingFile.exe"
import zipfile
zipefile.is_zipfile(fName))
False

Is there a wrapper or has some one experience with other libaries to
extract those files?
Thanks in advance
Werner

Aug 29 '07 #1
6 4414
On Aug 29, 6:53 am, Werner <Werner.Me...@fujitsu-siemens.comwrote:
Hi,

I try to read (and extract) some "self extracting" zipefiles on a
Windows system. The standard module zipefile seems not to be able to
handle this.
>fName = r"C:\tmp\mySelfExtratingFile.exe"
import zipfile
zipefile.is_zipfile(fName))

False

Is there a wrapper or has some one experience with other libaries to
extract those files?

Thanks in advance
Werner
Since it's an executable, why not just use the subprocess module?

I did find this set of scripts, but I don't know if they will help:
http://www.example-code.com/python/zip.asp

I did find how to extract via the command line, which you could use in
conjunction with the subprocess module:
http://help.globalscape.com/help/cut...g_archives.htm

Mike

Aug 29 '07 #2
First of all, there's really no such thing as a "self extracting
zipefile". I mean, obviously you have to do something to unzip it. A
file doesn't just execute itself. What you're dealing with is not a
_zip file_. It's an executable that has a zip file bundled with it,
and the code to unzip it, most likely into your current directory
(though some such executables allow you to provide a path to unzip
to). You'll have to execute it--there's no way you can operate on it
like a normal zip file.

On Aug 29, 7:53 am, Werner <Werner.Me...@fujitsu-siemens.comwrote:
Hi,

I try to read (and extract) some "self extracting" zipefiles on a
Windows system. The standard module zipefile seems not to be able to
handle this.
>fName = r"C:\tmp\mySelfExtratingFile.exe"
import zipfile
zipefile.is_zipfile(fName))

False

Is there a wrapper or has some one experience with other libaries to
extract those files?

Thanks in advance
Werner
Aug 29 '07 #3
On 2007-08-29, Hyuga <hy**********@gmail.comwrote:
>I try to read (and extract) some "self extracting" zipefiles
on a Windows system. The standard module zipefile seems not to
be able to handle this. [...]

First of all, there's really no such thing as a "self
extracting zipefile".
Perhaps there isn't "really such a thing," but that's the
commonly used name for the type of file the OP is dealing with.
[...] You'll have to execute it--there's no way you can
operate on it like a normal zip file.
Executing the file is a huge, huge security risk.

Other zip tools (e.g. the "unzip" utility for Linux) seem know
how to work with self-extracting zipfiles. Unfortunately there
are multiple slightly different zip formats along with mutlple
"self-extracting zip file" formats. Nonetheless, I've never run
across one I couldn't unzip without executing it. On Linux,
I'd probably just try exec'ing the "unzip" program.

Another option is to search through the file from the beginning
looking for whatever signature matches the beginning of a
"normal" zip file. The self-extracting zipfiles that I've
dissected are just an executable image concatenated with a
"normal" zipfile. If you just start searching from the
beginning of the file, it's simple to find the actual zip data
and copy it into a separate file which then can be unzipped
like any other plain zipfile. I haven't done that for many
years since the normal zip tools that I use can operate on
self-extracting files.

--
Grant Edwards grante Yow! NEWARK has been
at REZONED!! DES MOINES has
visi.com been REZONED!!
Aug 29 '07 #4
Grant Edwards wrote:
....
Another option is to search through the file from the beginning
looking for whatever signature matches the beginning of a
"normal" zip file. The self-extracting zipfiles that I've
dissected are just an executable image concatenated with a
"normal" zipfile. If you just start searching from the
beginning of the file, it's simple to find the actual zip data
and copy it into a separate file which then can be unzipped
like any other plain zipfile.
Actually, the zip format is defined from the _end_ rather than
the _beginning_ of the file. Some random file with a zip file
concatenated on the end will have the same contents as the zip
file. You can even point Python itself at such files and get
data via:
import zipfile
zf = zipfile.ZipFile('something.exe')
...

-Scott David Daniels
Sc***********@Acm.Org
Aug 30 '07 #5
On 29 Aug., 15:23, kyoso...@gmail.com wrote:
On Aug 29, 6:53 am, Werner <Werner.Me...@fujitsu-siemens.comwrote:


Hi,
I try to read (and extract) some "self extracting" zipefiles on a
Windows system. The standard module zipefile seems not to be able to
handle this.
>>fName = r"C:\tmp\mySelfExtratingFile.exe"
>>import zipfile
>>zipefile.is_zipfile(fName))
False
Is there a wrapper or has some one experience with other libaries to
extract those files?
Thanks in advance
Werner

Since it's an executable, why not just use the subprocess module?

I did find this set of scripts, but I don't know if they will help:http://www.example-code.com/python/zip.asp

I did find how to extract via the command line, which you could use in
conjunction with the subprocess module:http://help.globalscape.com/help/cut...extracting_arc...

Mike- Zitierten Text ausblenden -

- Zitierten Text anzeigen -
thank you for answer. I found, that WinZip aund 7-ZIP may handle my
files (I'm not shure, if it's really zip...) So, I thing I try the 7-
zip command line tool (but I'd prefered a Python buildin version)

Werner

Aug 30 '07 #6
On 30 Aug., 06:26, Scott David Daniels <dani...@dsl-only.netwrote:
Grant Edwards wrote:

...
Another option is to search through the file from the beginning
looking for whatever signature matches the beginning of a
"normal" zip file. The self-extracting zipfiles that I've
dissected are just an executable image concatenated with a
"normal" zipfile. If you just start searching from the
beginning of the file, it's simple to find the actual zip data
and copy it into a separate file which then can be unzipped
like any other plain zipfile.

Actually, the zip format is defined from the _end_ rather than
the _beginning_ of the file. Some random file with a zip file
concatenated on the end will have the same contents as the zip
file. You can even point Python itself at such files and get
data via:
import zipfile
zf = zipfile.ZipFile('something.exe')
...

-Scott David Daniels
Scott.Dani...@Acm.Org
I hoped, this would work, but I got "<class 'zipfile.BadZipfile'>:
File is not a zip file"...
WinZip and 7-ZIP may handle this file, so I take the command line
version of 7-Zip (but I'd prefered a Python only version)

Thanks
Werner

Aug 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nazgul | last post by:
Hi! I want to implement a small tool in Python for distributing "patches" and I need Your advice. This application should be able to package all files chosen by a user into a self-extracting.exe...
10
by: Calvin FONG | last post by:
Dear all, Are there any utility that can be call by python to create self extracting zip file. I'm now using the powerarchiever. But the command line options aren't flexible enough. Basically, I...
15
by: Ralf W. Grosse-Kunstleve | last post by:
****************************************************************************** This posting is also available in HTML format: http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html...
2
by: Avi | last post by:
hi, Can anyone tell me what the problem is and how to solve it The following piece of code resides on an asp page on the server and is used to download files from the server to the machine...
6
by: Andrew Edwards | last post by:
I have program that downloads a file from the internet and extracts it using calls to system(). All files are extracted into the directory where my program is located. How do I redirect the...
0
by: k_nil | last post by:
I have a link on my web page for a self extracting executable file placed on the server. When the link is clicked, 1) i could see dialog box with open or save options 2) when open clicked, self...
1
by: Terry Olsen | last post by:
Ok, now that I've got my disk imager program working, I'd like to attach a "self-extractor" to the front end of the image file and make it a self-extracting disk image executable file. The idea...
15
by: Karl | last post by:
Hi all, I regularly use FTP to place Self Extracting Zip files on the web for remote users to update their datafiles. Works very nicely. I have automated the creation of the initial zip file (...
4
by: Ant | last post by:
Hi all, My kids have a bunch of games that have to be run from CD (on Windows XP). Now they're not very careful with them, and so I have a plan. I've downloaded a utility (Daemon Tools) which...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.