Skip to content

Commit 49a2a75

Browse files
authored
Update DumpDex.js
1 parent f716db6 commit 49a2a75

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

DumpDex.js

+7-21
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,19 @@ Fork hook needed in case process spawn child process
33
which causes frida to terminate. Return -1 only when you feel need of it.
44
*/
55

6+
/*
67
const fork_ptr = Module.getExportByName(null, "fork");
78
const fork = new NativeFunction(fork_ptr, 'int', []);
89
Interceptor.replace(fork_ptr, new NativeCallback(function() {
910
console.warn("Fork Found and Replaced");
10-
//return fork()
11-
return -1;
11+
return fork()
12+
//return -1;
1213
}, "int", []));
14+
*/
1315

14-
function ProcessName() {
15-
let openPtr = Module.getExportByName('libc.so', 'open');
16-
let open = new NativeFunction(openPtr, 'int', ['pointer', 'int']);
17-
let readPtr = Module.getExportByName('libc.so', 'read');
18-
let read = new NativeFunction(readPtr, 'int', ['int', 'pointer', 'int']);
19-
let closePtr = Module.getExportByName('libc.so', 'close');
20-
let close = new NativeFunction(closePtr, 'int', ['int']);
21-
let path = Memory.allocUtf8String('/proc/self/cmdline');
22-
let fd = open(path, 0);
23-
if (fd != -1) {
24-
let buffer = Memory.alloc(0x1000);
25-
let result = read(fd, buffer, 0x1000);
26-
close(fd);
27-
result = ptr(buffer).readCString();
28-
return result;
29-
}
30-
return -1;
31-
}
16+
// Enter your package name here as getting process name on higher android version is tricky
17+
18+
let Pro = "com.app.name"
3219

3320
function ProcessDex(Buf, C,Path) {
3421
let ApkUnpacker = new Uint8Array(Buf);
@@ -62,7 +49,6 @@ function WriteDex(Count,Buffer,Path,Flag) {
6249
}
6350

6451
function Dump_Dex() {
65-
let Pro = ProcessName();
6652
let libart = Process.findModuleByName("libart.so");
6753
let addr_DefineClass = null;
6854
let symbols = libart.enumerateSymbols();

0 commit comments

Comments
 (0)