modules/home/programs/cli-agents/shared/skills/reversing/ghidra-cli/SKILL.md
Guide to using ghidra-cli for headless Ghidra automation. Use when analyzing binaries, decompiling functions, searching for patterns, tracing cross-references, patching bytes, or running automated reverse engineering workflows.
npx skillsauth add not-matthias/dotfiles-nix ghidra-cliInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Rust CLI that drives Ghidra headlessly via a persistent Java bridge process. Sub-second queries because Ghidra stays loaded in memory between commands.
ghidra-cli ──TCP──▶ GhidraCliBridge.java (Ghidra JVM, auto-started)
One bridge per project, keyed by ~/.local/share/ghidra-cli/bridge-{md5}.port. Commands auto-start the bridge if it isn't running.
# Verify everything is found
ghidra-cli doctor
On NixOS, GHIDRA_INSTALL_DIR and java in PATH are injected automatically by the Nix wrapper — no manual config needed. doctor should show all green out of the box.
# 1. Import binary and run analysis (bridge auto-starts)
ghidra-cli import ./target --project myproject --program target
ghidra-cli analyze --project myproject --program target
# 2. Explore
ghidra-cli stats
ghidra-cli function list
ghidra-cli find interesting
# 3. Drill into a function
ghidra-cli decompile main
ghidra-cli disasm 0x401000 --instructions 30
# 4. Trace references
ghidra-cli x-ref to 0x401000
ghidra-cli graph callers main --depth 2
# 5. Patch and export
ghidra-cli patch nop 0x401234 --count 3
ghidra-cli patch export -o patched.bin
ghidra-cli project create <name>
ghidra-cli project list
ghidra-cli import <binary> --project <p> --program <name>
ghidra-cli analyze --project <p>
ghidra-cli function list
ghidra-cli function list --filter "size > 100"
ghidra-cli decompile <name-or-addr> # pseudocode
ghidra-cli disasm <addr> --instructions 20 # raw disassembly
ghidra-cli symbol list
ghidra-cli symbol create <addr> <name>
ghidra-cli symbol rename <old> <new>
ghidra-cli type list
ghidra-cli type get <name>
ghidra-cli x-ref to <addr> # what calls/references this address
ghidra-cli x-ref from <addr> # what this address calls/references
ghidra-cli find string "password"
ghidra-cli find bytes "90 90 90"
ghidra-cli find function "*crypt*"
ghidra-cli find crypto # known crypto constants
ghidra-cli find interesting # suspicious patterns (good starting point)
ghidra-cli graph callers <func> --depth 3 # who calls this?
ghidra-cli graph callees <func> --depth 3 # what does this call?
ghidra-cli graph export dot # export full graph as DOT
ghidra-cli patch bytes <addr> "90 90"
ghidra-cli patch nop <addr> --count 5
ghidra-cli patch export -o patched.bin
ghidra-cli comment get <addr>
ghidra-cli comment set <addr> "note" --comment-type EOL
ghidra-cli comment list
ghidra-cli script list
ghidra-cli script run myscript.py
ghidra-cli script python "print(currentProgram)"
ghidra-cli start --project <p> --program <name> # explicit start
ghidra-cli status --project <p>
ghidra-cli stop --project <p>
ghidra-cli restart --project <p> --program <name>
ghidra-cli stats # function/string/symbol counts
ghidra-cli summary # program metadata
ghidra-cli batch commands.txt # run commands from file
Append --filter "<expr>" to list commands:
ghidra-cli function list --filter "size > 100"
ghidra-cli function list --filter "name contains 'main'"
ghidra-cli strings list --filter "length > 20"
--json: force compact JSON--pretty: force indented JSON--fields "name,address,size": select specific fieldsghidra-cli function list --pretty
ghidra-cli function list --json | jq '.[] | select(.size > 500)'
Each project runs its own bridge, so you can analyze multiple binaries in parallel:
ghidra-cli import ./a --project projA && ghidra-cli analyze --project projA &
ghidra-cli import ./b --project projB && ghidra-cli analyze --project projB &
wait
ghidra-cli function list --project projA
ghidra-cli function list --project projB
Effective pattern for agent-driven analysis:
ghidra-cli find interesting — get a quick map of suspicious areasghidra-cli decompile <func> — read pseudocode of suspicious functionsghidra-cli x-ref to <addr> — trace who reaches interesting codeghidra-cli graph callers <func> --depth 3 — understand call contextghidra-cli comment set <addr> "..." — annotate findings inlineghidra-cli patch nop <addr> + patch export — apply fixesimport + analyze before querying. The bridge auto-starts but won't auto-import.--project flag: most commands accept --project to target a specific project; omit it only when there's a single active one.patch nop --count: parsed by CLI but bridge currently applies single-address NOP — patch each address explicitly if needed.--comment-type: only EOL is reliably supported; other types fall back silently.ghidra package bundles its own JDK.documentation
Save notes, journal entries, and research to the personal-notes Obsidian vault (personal-vault-v2). Use when the user asks to 'save note', 'save to notes', 'write to personal notes', 'save to daily notes', 'note this down', or wants to persist findings/analysis to their personal vault.
documentation
Use whenever the user asks to address, fix, resolve, review, or respond to pull-request comments or review feedback.
development
Apply Not Matthias's Rust-first personal coding style. Use whenever the user explicitly asks to apply or review their code style, make Rust match their preferences, perform a style pass, or simplify/refactor according to their conventions. Inspect only task-touched code, honor local project conventions first, and make only safe opt-out style edits.
development
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics.