renef_hook_native
Installs a native hook at a library offset to run Lua callbacks on entry and exit, letting you inspect arguments and return values in Android processes.
Instructions
Install a native hook at offset (from library base) in lib, e.g. renef_hook_native("libc.so", "0x1234", on_enter="print('fopen path:', Memory.readString(args[0]))"). Callbacks are Lua statement strings using args[0..7] (onEnter) / retval (onLeave). Find offsets with renef_module_exports first. caller selects the upstream PLT/GOT backend (e.g. caller="libtarget.so"); omit it for a trampoline hook. There is no separate hook_type: upstream ignores the old --hook= argument and auto-selects from caller. WARNING: do not hook ultra-hot functions like clock_gettime/read/write - the agent's own output path may call them, causing recursive hooks that crash the target.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"lib": "<lib>",
"offset": "<offset>"
},
"name": "renef_hook_native"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lib | Yes | ||
| caller | No | ||
| offset | Yes | ||
| on_enter | No | ||
| on_leave | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |