# 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](https://github.com/tanepiper/game-frame/blob/main/scripts/ghidra-run.sh).

## 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.bin blocks    analysis/notes/blocks.txt derived/loadmap.tsv

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). Use --project DIR for another project. Ghidra locks a project: run one job
per project at a time.
```

## Named by

Skills: [re-rea](/skills/re-rea), [re-ghidra](/skills/re-ghidra), [re-trace](/skills/re-trace).
