I'm running a Ghidra python script in headless mode from the commandline specifying my script as a preScript.
e.g. ./analyzeHeadless project_path project_name -preScript pre.py -import my_exec_file
I would like so set the HeadlessContinuationOption in that script.
The equivalent in a Java preScript will be:
import ghidra.app.util.headless.HeadlessScript;
public class Pre extends HeadlessScript {
@Override
public void run() throws Exception {
setHeadlessContinuationOption(HeadlessContinuationOption.ABORT);
}
}
However in the python there is no class to inherit from HeadlessScript (and setHeadlessContinuationOption
in an instance method of that abstract class). I just write the script in the global scope.
I've tried to create a class similar to how the Java script is written, but nothing instantiate it. I've also tried to instantiate it and call run
myself and call setHeadlessContinuationOption
on that instance in run
, but it doesn't have the desired effect (the abort option is being ignore and importing of the exec file continues).
Here's this code (that doesn't work)
from ghidra.app.util.headless import HeadlessScript
class Pre(HeadlessScript):
def run(self):
self.setHeadlessContinuationOption(self.HeadlessContinuationOption.ABORT)
Pre().run()
So how can I set setHeadlessContinuationOption(HeadlessContinuationOption.ABORT)
in a python preScript?
Thanks.