-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHookWeChat.py
57 lines (48 loc) · 1.36 KB
/
HookWeChat.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import frida
import sys
session = frida.get_usb_device().attach(88906)
script_string = """
if (ObjC.available)
{
try
{
var className = "WCDeviceStepObject";
var funcName = "- m7StepCount";
var hook = eval('ObjC.classes.' + className + '["' + funcName + '"]');
console.log("[*] Class Name: " + className);
console.log("[*] Method Name: " + funcName);
Interceptor.attach(hook.implementation, {
onEnter: function(args) {
var arg0 = new ObjC.Object(args[0]);
console.log("arg0:"+ arg0.toString());
},
onLeave: function(retval) {
var retvalue = new ObjC.Object(retval);
console.log("retval:"+ retvalue.toString());
newretval=ptr("0x5000");
retval.replace(newretval);
console.log("newretval:"+ retval);
}
});
}
catch(err)
{
console.log("[!] Exception2: " + err.message);
}
}
else
{
console.log("Objective-C Runtime is not available!");
}
"""
script = session.create_script(script_string)
def on_message(message, data):
if message['type'] == 'error':
print("[!] " + message['stack'])
elif message['type'] == 'send':
print("[i] " + message['payload'])
else:
print(message)
script.on('message', on_message)
script.load()
sys.stdin.read()