Skip to content
eduble edited this page Jul 16, 2012 · 2 revisions

Pyc2py is a python decompiler: you can use it to retrieve the source code when having the bytecode file (*.pyc).

It is currently beta software and was only tested with python2.6 bytecode files.

Usage

./main.py <path_to_your_pyc_file> > output.py

If the python version corresponding to your bytecode file is not the default on your system, specify it at first.

For example if your system default is python 2.7, and you want to decompile a python 2.6 bytecode file, run:

python2.6 ./main.py <path_to_your_pyc_file> > output.py

Important design note

In order to simplify its design, pyc2py uses python introspection features. Thanks to this, bytecode analysis is limited to function and class methods. As a consequence, the first step of the analysis is the import of the module implemented in the *.pyc input file; if this module imports other modules, these additional modules must be present in the python path (in either form, '.py' or '.pyc'), otherwise this preliminary import will fail.

Clone this wiki locally