Scripting
The upstream Script Manager organizes scripts by category and supports filtering by name or description. A script’s metadata can supply a category, menu path, toolbar icon, and key binding. The In Tool option exposes the corresponding action in the tool.
Start read-only
Section titled “Start read-only”- Open the Script Manager in CodeBrowser and inspect an existing small Java example.
- Read its source before running it. Scripts execute with your account’s permissions.
- Create a script in a user script directory, rather than modifying a bundled example.
- Make the first version report information without changing the program.
- Add cancellation checks and test against a disposable project before adding writes.
For Java scripts, verify the inherited methods against the bundled GhidraScript API documentation for your exact release. Do not assume Python environments are interchangeable: Jython, PyGhidra, and external CPython have different setup and compatibility requirements.
Make scripts reviewable
Section titled “Make scripts reviewable”Record expected input, output, and supported application version. If a script changes symbols or types, make its selection rules explicit and log each change. Keep a before/after sample to catch unintended edits.
Headless automation must avoid GUI-only prompts and tool services. Use Headless mode once the script works on a controlled sample. VERIFY API availability against the release rather than copying snippets from development-branch Javadocs.
Sources: Script Manager help, tagged GhidraScript source.
Adapted from the Ghidra documentation (Apache 2.0).