My scripts for Ghidra.
Please read ${GHIDRA_HOME}/docs/GhidraClass/Intermediate/Scripting_withNotes.html
and Ghidra Script Manager section of Help.
![]() |
Source file |
---|---|
Script finds all references to the functions and data from all external programs (shared libraries), then creates additional memory blocks and transfer all info about functions (name, signature, additional info) and data (name, also create comment with value and annotation with link to external program). A source type of symbols will be IMPORTED
, a source type of parameters will be IMPORTED
, if parameters of the original function don’t have DEFAULT
source type, otherwise a source type will be DEFAULT
too.
Add needed external programs (see Figure 1):
Window → External Programs
Add External Program Name
Set External Name Association
Figure 1. Added External Programs
Run the script (choose memory blocks if needed, see Figure 2).
Figure 2. Choose needed memory blocks
Before | After |
---|---|
![]() |
![]() |
Figure 3. Before and after running the script
![]() |
You can run the script multiple times. |
---|---|
Warning:
>
script will not change user-defined symbols (you should delete user-defined symbols, if you want to import information from external symbols);
you should look symbols with Global
namespace (not external) for finding xrefs to external functions and data (see Figure 4).
>
Figure 4. Symbol with
Global
Namespace have true references
![]() |
Source file |
---|---|
The script try to find all references for local variables in Decompiler’s window like in IDA Pro or Binary Ninja.
Figure 5. XRefs to local variables
![]() |
Source file |
---|---|
Script set all labels (functions) in selection as Entry Point.
Use for clearing of the analysis results.
![]() |
Source file |
---|---|
![]() |
Source file |
---|---|
Print all symbols (and their addresses) with multiple labels. Maybe useful for Version Tracking session.
![]() |
Source file |
---|---|
![]() |
Source file |
---|---|
Find all functions with parameters, which will be dereferenced.
![]() |
Source file |
---|---|
Prints all basic blocks of the program (change the source code for printing an interesting information) with sources and destinations information (other basic blocks).
![]() |
Source file |
---|---|
The script parses PE header and print an entry point address (address of a valid function) from optional header.
![]() |
Source file |
---|---|
The script should be used in headless mode. May be useful for debugging of a decompiler and writing Sleigh code. The script can print ASM code, PCode, PCodeHigh, decompiling C code (use arguments).
Warning:
>
>
See comments in the script file.
![]() |
Source file |
---|---|
The script prints high PCode to console. May be useful for debugging of a decompiler. You should know, that the AST of high PCode and the AST of any varnode may be different in a scope of the same function.
![]() |
Source file |
---|---|
The script set default convention (see Language ID) for all functions in the selection.
Select needed functions. I recommend do it through Functions window, where you can sort and filter functions.
Run the script.
![]() |
Source file |
---|---|
The script finds all references to the field of a structure.
![]() |
Source file |
---|---|
The script rename all functions in the selection to one name.