Skip to main content

ghidra-decomp

Bulk-decompile binaries into browsable source trees using Ghidra.

Takes a binary, runs Ghidra's decompiler on every function, and produces a directory of .c files and JSON indexes — ready for grep, code review, or AI-assisted analysis.

Why

Reverse engineering through Ghidra's GUI (or MCP) means looking at one function at a time. This tool dumps everything upfront so you can treat the binary like a normal codebase: grep for patterns, read call graphs, search strings — all without waiting for decompilation round-trips.

Install

Requires Ghidra 12.0+ and PyGhidra 3.0+.

make install

Or manually: pip install -e .

Set GHIDRA_INSTALL_DIR to your Ghidra installation, or pass --ghidra-path.

Usage

ghidra-decomp ./firmware.bin -o ./firmware_decomp
Flag Description Default
-o, --output Output directory <binary>_decomp/
--timeout Per-function decompilation timeout (seconds) 60
--combined Also emit all_functions.c off
--ghidra-path Path to Ghidra install $GHIDRA_INSTALL_DIR
--base-addr Rebase binary to this address before analysis none
--entry Mark address as entry point before analysis none
--language Force Ghidra language ID (e.g. ARM:LE:32:v7) auto
--compiler Force compiler spec ID. Requires --language. auto
--list-languages List all available language/compiler IDs, then exit
--workers Decompiler threads min(4, CPU count)
--resume Reuse hash-valid per-function artifacts from existing output off
--include / --exclude Function name regexes. Repeatable. all
--function Export function at this address. Repeatable.
--gdt Apply a Ghidra data type archive. Repeatable. none
--gzf Also export program.gzf off
--semgrep-config Scan pseudocode with semgrep, write semgrep.sarif off

Output

firmware_decomp/
├── manifest.json
├── functions/
│   ├── 00010000_<digest>_main.c
│   ├── 00010000_<digest>_main.json
│   └── ...
├── assembly/
│   ├── 00010000_<digest>_main.s
│   └── ...
├── xrefs.jsonl
├── all_functions.c     # --combined
├── program.gzf         # --gzf
├── semgrep.sarif       # --semgrep-config
├── types.json
├── functions.json
├── callgraph.json
├── strings.json
├── imports.json
├── exports.json
├── symbols.json
├── sections.json
└── metadata.json

See docs/output-format.md for the full artifact contract, sidecar structure, type records, and manifest semantics.

Workflow

  1. Dump the binary with ghidra-decomp
  2. Analyze the output like source code — grep, glob, read
  3. Re-run with --resume, or narrow with --include/--function
  4. Write back renames/annotations to Ghidra via MCP (separate tool, not yet built)

Docs

  • Output format — artifact contract, sidecars, types, manifest
  • Raw binaries — language/compiler selection, rebasing, entry points
  • Development — testing, CI, fixture regeneration

License

MIT

Metadata

Release files for ghidra-decomp 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ghidra-decomp 0.7.0
File Size Uploaded Provenance Actions
ghidra_decomp-0.7.0.tar.gz 88.5 kB Without provenance Details for ghidra_decomp-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ghidra-decomp 0.7.0
File Interpreter ABI Platform Actions
ghidra_decomp-0.7.0-py3-none-any.whl Python 3 none any Details for ghidra_decomp-0.7.0-py3-none-any.whl

Total release size: 123.8 kB

Release files / ghidra_decomp-0.7.0.tar.gz

Download URL ghidra_decomp-0.7.0.tar.gz
Size 88.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bac23b94a87a85a99e66b9708e5c2fce6c3d042054619895fba0e095db4579e8
BLAKE2b-256 checksum
How to use checksums
7490a76c9b72ae57eb2a3e50d24cb76a4d7992fdac1e77a43b18cd8322642989
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ghidra_decomp-0.7.0-py3-none-any.whl

Download URL ghidra_decomp-0.7.0-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11a0bc4d4ffbfd2936b13374953dd8d2c1bf1ddf6456f2a19c7acdb4292b3d4e
BLAKE2b-256 checksum
How to use checksums
42bbdb2494fe7aadbe3b0d3afc777d585fdb27db81bda10418ebc4eb0ec06faf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ghidra-decomp 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page