No slash command · from reverse-engineering-plugin
Batch-decompile binaries with Ghidra headless, exporting decompiled C for every function. Covers the Ghidra 12 Jython-to-PyGhidra break and project lock issues.
Ships in reverse-engineering-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Drive Ghidra from the shell to reverse-engineer a binary at scale: import once,
then run scripts that export decompiled C, call graphs, or xrefs to flat files
you rg through. The alternative — clicking through the GUI — does not scale to
hundreds of functions and is not reproducible.
analyzeHeadless lives at <ghidra>/support/analyzeHeadless. On Homebrew:
/opt/homebrew/Cellar/ghidra/*/libexec/support/analyzeHeadless (resolve the
newest). ghidraRun on PATH points at the install's bin/.
Ghidra 12 dropped Jython and switched to PyGhidra, which analyzeHeadless
does not ship with. A .py postScript fails with:
ERROR SCRIPT ERROR: *.py : Ghidra was not started with PyGhidra. Python is not available
Write post-scripts as Java GhidraScript subclasses (DumpC.java, no package).
analyzeHeadless compiles them on the fly. This is the single most common
headless footgun on a current install.
# First run: import + auto-analyze (slow, once).
analyzeHeadless <proj-dir> <proj-name> -import /abs/path/to/binary \
-scriptPath <script-dir> -postScript DumpC <abs-out.c>
# Later runs against the same project: -process (not -import), skip re-analysis.
analyzeHeadless <proj-dir> <proj-name> -process binary \
-noanalysis -scriptPath <script-dir> -postScript OtherScript ...
-import of the same file fails (already in project). Use -process,
or -overwrite to re-import.-noanalysis skips re-running the analyzers; auto-analysis only needs to run
once.analyzeHeadless
invocations against the same project concurrently; the second fails
project-locked. Serialize Ghidra; parallelize the analysis of its output
instead (see "Pre-dump, then dispatch").DumpC.java — the workhorse. Decompile all functions, write C with a
// ==== name @ addr ==== header per function:
import ghidra.app.script.GhidraScript;
import ghidra.app.decompiler.*;
import ghidra.program.model.listing.*;
import ghidra.util.task.ConsoleTaskMonitor;
import java.io.*;
public class DumpC extends GhidraScript {
public void run() throws Exception {
String out = getScriptArgs().length > 0 ? getScriptArgs()[0] : "/tmp/dump.c";
DecompInterface ifc = new DecompInterface();
ifc.setSimplificationStyle("decompile");
ifc.openProgram(currentProgram);
ConsoleTaskMonitor mon = new ConsoleTaskMonitor();
PrintWriter w = new PrintWriter(new FileWriter(out));
for (Function f : currentProgram.getFunctionManager().getFunctions(true)) {
DecompileResults r = ifc.decompileFunction(f, 60, mon);
if (r != null && r.decompileCompleted()) {
w.println("// ==== " + f.getName() + " @ " + f.getEntryPoint() + " ====");
w.println(r.getDecompiledFunction().getC());
}
}
w.close();
ifc.dispose(); // always dispose
println("DUMPED_FUNCTIONS=" + currentProgram.getFunctionManager().getFunctionCount());
}
}
Then the answer is usually one rg away:
rg -n 'GetBiosKey|0x4d53445f' dump.c # a string, a constant
rg -n 'DAT_005054b0\s*=[^=]' dump.c # who WRITES a global
awk 'NR<=L && /^\/\/ ====/{h=$0} NR==L{print h}' L=<lineno> dump.c # enclosing function
ReferenceManager.getReferencesTo(addr) returns a ReferenceIterator, not an
array — drain it into a List before sizing or re-iterating.WndProc registered by writing its address to a global). Promote with
new CreateFunctionCmd(toAddr(0x...L)).applyTo(currentProgram), confirm with
getFunctionManager().getFunctionContaining(addr) != null, then decompile.__,
or _ + lowercase — _malloc, __ioinit): they flood any BFS from entry and
add nothing to program logic.When a question wants parallel analysis ("characterise N functions"), do one Ghidra run that emits all needed artifacts to flat files, then dispatch read-only agents over the pre-computed files. This sidesteps the project lock and makes each agent's input self-contained. Always grep the existing dumps before a new run — a prior wave's dump often already holds the function or global, and the planned Ghidra run is unnecessary. Say in the brief what is already dumped so the agent does not re-derive it.
tools-plugin:binary-analysis — strings/binwalk/objdump triage before Ghidra.firmware-dump-region-map — carve the right region out of a firmware image
before importing it here.agent-patterns-plugin:exclusive-lock-dispatch — the general pattern behind
the project-lock serialization.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub laurigates/claude-plugins --plugin reverse-engineering-plugin6 skills in this plugin
/acpi-table-reReverse-engineer ACPI tables (DSDT/SSDT) with iasl. Use when investigating a device's ACPI definition — find a device by _ADR/_HID, read a _DSM, or map wake sources (_PRW/GPE) for suspend/drain work. Covers iasl decompilation, the live tables on Linux, and the methods to grep./device-passthrough-feasibilityDecide whether hardware or a physical address range can be forwarded into a VM. Use when asked "can I pass through device X to a guest" or "alias physical address Y into the VM". Covers what's bindable, the /proc/iomem+e820 check, data-plane vs control-plane, and why a TEE defeats it./firmware-dump-region-mapEnumerate every region of a firmware/BIOS/SPI-flash dump before reverse-engineering one. Use when handed a flash image and about to carve out the EC, a DXE driver or the ME region. Covers the flash descriptor, extracting compressed UEFI volumes (raw grep misses strings), and host-vs-device split./re-deterministic-examinerBuild a deterministic examiner for a binary format instead of guessing. Use when reverse-engineering a packed/proprietary format and inferring a field, record size, grid, or asset identity from indirect evidence. Covers slicing into labelled units, measuring, and refusing when underdetermined./sgx-sealed-secret-recoveryReason about whether an SGX/TEE-sealed secret is recoverable. Use when reverse-engineering a feature whose key lives in an SGX enclave, when a driver links sgx_urts, or deciding if a sealed blob unseals off-platform. Covers the CPU+MRSIGNER binding, the created-on-device inference, and what works.Other plugins' skills for the same job