A Ghidra script that exports decompiled pseudocode of all functions from an open program to a text file.
This script automatically iterates through all functions in a loaded Ghidra program, decompiles them, and saves the pseudocode to a specified file. Useful for analyzing large binary files and creating documentation.
- Export all functions from the current program
- Decompilation to C pseudocode
- Save with function name and entry point address
- Decompilation error handling
- Formatted output with separators
-
Copy the
func_export.pyfile to your Ghidra scripts directory:- Windows:
%USERPROFILE%\ghidra_scripts - Linux/Mac:
~/ghidra_scripts
- Windows:
-
Restart Ghidra or refresh the script list via Window → Script Manager
- Open a binary file in Ghidra
- Run the script via Window → Script Manager
- Choose the path to save the pseudocode file
- Wait for the export to complete
Each function is exported in the following format:
================================================================================
Function: main at 00401000
================================================================================
[Function pseudocode]
- Ghidra 9.x or higher
- Jython (built into Ghidra)
- Decompilation timeout is set to 30 seconds per function
- Functions that fail to decompile will be marked in the output file
- The script works with the currently open program in Ghidra
ivblz
Free to use