Basically, Ghidra in headless mode is divided into three phases: preScript, analysis, and postScript.

Pre/post scripts are written extending the GhidraScript class, while analysis ones extend the AbstractAnalyzer class.

When you run Ghidra in headless mode, you can specify which pre/post scripts you want to run (-preScript and -postScript options).

My questions is: how do I choose which analyses to perform?

For example, if I run this command:

./analyzeHeadless /tmp test -import ~/Downloads/test.elf -scriptPath ~/ghidra_scripts/ -postScript TestScript.java

INFO  -----------------------------------------------------
    ARM Constant Reference Analyzer           14.667 secs
    Subroutine References - One Time           0.000 secs
     Total Time   86 secs

How can I exclude the ARM Constant Reference Analyzer and add another analysis?

1 Answer 1


This is possible. You can select desired analysis options in the prescript. Checkout this function - setAnalysisOption in GhidraScript class. You can also look @ this example script.

So, in your case you can do something like:

from ghidra.app.script import GhidraScript
setAnalysisOption(currentProgram, "ARM Constant Reference Analyzer", "false")
  • It works! Thanks. For the readers: if you want to enable some analysis that ends with the (Prototype) string, e.g., Aggressive Instruction Finder (Prototype), just use Aggressive Instruction Finder. Commented Feb 24, 2021 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.