-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathoverwrite.js
39 lines (37 loc) · 1.49 KB
/
overwrite.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
if (ObjC.available)
{
try
{
var className = "PARSPedometerInfo";
var funcName = "- integratedSteps";
var hook = eval('ObjC.classes.' + className + '["' + funcName + '"]');
Interceptor.attach(hook.implementation, {
onEnter: function(args) {
console.log("Original args0-> (type:"+typeof args[0]+",value:"+args[0]+")");
newargs0=ptr('xxx')
args[0]=newargs0
console.log("New args0-> (type:"+typeof args[0]+",value:"+args[0]+")");
},
onLeave: function(retval) {
//注意:retval永远是一个对象,如果函数返回值是字符串类型,为了更好理解则要这样写
//string_value=ObjC.classes.NSString.stringWithString_(retval)
//console.log("Original return value-> (type:"+typeof string_value+",value:"+string_value+")");
//newretval=ObjC.classes.NSString.stringWithString_("xxxx")
//retval.replace(newretval)
//console.log("New return value-> (type:"+typeof newretval+",value:"+newretval+")");
console.log("Origin return value-> (type:"+typeof retval",value:"+retval+")");
newretval=ptr("xxxx")
retval.replace(newretval)
console.log("New return value-> (type:"+typeof newretval",value:"+newretval+")");
}
});
}
catch(err)
{
console.log("[!] Exception2: " + err.message);
}
}
else
{
console.log("Objective-C Runtime is not available!");
}