Post

PyGhidra - Configuration

Tested with Ghidra 12.0.3

Start PyGhidra

1
./ghidra_12.0.3_PUBLIC/support/pyghidraRun
  • Open or create a project
  • Open the CodeBrowser window (only if it’s not already open):
    • Clic Tools -> Run Tool -> CodeBrowser

Configuring Scripts Path

  • In CodeBrower: clic Window -> Script Manager
    • The Script Manager window pops
  • In the Script Manager window, right pane (the one listing scripts name and description):
    • Right clic -> Script Directories
    • The Bundle Manager window pops
  • In the Bundle Manager window, clic on the green ‘plus’ sign
    • Navigate to the directory of your choice and validate

Script header

A script header contains some metadata:

1
2
3
4
5
6
7
8
9
10
11
┌[~/dev/ghidra_scripts/pyghidra/v12.0.3]
└╼[silma@myrtille:$ cat helloworld.py 

#@author 
#@category _MyScripts
#@keybinding 
#@menupath 
#@toolbar 

print("Hello from PyGhidra!")

  • The #@category is the name under which the script will be found
  • Once the script is created:
    • In the Script Manager window, clic on the ‘refresh’ button
    • The new category (here _MyScripts) should appear in the left pane
    • Select the category, then the script (right pane), and Clic on the ‘Run Script’ button
  • If everything went well, the output should be visible in the ‘Console - Scripting’ window

EOF

This post is licensed under CC BY 4.0 by the author.