TransWikia.com

Getting the object name through the Ghidra Script

Reverse Engineering Asked on January 12, 2021

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.

One Answer

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.

Answered by hairlessbear on January 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP