0

I've noticed this question several times on SO, but none of the answers seems to be applicable to a Python 3.6 version. As most cases when this is asked, I accidentally deleted my .py source file but I still have a .exe built with pyinstaller (passing only the --onefile and --icon arguments).

I managed to reach the following point:

  • Ran pyinstxtractor.py on the .exe I mentioned above. This gave me a bunch of files including one with no extension which is actually the .pyc of the source file missing the magic number.
  • Renamed the file with no extension in order to have the .pyc extension
  • Used a hex editor to append the magic number to the .pyc file, using the header from another .pyc file (used __future__ for this example). It looks like this.
  • Ran uncompyle6 on the .pyc file that now has the correct magic number, but the operations fails as seen here. Some of the code is retrieved(about 15%) but this important part is just obfuscated byte-code.

Any other tools I managed to come across do not work on Python 3.6 such as Easy Python Decompiler, unpyclib, pyREtic.

I did not manage to use pycdc/Decompyle++ or Maynard as I don't understand how they work, but they still don't seem to support 3.6.

Anything else I might try?

PS: My OS is Win7 and I did try file recovery software and system rollbacks, none of which worked.

1
  • That code that his shown in the screen shot doesn't look obfuscated, but then it is also nowhere complete, nor is the bytecode shown around the offset that is reported to be where the problem is. However to have this considered for fixing in uncompyle6 you'll have to read the instructions on how to report a bug and follow them.
    – rocky
    Dec 24, 2018 at 15:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.