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

Scott David Daniels daniels at dsl-only.net
Thu Aug 30 00:26:32 EDT 2007


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.Daniels at Acm.Org



More information about the Python-list mailing list