This repository has been archived by the owner on Apr 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
hook.py
63 lines (58 loc) · 1.47 KB
/
hook.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
58
59
60
61
62
63
import time
import frida
import json
jscode = """
Java.perform(function x() {
var nx = Java.use("nx");
nx.a.overload();
var nxab = nx.a.overload("java.lang.String");
nx.$init.overload(
"java.lang.String",
"android.content.res.Resources"
).implementation = function (x, y) {
console.log("nx init", x, y);
return this.$init(x, y);
};
nxab.implementation = function (x) {
console.log("nx.a", x);
return this.a(x);
};
nx.b.overload("java.lang.String").implementation = function (x) {
console.log("nx.b", x);
return this.b(x);
};
nx.c.overload("java.lang.String").implementation = function (x) {
console.log("nx.c", x);
return this.c(x);
};
var SecretKey = Java.use("javax.crypto.spec.SecretKeySpec");
SecretKey.$init.overload("[B", "java.lang.String").implementation = function (
x,
y
) {
send("KEY", new Uint8Array(x));
return this.$init(x, y);
};
var IV = Java.use("javax.crypto.spec.IvParameterSpec");
IV.$init.overload("[B").implementation = function (x) {
send("IV", new Uint8Array(x));
return this.$init(x);
};
});
"""
def msg(m, p):
if m["type"] == "send":
print(m["payload"], p.hex())
else:
print(m)
print('*' * 16)
print(p)
device = frida.get_usb_device()
pid = device.spawn(["wtf.riceteacatpanda.quiz"])
device.resume(pid)
time.sleep(1)
session = device.attach(pid)
script = session.create_script(jscode)
script.on("message", msg)
script.load()
input()