pyinstxtractor
pyinstxtractor copied to clipboard
fix pyc_magic: Restore the value of pyc_magic with the header of stru…
When writing a pyc file (PyInstArchive._writePyc(self, filename, data)
), the pyc_magic
used is different from the value of the original file, which will cause an error in decompiling the pyc-file ($ uncompple6 [pyc-file]
).
To solve this problem, I choose to retrieve the pyc_magic of the original file from the first four bytes of the struct.pyc
file to ensure that the extracted pyc-file can be decompiled.
Thanks for the PR anyway. I have a possible idea on how to handle these. Writing of pyc files from pyz archive have to be deferred until it encounters the first pyc file in the CArchive. Will implement the logic as soon as testing is done on my end.
This feature has been implemented in a different way. Thanks for your contribution though.