Files
reverse-skills-max/vendor-new/analyst-ai-pack/skills/scripting-ghidra-headless-analysis/references/api-reference.md

1.3 KiB

API Reference: Scripting Ghidra Headless Analysis

Overview

scripts/analyst.py generates a Ghidra analyzeHeadless command line and a Jython-compatible post-analysis script that exports functions and/or strings to JSON. It only generates text — it does not run Ghidra or any sample.

Dependencies

Package Version Purpose
(stdlib) — shlex, JSON, file IO

Core functions

command(project, name, import_dir, script, recursive, overwrite)

Builds the analyzeHeadless invocation with common flags.

postscript(out, emit)

Writes a Jython post-script emitting functions and/or strings to a JSON file next to the program.

Generated script notes

  • Targets Jython 2 (no f-strings); uses currentProgram, getFunctionManager, getListing.

Usage

python scripts/analyst.py command --project /proj --name Batch --import ./samples --script export.py
python scripts/analyst.py postscript --out export.py --emit functions,strings

Sources