https://github.com/extremecoders-re/python-snippet-decompiler
Tool to assist during manual decompilation of Python bytecode
https://github.com/extremecoders-re/python-snippet-decompiler
decompiler python python3
Last synced: 12 days ago
JSON representation
Tool to assist during manual decompilation of Python bytecode
- Host: GitHub
- URL: https://github.com/extremecoders-re/python-snippet-decompiler
- Owner: extremecoders-re
- License: mit
- Created: 2023-03-23T14:23:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-20T12:19:03.000Z (about 1 year ago)
- Last Synced: 2024-11-05T02:36:12.881Z (5 months ago)
- Topics: decompiler, python, python3
- Language: Go
- Homepage:
- Size: 244 KB
- Stars: 38
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-python-re - pycdc (snippet decompiler) - This tool decompiles individual snippets of Python bytecode as opposed to entire binary files, aiming to help manual decompilation of binaries that are unsupported by state-of-the-art Python decompilers. (Decompilers)
README
# Python Snippet Decompiler
Modern versions of Python (> 3.7) are relatively harder to decompile. The decompilers which are currently available (viz [pycdc](https://github.com/zrax/pycdc), [uncompyle6](https://github.com/rocky/python-uncompyle6/), [decompile3](https://github.com/rocky/python-decompile3)) frequently error out when decompiling a .pyc from these versions. Hence often it is needed to manually decompile Python bytecode by hand. Manual decompilation takes a lot of time and as a result this tool was built to assist during the process.
Python Snippet Decompiler is a tool to assist during manual decompilation of Python bytecode. The idea is to input small snippets of bytecode instructions which the tool attempts to decompile with pycdc. The instruction provided as input should be free from any control flow instruction. Control flow should be manually handled anyway.
~~Note: Python 3.11 pyc files are not supported at the moment as the underlying library xdis doesn't support 3.11 currently.~~
Python 3.11 and 3.12 are supported. For these versions the native python marshal module is used rather than xdis. This approach will be followed as long as xdis doesn't provide full support for 3.11 and above.
## Usage
Precompiled binaries for Windows are provided in releases. Grab the latest build and run
```
python-snippet-decompiler
```The tool is a terminal based TUI app with mouse support. Click on the "Paste Input" button to paste the instructions from clipboard. The instructions can be obtained using
```
pydisasm -F bytes
```pydisasm is a part of the `xdis` package and can be installed as `pip install xdis`.
Before clicking decompile, ensure the correct code object is selected on the left code objects listing.
Click on "Copy output" to copy the decompiled output to the clipboard.
## Screenshot

## License
MIT