-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhook_aaa.js
40 lines (34 loc) · 1.03 KB
/
hook_aaa.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
40
function GetStackTraceString(lr, tab) {
var module;
var str;
var tabstr = "";
if (tab == undefined) {
tab = 1;
}
for (var i = 0; i != tab; i++) {
tabstr += " ";
}
var moduleName = "unknown";
var moduleBase = 0;
module = Process.findModuleByAddress(lr);
if (module) {
moduleName = module.name;
moduleBase = parseInt(module.base);
}
lr = parseInt(lr);
var off = (lr - moduleBase).toString(16).toUpperCase();
str = "lr: { module: " + moduleName + ", address: 0x" + lr.toString(16).toUpperCase() + ", offset: 0x" + off + " }";
return tabstr + str;
}
var libDiagBase = Module.findBaseAddress("libDiag.so");
Interceptor.attach(libDiagBase.add(0x196F49), {
onEnter: function(args) {
this.log = " arg: 0x" + parseInt(args[1]).toString(16) + "\n";
this.log = " arg: 0x" + parseInt(args[2]).toString(16) + "\n";
this.log += " trace " + GetStackTraceString(this.context.lr, 0) + "\n";
},
onLeave: function(retval) {
this.log += " ret: "+ retval;
console.log(this.log);
}
});