My personal collection of Ghidra scripts, mostly written in Python (also known as Jython, as referred to by Ghidra).
The scripts are free to use and are licensed under the GNU General Public License (GPL) v3.0, unless otherwise stated within the individual script.
Add these scripts to your Ghidra scripts directory:
- Open any file in Ghidra for analysis
- Select the Window / Script Manager menu
- Click the "Script Directories" icon in the upper right toolbar
- Add the directory where your scripts are located via the green plus sign
- All scripts will show up under the
R0rt1z2folder
This script helps you analyze MediaTek's bootloader images (LK).
Given a valid Ghidra project with the correct load address, it will automatically attempt to locate and rename the most basic and/or used functions, such as printf, video_printf, fastboot_register, start_apps, platform_init, and others.
Load the bootloader image in Ghidra:
- Open Ghidra and create a new project if you don't already have one.
- Extract the actual
lkcode from your LK image:python3 -m lkpatcher lk.bin -d lk - Import the generated partition image (e.g.,
lk.part) into your Ghidra project. - Set the correct load address (e.g.,
0xFFFF000050F00000) and select the processor asARM:LE:64:v8. - Run Ghidra's auto-analysis, but make sure to disable the
Non-Returning Functions - Discoveredoption. - After the analysis completes, run the script by selecting it in the Script Manager and clicking the Run Script button.
Warning
This script currently supports only ARMv8 bootloader images. A version for ARMv7 may be released in the future.