Convert program to pyc file using
- download :extremecoders-re/pyinstxtractor: PyInstaller Extractor
- Put the code and program in the same directory
- Generate pyc file:
python software name
Use the pycdc tool to decompile pyc files to obtain source code
- Download and compile pycdc:zrax/pycdc: C++ python bytecode disassembler and decompiler
- Compile with visual studio+cmake in Windows (not recommended, decompile code completion)
- Compile directly using cmake in linux
- Use cmake to compile in Windows WSL environment (recommended, less installation, full decompilation code)
- Copy the generated program to the pyc file directory
- Decompile pyc file: pycdc -o py filename pyc filename
- This way, it is best to obtain source code, so you don't need to read it down, but there may be problems with higher versions of python, for example
- Unsupported opcode: JUMP_BACKWARD
- # WARNING: Decompyle incomplete
- If an error occurs, you can continue reading, which may be helpful
Use the pycdas tool to decompile pyc files and obtain assembly code
- Compiling pycdc will also generate pycdas, and copy this program to the pyc file directory
- Decompile pyc file into assembly code: pycdas -o py filename pyc filename
Use AI tools to decompile assembly code to obtain source code
- Copy the assembly code decompiled by pycdas into the ai dialogue. I use deepseek and let it "fix the code" to get the source code
- Code compilation and repair: The generated code is still a bit of syntax problem, but the problem is not big and easy to fix. Basically, it will come out after compilation, so you need to modify it manually.
refer to:
- Decompile Python 3.11 EXE files using pyxtractor and AI (chatgpt blackboxai)! NEW METHOD 2023/2024 - YouTube