forked from WangChongwen-me/Android-Protection-Bypass-Stuff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforce-exit.js
More file actions
44 lines (35 loc) · 965 Bytes
/
force-exit.js
File metadata and controls
44 lines (35 loc) · 965 Bytes
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
// Linux
function findLibc() {
const modules = Process.enumerateModulesSync();
for (const module of modules) {
if (module.name.toLowerCase().indexOf('libc') !== -1) {
return module;
}
}
return null;
}
const libc = findLibc();
if (!libc) {
console.error('libc not found in the process.');
return;
}
const exit = new NativeFunction(libc.findExportByName('exit'), 'void', ['int']);
exit(0);
// Windows
function findKernel32() {
const modules = Process.enumerateModulesSync();
for (const module of modules) {
if (module.name.toLowerCase() === 'kernel32.dll') {
return module;
}
}
return null;
}
const kernel32 = findKernel32();
if (!kernel32) {
console.error('kernel32.dll not found in the process.');
return;
}
const ExitProcess = new NativeFunction(kernel32.findExportByName('ExitProcess'), 'void', ['uint32']);
// Call ExitProcess function with an exit code of 0
ExitProcess(0);