pyinstxtractor icon indicating copy to clipboard operation
pyinstxtractor copied to clipboard

fix pyc_magic: Restore the value of pyc_magic with the header of stru…

Open rootkiter opened this issue 2 years ago • 1 comments

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.

rootkiter avatar Aug 08 '22 05:08 rootkiter

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.

extremecoders-re avatar Aug 08 '22 06:08 extremecoders-re

This feature has been implemented in a different way. Thanks for your contribution though.

extremecoders-re avatar Sep 18 '22 12:09 extremecoders-re