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

Werner Werner.Merkl at fujitsu-siemens.com
Thu Aug 30 02:42:56 EDT 2007


On 30 Aug., 06:26, Scott David Daniels <dani... at dsl-only.net> wrote:
> 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... at 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




More information about the Python-list mailing list