This script exports all decompiled functions from a binary loaded in Ghidra into a single .txt file using the Ghidra Decompiler API.
Created by EllE, this tool is helpful for reverse engineers and CTF players who want to analyze or share all decompiled code at once.
- Decompile all functions in the current program.
- Output clean, readable C code for each function.
- Save to a single output
.txtfile. - Automatically handles errors and logs failed decompilations.
- Open your Ghidra project and load a binary.
- Open Script Manager:
Window → Script Manager. - Click "New Script", choose Python.
- Paste in the code from
ExportAllDecompiledFunctions.py. - Save the script.
- Select the script from the Script Manager.
- Click Run.
- Choose an output directory when prompted.
- A text file like
yourbinary_decompiled.txtwill be saved in that directory.
/* Function: main */
void main() {
...
}
/* Function: validate_input */
bool validate_input(char *input) {
...
}- Ghidra 10.x or newer
- Ghidra Python (Jython) scripting enabled
MIT License — free to use, modify, and share.
EllE A reverse engineer and developer who builds tools for speed, clarity, and precision.