pyinstxtractor / pyinstxtractor-ng

PyInstaller Extractor Next Generation
GNU General Public License v3.0
332 stars 31 forks source link

Invalid argument exception extracting package generated with Python 2.2 #12

Open LukeUsher opened 6 months ago

LukeUsher commented 6 months ago

I have been tasked with making changes to a legacy product that we no longer have source code for; the application was developed with Python2.2 and packaged with pyinstaller.

pyinstxtractor-ng identifies the package as being built with Pyinstaller 2.0/Python2.2, but the extraction of the archive fails with an exception when attempting to locate the TOC; could it be an unsupported format?

[+] Processing app.exe
[+] Pyinstaller version: 2.0
[+] Python version: 2.2
[+] Length of package: 978984 bytes
[+] Found 6 files in CArchive
[+] Beginning extraction...please standby
Traceback (most recent call last):
  File "pyinstxtractor-ng.py", line 527, in <module>
  File "pyinstxtractor-ng.py", line 509, in main
  File "pyinstxtractor-ng.py", line 328, in extractFiles
  File "pyinstxtractor-ng.py", line 421, in _extractPyz
OSError: [Errno 22] Invalid argument

image

LukeUsher commented 6 months ago

update: it looks like this version of pyinstall is using native byte order for the toc location; simply removing the ! operator resolved it for me; I'll keep the issue open because this ideally could be fixed upstream, but I was able to continue my work with this hack.

extremecoders-re commented 6 months ago

Thanks for the report.

Going through PyInstaller sources, v1.3 released in 2006 or maybe 2005 was the last version to use native byte order before switching to network byte order aka big endian.

This is from v1.3: https://github.com/pyinstaller/pyinstaller/blob/92c9ab155ac51ca6607a1ddf2cd2d068da2ba4a5/archive.py#L122

Going to keep this issue open for now.

FaxHack commented 2 months ago

How do i fix this?

[+] Processing ULTAK.exe [!] Error: Missing cookie, unsupported pyinstaller version or not a pyinstaller archive