/tool:ghidrafrom tool
Use when reading, annotating, or emulating a binary through Ghidra, covering headless scripts and the Serve process
Ships in tool. 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.
Read when SKILL.md points to them; scripts run unread.
analyzeHeadless imports each binary once into one Ghidra project under $GHIDRA_PROJECT_DIR named after the binary's file name, with its architecture slices and earlier releases as programs named after their files. Every question on one binary runs bundle scripts on that project's saved programs, run after run or through its one Serve.java process.
[SCRIPTS]:
[FACTS]:
REPORT SCRIPT ERROR in output and a missing <out> mark failureDecompile.java and CallSites.java with their message, one function's failure stays a row<decompiler> being $GHIDRA_INSTALL_DIR/Ghidra/Features/Decompilermake -C <decompiler>/src/decompile/cpp ARCH_TYPE= ghidra_opt builds one as ghidra_opt, moved to <decompiler>/os/<platform>/decompile with <platform> the folder Ghidra reads (mac_arm_64, mac_x86_64, linux_x86_64)$GHIDRA_INSTALL_DIR/support/analyzeHeadlessREADME.md lists every headless flag$GHIDRA_PROJECT_DIR names a folder in the per-user cache of the platform, as Ghidra rejects a project path with a dot-prefixed component<name>/<folder> as the project argument places an import under /<folder>, one folder per slice or release-deleteProject on an -import deletes the project that run created with its analysis<file>.<n>, -process <file> keeps reading the first-readOnly included, a second run aborts with LockException while that JVM liveslsof -t "$GHIDRA_PROJECT_DIR/<name>.lock~" prints the holding JVM's pid, empty output means lock files a dead run left block nothinganalyzeHeadless shell leaves its child JVM holding the lock&& in one Bash call, runs on other projects start in parallel-readOnly discards them, Serve.java saves each changed program with or without -readOnly0x<hex>, or FUN_<hex>, rows print hex with no 0xFUN_<hex> name, the entry address stays the keyApply Data Archives applies mac_osx.gdt to a Mach-O at import, libc and CoreFoundation prototypes need no header-process without -noanalysis re-analyzes the whole programObjective-C Message Analyzer recurses with no cancellation check past -analysisTimeoutPerFile, imports skip it for Stubs.javaMAXMEM_DEFAULT and holds it until exitdecompile processes outside the heap, -max-cpu <n> caps one run at n + 1Serve.java run as background commands and end with a completion notice, -process script runs take the foreground-scriptPath compiles each listed directory as one bundle at the JDK JAVA_HOME names, subdirectories become packagesGHIDRA_JAVA_OPTIONS namesosgi/parallel.lock<out>, <stubs>, <catalog>, and <report> go under <subject>/decompiled/<program>/ of the folder the caller names alone<macros>, <plan>, and <rows> go under <work>/<name>/, <work> and <logs> being ignored folders of the working repository-log create their file's folder, lipo and redirects need mkdir -p<logs>/ghidra.log appends each run's messages and printed lines, <logs>/ghidra-script.log the printed lines alonesearch:code for a Ghidra API signatureNumbered steps consume the step before. Bulleted cases are alternatives, one per command line in order.
Projects saved under $GHIDRA_PROJECT_DIR, a listed project takes no second import or copy, a binary without one takes an import:
[ -n "$GHIDRA_PROJECT_DIR" ] && mkdir -p "$GHIDRA_PROJECT_DIR" && fd -d 1 -e gpr --format '{/.}' . "$GHIDRA_PROJECT_DIR" || echo 'GHIDRA_PROJECT_DIR: unset'
<headless> opens project <name> with the scripts bundle:
analyzeHeadless "$GHIDRA_PROJECT_DIR" <name> -scriptPath scripts -log <logs>/ghidra.log -scriptlog <logs>/ghidra-script.log
Program paths of project <name>, index files under <name>.rep belong to Ghidra alone:
<headless> -process -recursive -readOnly -noanalysis 2>/dev/null | rg -or '$1' 'project file: (\S+)'
Imports:
lipo -archs <binary> lists of a universal Mach-O as the file the first line imports0x, and language named, then catalog<headless> -import <binary> -preScript Analyzers.java 'Objective-C Message Analyzer' -postScript Stubs.java <stubs> -postScript Catalog.java <catalog>
lipo -thin <arch> <binary> -output <work>/<name>/<file>.<arch>
<headless> -import <file> -loader BinaryLoader -loader-baseAddr <hex> -processor <languageID> -postScript Catalog.java <catalog>
<run> opens the saved program without analysis:
<headless> -process <file> -noanalysis
After import:
<out> from one function's linetimeout=<seconds> after a timeout and payload=<megabytes> after Response buffer size exceeded<run> -readOnly -postScript Decompile.java <out> 'str:<needle>' 0x<hex> callees=1 callers=1
rg -n '^// --- \[' <out>
sed -n '/^\/\/ --- \[FAILED\]/,/^\/\/ --- \[GLOBALS\]/p' <out>
Alternative runs:
<run> -readOnly -postScript Decompile.java <out> 're:.'
<run> -readOnly -postScript CallSites.java <out> <seed>...
<run> -readOnly -postScript Graph.java <out>
<run> -readOnly -postScript Rtti.java <out>
Seeds come from the catalog:
[STRINGS] rows name the functions holding the feature their text belongs to, [IMPORTS] rows name the functions calling each library[FUNCTIONS] rows separate a dispatcher from a leaf by size and callee count, callers=0 marks a function no call reaches<EXTERNAL> holds symbols no dylib exports_objc_msgSend_<selector> calls in a block are the message sendsCallSites.java list one selector's sends, seed _objc_msgSend lists every send per selectorSeeds and settings of Decompile.java and CallSites.java:
0x<hex> names the function containing the address, an Apply.java row creates a function where none starts<name> or <namespace>::<name> names functions by plain or qualified name, re:<regex> those with a matching plain or qualified namestr:<needle> names functions referencing a defined string holding the needle case-insensitively, through a __cfstring struct includedtag:<tag> names functions with the tag, re:. every non-external functioncallers=<depth> and callees=<depth> take 0 or more and default to 0timeout=<seconds> and payload=<megabytes> take 1 or more and default to 30 and 50CallSites.java takes timeout and payload aloneCallSites.java reads a thunk seed as the function it reachesRepeated reads and edits on one project run through one Serve.java process listening on $GHIDRA_PROJECT_DIR/<name>.sock:
ok <seconds>s[ saved <program>] or failed <seconds>s <cause><run> -postScript Serve.java
printf '%s\n' <program> <script> <argument>... | paste -s - | nc -U "$GHIDRA_PROJECT_DIR/<name>.sock"
echo stop | nc -U "$GHIDRA_PROJECT_DIR/<name>.sock"
<program> is a project path (<file> or /<folder>/<file>), <script> any script on -scriptPath, tab-split cells keep spacesnc exits 1 with no reply when no Serve.java runs on the projectSeeds below the catalog's top rows:
rg -n -i '<needle>' <catalog>
rg -n '<regex>' <catalog>
Edits from row files, one row per line with tabs between cells, apply names first, then prototypes, local removals, and renames over one decompile, then Catalog.java rewrites the catalog in the same process:
<run> -postScript Apply.java <report> <rows>... -postScript Catalog.java <catalog>
Apply.java rows:
<address> <namespace> <name> <prototype> <comment> <locals> <kind>, - or an empty cell for none, # lines skippedfunction (default) names, comments, and creates a function where none starts, label places a primary label and plate comment<a>::<b> creates the hierarchy and turns its innermost namespace into a class<local>=<name>[:<type>] renames and retypes a decompiled local or parameter, <local>= or re:<regex>= removes stored localsTypes and prototypes absent from mac_osx.gdt, from C headers:
#define linestypedef struct <name> <name>; lines declares types a prototype namesclang -dM -E -x c /dev/null -target <triple> -fno-blocks -o <macros>
<run> -postScript Headers.java <report> <header>... -I<dir>... -imacros <macros>
Headers.java:
-D<name>[=<value>] on the command wins over a macro in the -imacros file^ block pointers __BLOCKS__ enables, -fno-blocks keeps the macro out of <macros>-I<dir> names a directory and every header a file-I framework Headers, usr/include, and clang's includeTypes removed by path:
<run> -postScript Drop.java <report> /<category>/<name>...
AutoVersionTrackingScript.java copies names, comments, and prototypes from an analyzed earlier release in the same project:
<run> -postScript AutoVersionTrackingScript.java /<sessions> <session> /<folder>/<file>
Emu.java runs a JSON plan of runs on fresh p-code machines over the program image:
{
"steps": 2000000,
"stubs": { "<external>": "<sleigh>" },
"runs": [
{
"id": "<id>",
"entry": "<seed> | 0x<hex>",
"keep": false,
"steps": 2000000,
"registers": { "<register>": "0x<hex>" },
"memory": { "0x<hex>": "<hex bytes>" },
"reads": { "0x<hex>": 16 },
"results": [ "<register>" ]
}
]
}
<run> -readOnly -postScript Emu.java <out> <plan>
keep runs on memory the previous run leftx0 = *[ram]:8 0x<hex>:8;), a heap is a cell the stub advancesreturned at the sentinel, exhausted at the step budget, faulted with the p-code faultWork ends deleting <work>/<name>/ and each <out> no finding cites, the saved project keeps imports, analysis, and edits
Every file opens with // --- [INDEX] over // <program> <language> <counts>, sections with // --- [NAME] padded to column 90:
args=<arguments> closes the counts of a script that takes arguments after <out>[STRINGS] rows <address> <text> functions=<count> <name>..., [IMPORTS] rows <library> <prototype> callers=<count> <name>...[FUNCTIONS] rows <address> <name> size=<bytes> callers=<count> callees=<count> source=<source>[STRINGS] and [IMPORTS] rows rank by count and [FUNCTIONS] rows by size, names sort by entry address[FUNCTIONS] row[CALLS] rows <address> <name> -> <address> <name>, [REFERENCES] rows <address> <name> <- <from> <address> <name>|-// --- [<name>] over // <address> size=<bytes> <role> callers=<count>[: <names>]<role> is seed, caller:<depth>, or callee:<depth>, <names> the callers with a block in the file by entry address[FAILED] rows // <address> <name> <role>: <cause>, thunk and stub seeds hold // <address> thunk -> <name> or stub -> <name>$ and : of a stub name as _, _objc_msgSend$length appears as _objc_msgSend_length in a block[GLOBALS] holds one row // <address> <type> <name>[ = <value>] per global the blocks reference[TYPES] holds Ghidra's built-in typedefs, then every composite, enum, and typedef the blocks name// --- [<target>] over // <name> @ <address> callers=<count> calls=<count><address> <caller>: [$<selector> ]<arguments> sorted by caller entry then address$? marks a stub with no selector string resolved[FAILED] lists each caller the decompiler failed on and each call holding no argument list, with the cause[TYPEINFO] rows <address> class|si|vmi <type> [<base>@<offset>/<flags>...], types in Itanium encoding c++filt _ZTS<type> reads[VTABLES] rows <vtable> <typeinfo> <type> offset=<offset-to-top> slots=<count>[SLOTS] rows <vtable> <slot> <target> function|import|code <name>, [USERS] rows <vtable> <from> <function>|-[FAILED] rows <address> class|si|vmi|vtable|slot reads unmapped memory: <message>[LAYOUT] rows sentinel|traps|stack <address>, [STUBS] rows <address> <name> requested|fallback[ slot=<address>...][RUNS] rows <id> <stop> steps=<count> pc=<address>[: <cause>] <register>=0x<hex>..., [CALLS] rows <id> <step> <name> from <address>[READS] rows <id> <address> <hex>, [USEROPS] rows <id> <name> count=<count>[EXECUTED] and [UNINITIALIZED] rows <id> [<first>, <last>] per range executed or read outside the image and the run's writes[NAMED], [LABELED], [TYPED], [REMOVED], and [RENAMED] rows <address> <result>, [REJECTED] rows <address> <step>: <cause>[PARSED] and [FAILED] per header, [PREPROCESSOR] and [PARSER] messages, [APPLIED] and [REJECTED] per function[RENAMED] rows <address> <old> -> <new>, [UNCHANGED], [UNRESOLVED], and [REJECTED] rows <address> <name>[: <message>][REMOVED] and [ABSENT] rows per pathEach new postscript is one GhidraScript file in the bundle, arguments through Arguments.Usage or Arguments.parse, lines through Report.write:
javac against the jars under $GHIDRA_INSTALL_DIR/Ghidra and passes the project's Java checkerslib/<module>-src.zip beside each module jar under $GHIDRA_INSTALL_DIR/Ghidra holds the installed sourcescripts/Analyzers.java (opens in a new tab)scripts/Apply.java (opens in a new tab)scripts/CallSites.java (opens in a new tab)scripts/Catalog.java (opens in a new tab)scripts/Decompile.java (opens in a new tab)scripts/Drop.java (opens in a new tab)scripts/Emu.java (opens in a new tab)scripts/Graph.java (opens in a new tab)scripts/Headers.java (opens in a new tab)scripts/Rtti.java (opens in a new tab)scripts/Serve.java (opens in a new tab)scripts/Stubs.java (opens in a new tab)scripts/headless/Arguments.java (opens in a new tab)scripts/headless/Functions.java (opens in a new tab)scripts/headless/Report.java (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub bsamiee/rasm --plugin tool6 skills in this plugin
/debuggingUse when a program misbehaves at runtime and its cause is unproven (crash, hang, wrong value, breakpoint that never stops), covering the method from stop to report, debugger sessions, breakpoints, stops, hang and crash evidence, and cleanup/googleUse when work reads or writes any Google account or service (Gmail, Calendar, Drive, Docs, Sheets, Slides, Contacts, Tasks, Forms, Chat, Keep, YouTube, Apps Script, Cloud APIs, Workspace admin) or drives the owner's signed-in Chrome, web and chrome:// pages alike, covering account routing across gog, GAM, and Drive mounts, output shapes, edits, misleading errors, and Chrome settings, flags, and extensions through chrome-devtools/inspectUse when code for a vendor host (plug-in, extension, script, MCP client) needs a fact its documentation lacks or contradicts, covering evidence order across installed files, host state, binaries, and a running instance