I have a script written to work with Ghidra. I am doing some analysis in the script and save the results in a file. Right now, I am passing the name when a prompt ask the file name to save upon running the script. Though this is ok for one, I need to run this script in more than 100 objects at once(using the headless analyzer) and I want the file name to automatically taken from the object name. How could I do this?

For example, let's say I have an object file called mqtt.o. I need to take this name (mqtt) while saving the file which contains the results. I looked through the API, but still could not find a way to get the name of the object of analysis. Any help is appreciated. Thanks.

1 Answer 1


If I understand your question correctly, it sounds like you want to use the name of the file you're analyzing to determine the name of the file your script outputs. If so, getProgramFile() is probably the easiest way to grab it.

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.