-
Notifications
You must be signed in to change notification settings - Fork 32
/
xamarin-multiple-jailbreak-bypass.js
69 lines (63 loc) · 2.05 KB
/
xamarin-multiple-jailbreak-bypass.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
Description: Xamarin Multiple Jailbreak Detection ByPass
Usage: frida -U -f XXX -l xamarin-multiple-jailbreak-bypass.js
Credit: Unknown
*/
Interceptor.attach(Module.findExportByName(null, 'stat'),
{
onEnter: function(args)
{
if (Java.available)
{
var Log = Java.use("android.util.Log");
var Exception = Java.use("java.lang.Exception");
var paths = new Array(
"/system/app/Superuser.apk",
"/sbin/su",
"/system/bin/su",
"/system/xbin/su",
"/data/local/xbin/su",
"/data/local/bin/su",
"/system/sd/xbin/su",
"/system/bin/failsafe/su",
"/data/local/su",
"/su/bin/su"
);
var fpath_ptr = args[0]
this.patch = false;
if (fpath_ptr != null)
{
//this.path = Memory.readUtf8String(mod_ref);
this.path = Memory.readCString(fpath_ptr);
if (isInArray(this.path, paths))
{
console.log("Check for", this.path, "detected, tampering...");
this.patch = true;
//var e = Exception.$new();
//console.log(Log.getStackTraceString(e));
}
//this.path = mod_ref;
}
else //null arg
console.log("ERR: empty stat argument");
}
},
onLeave: function(retval)
{
if (Java.available)
{
if (this.patch)
{
console.log("Should be patched...", retval);
retval.replace(0xffffffff);
console.log("My patched...", retval);
}
//if(!retval.isNull() && this.path.indexOf("libmonosgen-2.0.so")!== -1 && !didHookApis) {
// didHookApis = true;
// console.log("File loaded hooking");
// hook_xamarin();
//
//}
}
}
});