renef_hook_java
Installs Java/ART method hooks on Android to intercept calls, skip original methods, and override return values for runtime analysis or SSL pinning checks.
Instructions
Install a Java/ART method hook (Android 12+ safe JNI twin engine; fallback on older Android).
Java hook argument layout in Lua callbacks:
Instance methods:
args[0]= ArtMethod* (internal),args[1]=this,args[2]= arg1, ...Static methods:
args[0]= ArtMethod*,args[1]= arg1, ...skip_original=Truesetsargs.skip = truein onEnter (CRITICAL for bypassing void methods like SSL pinning checks without triggering exceptions).return_valueoverrides the return value in onLeave: e.g."false","true","0","42", or'JNI.string("HOOKED")'.When
signatureis omitted, discovers all declared overloads ofmethod_namevia Java reflection and installs the hook on each overload.Java hooks appear in
renef_hooks_list()as[j0],[j1], ... and can be removed withrenef_unhook("j0")orrenef_unhook("all").
Args:
class_name: Class name (dots or slashes accepted, normalized to "com/example/Main")
method_name: Java method name (e.g., "isRooted", "checkServerTrusted")
signature: Optional JNI signature (e.g., "()Z", "(Ljava/lang/String;)Ljava/lang/String;").
Leave empty to discover and hook all declared overloads via reflection.
on_enter: Optional Lua body for onEnter (args in scope)
on_leave: Optional Lua body for onLeave (retval in scope)
skip_original: If True, sets args.skip = true in onEnter to skip calling the original method
return_value: Optional Lua expression returned from onLeave (e.g., "false", 'JNI.string("ok")')
Returns: JSON status confirming installation
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": {
"class_name": "<class_name>",
"method_name": "<method_name>"
},
"name": "renef_hook_java"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| on_enter | No | ||
| on_leave | No | ||
| signature | No | ||
| class_name | Yes | ||
| method_name | Yes | ||
| return_value | No | ||
| skip_original | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |