In this article, I have organized an ultimate list of the best Python decompiler projects that are available for reverse engineers. These tools will allow you to extract source code from compiled Python files like .pyc, .pyo, and .pyd.
Decompiling Python bytecode is helpful if you want to understand how the software works without having access to the original source code.
These tools are well-equipped for tasks like:
- exe to py
- pyc to py
- pyo to py
- pyd to py
- pyz to py
The below list contains free, paid, open-source, and online Python decompilers.
Let’s have a look at the features, pros/cons, and usage details of the below given Python decompilers and then select the best Python decompiler that can fulfill your specific requirements.
Python decompiler for version 3.7, 3.8, and up. It is stripped down from uncompyle6 so we can refactor and start to fix up some long-standing problems.
For example, uncompyle6 is awesome, but it has a fundamental problem in the way it handles control flow. In the early days of Python when there was little optimization and code was generated in a very template-oriented way, figuring out control flow structures could be done by simply looking at code patterns.
Over the years more code optimization, specifically around handling jumps has made it harder to support detecting control flow strictly from code patterns. This was noticed as far back as Python 2.4 (2004) but since this is a difficult problem, so far it hasn’t been tackled in a satisfactory way.
decompyle3 is introduced to fix this issue.
uncompyle6 translates Python bytecode back into equivalent Python source code. It accepts bytecodes from Python version 1.0 to version 3.8, spanning over 24 years of Python releases.
It is a native Python cross-version decompiler and fragment decompiler. It is the successor to popular decompilation tools decompyle, uncompyle, and uncompyle2.
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++ is a Python Byte-code Disassembler/Decompiler. It’s because Decompyle++ includes both a byte-code disassembler (pycdas) and a decompiler (pycdc).
As the name implies, Decompyle++ is written in C++.
This is a GUI tool for decompiling Python bytecode files like .pyc and .pyo back to .py using existing tools.
It’s also bundled with a modified pyinstxtractor for making it easy to extract pyinstaller packaged executables.
UnPYC is specifically designed as a pyc decompiler for Windows only.
- Can decompile Python bytecode versions 2.6, 2.7, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, using tools like uncompyle6.
- Can extract pyinstaller package using pyinstxtractor.
- Makes it easy to decompile pyc’s even without Python installed in the system.
- Helps in decompiling pyc’s of different versions.
- Works offline if dependencies and Python sources are satisfied, which can be done easily.
Easy Python Decompiler
Easy Python Decompiler is Python bytecode decompiler. It can decompile pyc & pyo files to python source code.
It supports Python versions from 1.0 to 3.4. No python installation is necessary for decompiling!
This project makes use of two popular decompilers which are Decompyle++ and Uncompyle2.
By using Easy Python Decompiler, you can decompile a single file or a whole directory.
Also, it supports Unicode filenames.
- Decompiles python 1.0 – 3.4
- No python installation is needed.
- Unicode filename support.
- Nice GUI, no fiddling on a command line
- The new decompiler engine is blazing fast.
decompile-py2exe takes an executable (.exe file) as argument, extracts the Python bytecode and decompiles it with uncompyle6, all in one step. The executable can also be passed via stdin or inside a (password protected) ZIP file. Be sure to use Python 3 to run decompile-py2exe.
If you want to decompile an exe file that is based on older versions of Python then you can use unpy2exe to extract the Python bytecode as a pyc file, which can then be decompiled with uncompyle6.
It is a Visual Studio Code extension that makes use of several decompilers for different programming languages. In our case, it can decompile .pyc and .pyo files to reveal their Python source code.
Just right-click → Decompile on a supported executable and wait for the magic to happen.
The decompilation result is added to a temporary sub-workspace. You can right-click → Download files to your local file-system right from the sub-workspace.
pydumpck is a multi-threads tool for decompiling exe, elf, pyz, and pyc files that are created using Python. It is based on pycdc and uncompyle6 packages. Sometimes its .py file result is not exactly right.
Python exe Unpacker
A script that helps researcher to unpack and decompile executable written in python. However, right now this only supports executable created with py2exe and pyinstaller.
This script glues together several tools available to the community. Hopefully, this can help people in their daily job. Several YARA rules are available to determine if the executable is written in python (This script also confirms if the executable is created with either py2exe or pyinstaller).
Python Decompiler Online
It is a website where you can upload your .pyc file and after processing, it will display the decompiled Python code on the screen.
It is no doubt the best pyc decompiler online.
This website provides an all in one decompiler solution for different programming languages and compiled files. In our case, you can upload your .pyc or .pyo files and decompile them back to Python source code.