hook JNI example refactoring
This commit is contained in:
parent
fd64827ccc
commit
7494864aed
10
README.md
10
README.md
@ -70,15 +70,13 @@ Interceptor.attach(Module.findExportByName(null, "dlopen"), {
|
|||||||
console.log("dlopen called exit with: " + this.lib);
|
console.log("dlopen called exit with: " + this.lib);
|
||||||
if (this.lib.endsWith("libfoo.so")) {
|
if (this.lib.endsWith("libfoo.so")) {
|
||||||
console.log("ret: " + retval);
|
console.log("ret: " + retval);
|
||||||
var libtmessages_base = Process.findModuleByName("libfoo.so").base; // Module.findBaseAddress(‘foo.so’).add(0x1234)
|
var funcAddr = 0x0021e5b4; // find function address with $ nm -CD libfoo.so | grep "SomeClass::someFunction"
|
||||||
console.log("libtmessages_base: " + libtmessages_base);
|
var offset = Module.findBaseAddress("libfoo.so"); // Process.findModuleByName("libfoo.so").base) will also work
|
||||||
// find function address with $ nm -CD libfoo.so | grep "SomeClass::someFunction"
|
Interceptor.attach(offset.add(funcAddr), {
|
||||||
var i = Interceptor.attach(libtmessages_base.add(0x0021e5b4), {
|
|
||||||
onEnter: function(args) {
|
onEnter: function(args) {
|
||||||
console.log('initttt ');
|
console.log('hooked !');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("i: " + i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user