The script class
To develop a Ghidra script, you need to click on the Create New Script option available on the Script Manager menu. Then, you will be able to decide which programming language to use:
Figure 2.8 – The programming language dialog during new script creation
If you decide to use Java, the skeleton of the script will be composed of three parts. The first part is the comments:
//TODO write a description for this script //@author //@category Strings //@keybinding //@menupath //@toolbar
Some comments are obvious, but some of them deserve mention. For instance, @menupath
allows you to specify where to put the script in the menu when it is enabled:
Figure 2.9 – Enabling a script to be integrated with Ghidra
Notice that the path must be split by a .
character:
//@menupath Tools.Packt.Learn Ghidra script
The previous source code comment produces the following script integration with Ghidra's...