pyghidra is a Python package that provides a native CPython interface for Ghidra, the NSA's reverse engineering framework. Current version 3.0.2 supports Ghidra 12.x and requires Python >=3.9. It enables scripting Ghidra with standard Python and accessing its API directly within the Ghidra GUI or headlessly.
pip install pyghidraNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Start Ghidra headlessly, load a binary, and iterate over its functions.
Ensure GHIDRA_INSTALL_DIR environment variable points to the correct Ghidra version matching pyghidra.
Replace `pyghidra.open()` with `pyghidra.start()`.
Use full Java package path: e.g., `from ghidra.program.model.listing import Function`.
Install pyghidra with pip install pyghidra or upgrade to latest.
Set GHIDRA_INSTALL_DIR=/path/to/ghidra before running Python.
Iterate directly: `for func in funcs:` or convert to list with list(funcs).