- Notifications
You must be signed in to change notification settings - Fork347
Description
When I try to decompile.pyc files generated by python-exe-unpacker, I got the following error:
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/xdis/load.py", line 209, in load_module_from_file_object co = marshal.loads(bytecode)ValueError: bad marshal data (unknown type code)And those.pyc are also treated invalid by Python interpreter:
RuntimeError: Bad code object in .pyc fileAfter spending two hours figuring out what's wrong, I think it is valuable to note them down here even if this project seemingly has ended:
I suppose the problem resides around
https://github.com/countercept/python-exe-unpacker/blob/6c88e9b28cb40615b680cefdb5f47ce4cab17833/pyinstxtractor.py#L322
where the appended header (incl. magic number, timestamp, size, etc) seems to mismatch with the.pyc format used by some newer Python versions (in my case 3.7).
To make uncompyle6 work well with malformed.pyc, dirty patch/usr/local/lib/python3.7/site-packages/xdis/load.py to make suremarshal.loads data starting from exactly 12th byte of original.pyc (e.g. utilizingBytesIO so that thefp can be read twice) helps.