2011-09-22 20:53:45 -07:00
# Decompyle++
***A Python Byte-code Disassembler/Decompiler***
Decompyle++ aims to translate compiled Python byte-code back into valid
and human-readable Python source code. While other projects have achieved
this with varied success, Decompyle++ is unique in that it seeks to
support byte-code from any version of Python.
Decompyle++ includes both a byte-code disassembler (pycdas) and a
decompiler (pycdc).
As the name implies, Decompyle++ is written in C++.
If you wish to contribute, please fork us on github at
https://github.com/zrax/pycdc
2014-06-10 19:26:53 -07:00
## Building Decompyle++
2014-12-03 18:07:27 -08:00
* Generate a project or makefile with [CMake ](http://www.cmake.org ) (See CMake's documentation for details)
2020-10-19 20:55:20 -04:00
* The following options can be passed to CMake to control debug features:
| Option | Description |
| --- | --- |
| `-DCMAKE_BUILD_TYPE=Debug` | Produce debugging symbols |
2020-10-20 00:42:44 -04:00
| `-DENABLE_BLOCK_DEBUG=ON` | Enable block debugging output |
| `-DENABLE_STACK_DEBUG=ON` | Enable stack debugging output |
2020-10-19 20:55:20 -04:00
2014-12-03 18:07:27 -08:00
* Build the generated project or makefile
* For projects (e.g. MSVC), open the generated project file and build it
* For makefiles, just run `make`
2024-06-11 14:31:41 +02:00
* To run tests (on \*nix or MSYS), run `make check JOBS=4` (optional
`FILTER=xxxx` to run only certain tests)
2011-09-22 20:53:45 -07:00
2014-06-10 19:26:53 -07:00
## Usage
2011-09-22 20:53:45 -07:00
**To run pycdas**, the PYC Disassembler:
2014-06-10 19:26:53 -07:00
`./pycdas [PATH TO PYC FILE]`
2011-09-22 20:53:45 -07:00
The byte-code disassembly is printed to stdout.
**To run pycdc**, the PYC Decompiler:
2014-06-10 19:26:53 -07:00
`./pycdc [PATH TO PYC FILE]`
2011-09-22 20:53:45 -07:00
The decompiled Python source is printed to stdout.
Any errors are printed to stderr.
2022-06-15 11:37:07 +01:00
**Marshalled code objects**:
Both tools support Python marshalled code objects, as output from `marshal.dumps(compile(...))` .
2022-10-02 15:44:29 +05:30
To use this feature, specify `-c -v <version>` on the command line - the version must be specified as the objects themselves do not contain version metadata.
2022-06-15 11:37:07 +01:00
2011-09-22 20:53:45 -07:00
## Authors, Licence, Credits
Decompyle++ is the work of Michael Hansen and Darryl Pogue.
2014-06-10 19:26:53 -07:00
Additional contributions from:
* charlietang98
* Kunal Parmar
* Olivier Iffrig
* Zlodiy
It is released under the terms of the GNU General Public License, version 3;
See LICENSE file for details.