-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGetAppid.js
43 lines (42 loc) · 1.32 KB
/
GetAppid.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
41
42
43
let findAppid = false;
const waitModule = Process.platform == 'linux' ? 'qq' : 'QQNT.dll';
const symbolGetString = "napi_get_value_string_utf8";
async function mainWin() {
let hookPtr = Module.findExportByName(waitModule, symbolGetString);
while (hookPtr == null) {
hookPtr = Module.findExportByName(waitModule, symbolGetString);
}
Interceptor.attach(hookPtr, {
onEnter(args) {
this.data = args[2];
},
onLeave(retval) {
let data = Memory.readUtf8String(this.data).substring(0, 20);
if (!findAppid && /^\d+$/.test(data) && data.startsWith("5")) {
send(data);
findAppid = true;
}
}
});
}
async function mainLinux() {
let exports = Module.enumerateExports(waitModule);
let hookPtr = exports.find(exp => exp.name == symbolGetString).address;
Interceptor.attach(hookPtr, {
onEnter(args) {
this.data = args[2];
},
onLeave(retval) {
let data = Memory.readUtf8String(this.data).substring(0, 20);
if (!findAppid && /^\d+$/.test(data) && data.startsWith("5")) {
send(data);
findAppid = true;
}
}
});
}
if (Process.platform == 'linux') {
mainLinux().then();
} else {
mainWin().then();
}