-
-
Notifications
You must be signed in to change notification settings - Fork 111
/
StopExit.js
202 lines (199 loc) · 8.62 KB
/
StopExit.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*
Made By @ApkUnpacker
*/
var GlobalLogs = false;
Java.perform(function() {
try {
var Installer = Java.use("android.app.ApplicationPackageManager");
Installer.getInstallerPackageName.overload('java.lang.String').implementation = function(Str) {
console.log("Installer Name Fixed");
if (GlobalLogs) {
ShowLogs();
}
return "com.android.vending";
}
var Installer2 = Java.use("android.content.pm.PackageManager");
Installer2.getInstallerPackageName.overload('java.lang.String').implementation = function(Str) {
console.error("Installer Name Fixed 2");
if (GlobalLogs) {
ShowLogs();
}
return "com.android.vending";
}
var system = Java.use("java.lang.System");
system.exit.overload("int").implementation = function(var0) {
console.warn("[*] Exit Called");
if (GlobalLogs) {
ShowLogs();
}
}
Java.choose("android.app.Activity", {
onMatch: function(instance) {
instance.onDestroy.overload().implementation = function() {
console.log("[*] onDestroy() Called");
}
},
onComplete: function(retval) {}
});
var act = Java.use("android.app.Activity");
act.finish.overload().implementation = function() {
console.log("[*] Finish() Called");
if (GlobalLogs) {
ShowLogs();
}
}
var secure = Java.use("android.provider.Settings$Secure");
secure.getInt.overload("android.content.ContentResolver", "java.lang.String", "int").implementation = function(str1, str2, str3) {
if (str2.indexOf("development_settings_enabled") >= 0 || str2.indexOf("adb_enabled") >= 0) {
var fix = "fuckyou";
console.log("Developer Mode & ADB Checked ");
return this.getInt.call(this, str1, fix, str3);
} else return this.getInt.call(this, str1, str2, str3);
}
var act = Java.use("android.os.Process");
act.myPid.overload().implementation = function() {
console.log("[*] Mypid() = ", this.myPid());
return this.myPid();
}
var Debugger = Java.use("android.os.Debug");
Debugger.isDebuggerConnected.overload().implementation = function() {
console.log("[*] isDebuggerConnected() Called");
return false;
}
var ss = Java.use("android.app.Service");
ss.stopSelf.overload().implementation = function() {
console.log("[*] stopSelf() called ");
}
var Verify = Java.use("java.security.Signature");
Verify.verify.overload("[B").implementation = function() {
console.warn("[*] Core Verify() called ");
return true;
}
var MD = Java.use("java.security.MessageDigest");
MD.isEqual.overload("[B", "[B").implementation = function() {
console.log("[*] MD isEqual() called ");
return true;
}
var Pm = Java.use("android.content.pm.PackageManager");
Pm.getPackageInfo.overload("java.lang.String", "int").implementation = function(pkg, flag) {
console.warn("getPackageInfo() with package", pkg, " and flag ", flag);
return this.getPackageInfo.overload("java.lang.String", "int").call(this, pkg, flag);
}
var act = Java.use("android.app.Activity");
act.finishActivity.overload('int').implementation = function(arg) {
console.log("FinishActivity():-->>" + arg);
console.log("[*] FinishActivity() Called");
}
var Proc = Java.use("android.os.Process");
Proc.killProcess.overload('int').implementation = function(arg) {
console.log("KillProcess():-->>" + arg);
console.log("[*] KillProcess() Called");
if (GlobalLogs) {
ShowLogs();
}
}
var AR = Java.use("android.app.Activity");
AR.onActivityResult.overload('int', 'int', 'android.content.Intent').implementation = function(a, b, c) {
console.log("onActivityResult():-->>" + a + " " + b + " " + c);
console.log("[*] onActivityResult() Called");
}
var FinishAffinity = Java.use("android.app.Activity");
FinishAffinity.finishAffinity.overload().implementation = function() {
console.log("[*] finishAffinity() Called");
}
var FinishAndRemoveTask = Java.use("android.app.Activity");
FinishAndRemoveTask.finishAndRemoveTask.overload().implementation = function() {
console.log("[*] FinishAndRemoveTask() Called");
}
var StartActivity = Java.use("android.app.Activity");
StartActivity.startActivity.overload("android.content.Intent").implementation = function(intent) {
console.warn("[*] startActivity() Called with " + intent);
if (GlobalLogs) {
ShowLogs();
}
return this.startActivity(intent);
}
var ifinish = Java.use("android.app.Activity");
ifinish.isFinishing.overload().implementation = function() {
var ret = this.isFinishing();
console.log("[*] isFinishing() Called");
return this.isFinishing();
}
function ShowLogs() {
Java.perform(function() {
var jAndroidLog = Java.use("android.util.Log"),
jException = Java.use("java.lang.Exception");
console.warn("##########\n", jAndroidLog.getStackTraceString(jException.$new()), "##########\n");
});
}
} catch (e) {
console.error(e);
}
})
Interceptor.attach(Module.findExportByName(null, "exit"), {
onEnter: function(args) {
console.warn("Native Exit() Called :-->:\n" + Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join("\n") + "\n");
},
onLeave: function(retval) {}
});
Interceptor.attach(Module.findExportByName(null, "abort"), {
onEnter: function(args) {
console.warn("Native Abort() Called :-->:\n" + Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join("\n") + "\n");
},
onLeave: function(retval) {}
});
var fork = Module.findExportByName(null, "fork")
Interceptor.attach(fork, {
onEnter: function(args) {},
onLeave: function(retval) {
var pid = parseInt(retval.toString(16), 16)
console.log("Second Process PID : ", pid)
}
})
Interceptor.attach(Module.findExportByName("libc.so", "system"), {
onEnter: function(args) {
var cmd = Memory.readCString(args[0]);
if (cmd.indexOf("kill") != -1) {
console.log("Bypass native system: " + cmd);
var NewKill = args[0].writeUtf8String("fuckyousystem");
args[0] = ptr(NewKill);
}
},
onLeave: function(retval) {}
});
var abortPtr = Module.getExportByName('libc.so', 'abort');
var abort = new NativeFunction(abortPtr, 'int', ['int']);
var exitPtr = Module.getExportByName('libc.so', 'exit');
var exit = new NativeFunction(exitPtr, 'int', ['int']);
var _exitPtr = Module.getExportByName('libc.so', '_exit');
var _exit = new NativeFunction(_exitPtr, 'int', ['int']);
var killPtr = Module.getExportByName('libc.so', 'kill');
var kill = new NativeFunction(killPtr, 'int', ['int', 'int']);
var raisePtr = Module.getExportByName('libc.so', 'raise');
var raise = new NativeFunction(raisePtr, 'int', ['int']);
var shutdownPtr = Module.getExportByName('libc.so', 'shutdown');
var shutdown = new NativeFunction(shutdownPtr, 'int', ['int', 'int']);
Interceptor.replace(abortPtr, new NativeCallback(function(status) {
console.log('Abort Replaced');
return 0;
}, 'int', ['int']));
Interceptor.replace(exitPtr, new NativeCallback(function(status) {
console.log('Exit Replaced');
return 0;
}, 'int', ['int']));
Interceptor.replace(_exitPtr, new NativeCallback(function(status) {
console.log('_exit Replaced');
return 0;
}, 'int', ['int']));
Interceptor.replace(killPtr, new NativeCallback(function(pid, sig) {
console.log('Kill Replaced');
return 0;
}, 'int', ['int', 'int']));
Interceptor.replace(raisePtr, new NativeCallback(function(sig) {
console.log('Raise Replaced');
return 0;
}, 'int', ['int']));
Interceptor.replace(shutdownPtr, new NativeCallback(function(fd, how) {
console.log('Shutdown Replaced');
return 0;
}, 'int', ['int', 'int']));