Ghidra plugin (in Python/Jython) that automates creating C/C++ hooking code for a selected function:
- Extracts function details (name, address, return type, parameters, calling convention, etc.) from Ghidra,
- Generates ready-to-compile hooking projects for:
- Windows (using MinHook),
- Linux (inline patch with a trampoline).
- Automatic function signature extraction (using Ghidra API + decompiler).
- Choice between MinHook or inline patch hooking.
- Generates minimal C/C++ code and a CMakeLists.txt.
- Copy
ghidra_hook_generator/
into your Ghidra scripts directory (e.g.,~/ghidra_scripts/
). - In Ghidra, open Script Manager and run
GhidraHookPlugin.py
.
- Open a binary in Ghidra and let it analyze.
- Select (or specify) the function to hook.
- Run
GhidraHookPlugin.py
from the Script Manager. - Pick the hooking method and choose an output directory.
- Build the generated project with CMake.
Use responsibly—happy reverse engineering!