-
Notifications
You must be signed in to change notification settings - Fork 57
/
hook_android_log.js
39 lines (35 loc) · 1.21 KB
/
hook_android_log.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function hookLog() {
if (Java.available) {
Java.perform(function () {
var Log = Java.use("android.util.Log");
if (Log != undefined) {
Log.e.overload("java.lang.String", "java.lang.String").implementation = function (tag, msg) {
console.log(Log + ".e tag is " + tag + " msg is " + msg);
return this.e("Frida", msg);
}
} else {
console.log("class " + Log + "not found!");
}
})
}
var logPrintPoint = undefined;
var exports = Module.enumerateExportsSync("liblog.so");
for (var i = 0; i < exports.length; i++) {
if (exports[i].name == "__android_log_print") {
logPrintPoint = exports[i].address;
break;
}
}
Interceptor.attach(logPrintPoint, {
onEnter: function (args) {
// console.log("catch...");
var buf = Memory.allocUtf8String("Frida");
var tag = ptr("6");
this.buf = buf;
args[0] = tag;
args[1] = this.buf;
// console.log("replace finish!!!");
}
});
}
setTimeout(hookLog, 0);