The Raptor scripts by 0xdea (Marco Ivaldi) are an excellent starting point for a base script. The 'trace' line of scripts provide prebuilt method hooking functions which greatly simplify the hooking process. There are both Android and iOS variants available. If you browse to the bottom of any of these scripts, you will see some commented out examples of how to use these scripts, included here for quick reference:
var a = enumMethods("com.target.app.PasswordManager")
25
a.forEach(function(s) {
26
console.log(s);
27
});
28
*/
29
​
30
});
31
}, 0);
Copied!
1
// usage examples
2
if (ObjC.available) {
3
​
4
// trace("-[CredManager setPassword:]");
5
// trace("*[CredManager *]");
6
// trace("*[* *Password:*]");
7
// trace("exports:libSystem.B.dylib!CCCrypt");
8
// trace("exports:libSystem.B.dylib!open");
9
// trace("exports:*!open*");
10
11
} else {
12
send("error: Objective-C Runtime is not available!");
13
}
Copied!
1
// usage examples
2
if (ObjC.available) {
3
​
4
// enumerate all classes
5
/*
6
var a = enumAllClasses();
7
a.forEach(function(s) {
8
console.log(s);
9
});
10
*/
11
​
12
// find classes that match a pattern
13
/*
14
var a = findClasses(/password/i);
15
a.forEach(function(s) {
16
console.log(s);
17
});
18
*/
19
​
20
// enumerate all methods in a class
21
/*
22
var a = enumMethods("PasswordManager")
23
a.forEach(function(s) {
24
console.log(s);
25
});
26
*/
27
​
28
// enumerate all methods
29
/*
30
var d = enumAllMethods();
31
for (k in d) {
32
console.log(k);
33
d[k].forEach(function(s) {
34
console.log("\t" + s);
35
});
36
}
37
*/
38
​
39
// find methods that match a pattern
40
/*
41
var d = findMethods(/password/i);
42
for (k in d) {
43
console.log(k);
44
d[k].forEach(function(s) {
45
console.log("\t" + s);
46
});
47
}
48
*/
49
​
50
} else {
51
send("error: Objective-C Runtime is not available!");
52
}
Copied!
Once one of these scripts is loaded into a REPL session, you can access thetrace methods directly from the REPL. Alternatively, you may add them directly to the raptor script. Remember, making changes to a script while it is loaded will cause Frida to reload that script.
frida-awesome
Another great resource for scripts is "frida-awesome", a repo maintained by David Weinstein at NowSecure containing a large number of links that include: talks, papers, videos, blog posts,
GitHub - dweinstein/awesome-frida: Awesome Frida - A curated list of Frida resources http://www.frida.re/ (https://github.com/frida/frida)
Activate Developer settings, (i): enable: Advanced reboot; (ii) disable update recovery with system updates. After that, select reboot mode, and the TWRP app starts.
Restart Android device "recovery mood"
Install magisk via TWRP
Open Magisk and update it if necessary
Use Root Checker or Super#SU app to check if the device is rooted!