ghidra-run
Tool
scripts/ghidra-run.sh(script, Scripts). Run one of the tools/ghidra scripts on a binary in an existing, analysed Ghidra project, without analysing it again (about a minute of start-up, so batch addresses in one run).
Run it as scripts/ghidra-run.sh. Source on GitHub.
Its own help
This is the help text in the tool itself, as ./gameframe tool ghidra-run prints it.
text
Run one of the tools/ghidra scripts on a binary in an existing, analysed Ghidra project,
without analysing it again (about a minute of start-up, so batch addresses in one run).
scripts/ghidra-run.sh BINARY SCRIPT OUTPUT [ARGS ...]
scripts/ghidra-run.sh game.exe decompile analysis/notes/rng.txt 0x140001000 0x140001080
scripts/ghidra-run.sh game.exe named analysis/notes/random.txt Random Rand
scripts/ghidra-run.sh game.exe refs analysis/notes/refs.txt 0x140009000
scripts/ghidra-run.sh game.exe vtable analysis/notes/vt.txt Tree 0x140008000 16
scripts/ghidra-run.sh game.exe labels analysis/notes/labels.txt labels/names.tsv
scripts/ghidra-run.sh game.exe callargs analysis/notes/sounds.tsv PlaySound rng_next
scripts/ghidra-run.sh GAME.EXE callargs analysis/notes/srand.tsv regs=watcom srand # register arguments too
scripts/ghidra-run.sh game.bin blocks analysis/notes/blocks.txt derived/loadmap.tsv
scripts/ghidra-run.sh game.exe disasm analysis/notes/rng.asm 0x140001000 0x140001200-0x140001240
scripts/ghidra-run.sh GAME.EXE fill-gaps analysis/notes/fill.txt analysis/notes/starts.txt [EXPORT_DIR]
SCRIPT is decompile (ExportAddressBatch: also creates functions Ghidra missed, such as
callbacks reached only through tables), named (ExportNamedFunctions), refs (ExportAddressRefs:
every reference to an address, with the referring function decompiled) or vtable
(ExportVtableSlots: LABEL 0xTABLE [SLOTS] ...) or labels (ApplyLabels: name functions and
globals from a TSV, creating missing functions; it saves the project, so export again after
it with scripts/ghidra-export.sh --labels, or re-run decompile), callargs (ExportCallArgs:
every call to the named functions with the constant arguments at each call) or blocks
(AddMemoryBlocks: add raw pieces of memory from a load map; it saves the project, so
analyse again) or disasm (ExportDisasm: the instructions of the functions containing the
addresses, of START-END ranges decoded in order, or of every function with no addresses) or
fill-gaps (the likely starts that tools/triage/exportcov.py --starts wrote, one address a
line: makes a function at each, as decompile does, writes the report to OUTPUT, then exports
the binary again into EXPORT_DIR, default analysis/export, so decomp.c, functions.tsv and
bodies.tsv hold the new functions; a start that fails is reported and the rest go on; run
exportcov again after it to see what is left). Use --project DIR for another project. Ghidra locks a project: run one job
per project at a time.