2

My question is how decompile .pyc file to python code. In first place I had exe file, i extracted .pyz file from it. From .pyz file i extracted .pyc files with this http://www.pyinstaller.org/browser/project/PyInstaller/cliutils/archive_viewer.py

However when i try to decompile .pyc files I receive erro that magic number is invalid. I looked it up, and its 63 (hex) and 99 in decimal. I guess Pyinstaller makes some changes to pyc files, my question is how to decompile this .pyc file.

mgkeias
  • 21
  • 1
  • 2
  • 1
    Possible duplicate of http://stackoverflow.com/questions/8189352/decompile-python-2-7-pyc, which suggests many python decompilers to try. – John Lyon Oct 27 '13 at 20:54
  • I have tried uncompyle2 which gave be magic number error. I read that unpyc doesn't work with python 2.7. – mgkeias Oct 27 '13 at 21:14
  • Did you try Decompyle++ (pycdc), as linked in an answer there? It's not the accepted answer, but appears to be one that works for many people. – John Lyon Oct 27 '13 at 22:31

1 Answers1

0

I have created some tools which will help in dealing with pyinstaller. There are many ways you can go.

If you just want to extract the exe to get all the embedded files, including the ones inside the pyz use this script. Afterwards use Easy Python Decompiler to decompile the pyc files.

If you want to dig deeper and recompile the exe then use Pyinstaller exe rebuilder tool.

Extreme Coders
  • 3,441
  • 2
  • 39
  • 55