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:
// usage examples
setTimeout(function() { // avoid java.lang.ClassNotFoundException
Java.perform(function() {
// enumerate all classes
/*
var a = enumAllClasses();
a.forEach(function(s) {
console.log(s);
});
*/
// find classes that match a pattern
/*
var a = findClasses(/password/i);
a.forEach(function(s) {
console.log(s);
});
*/
// enumerate all methods in a class
/*
var a = enumMethods("com.target.app.PasswordManager")
a.forEach(function(s) {
console.log(s);
});
*/
});
}, 0);
// usage examples
if (ObjC.available) {
// enumerate all classes
/*
var a = enumAllClasses();
a.forEach(function(s) {
console.log(s);
});
*/
// find classes that match a pattern
/*
var a = findClasses(/password/i);
a.forEach(function(s) {
console.log(s);
});
*/
// enumerate all methods in a class
/*
var a = enumMethods("PasswordManager")
a.forEach(function(s) {
console.log(s);
});
*/
// enumerate all methods
/*
var d = enumAllMethods();
for (k in d) {
console.log(k);
d[k].forEach(function(s) {
console.log("\t" + s);
});
}
*/
// find methods that match a pattern
/*
var d = findMethods(/password/i);
for (k in d) {
console.log(k);
d[k].forEach(function(s) {
console.log("\t" + s);
});
}
*/
} else {
send("error: Objective-C Runtime is not available!");
}
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,
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!