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
| let so = Process.findModuleByName("libil2cpp.so") while (so == null) so = Process.findModuleByName("libil2cpp.so")
let i = 1; Interceptor.attach(so.base.add(0x66BBD0),{ onEnter:function (args) { let filePath = "/data/data/com.Dev.HybridCLRTrial/dump_"+i+".dll" if(access(filePath) == 0 ){ var data = read(filePath); args[1] = data.data; args[2] = new NativePointer(ptr(data.size)); console.log("load "+filePath) }else { const dumpfile = new File(filePath, "wb"); let size = args[2] dumpfile.write( args[1].readByteArray(size.toInt32())) console.log("dump "+filePath) }
i++ } })
function access(filePath){ var ptr_access = Module.findExportByName("libc.so","access"); var func_access = new NativeFunction(ptr_access,'int',['pointer','int']); var ptr_filepath = Memory.allocUtf8String(filePath); var ret = func_access(ptr_filepath,0); return ret; }
function mkdir(Path){ var ptr_mkdir = Module.findExportByName("libc.so","mkdir"); var func_mkdir = new NativeFunction(ptr_mkdir,'int',['pointer','int']); var ptr_filepath = Memory.allocUtf8String(Path); var ret = func_mkdir(ptr_filepath,777); return ret; }
function folder_mkdirs(p){ var p_list = p.split("/"); var pp = "/sdcard/fridadump/lua"; for(var i = 0;i< p_list.length ;i++){ pp = pp + "/" + p_list[i]; if(access(pp) != 0){ var x = mkdir(pp) send("mkdir :"+pp+"ret :" +x); } }
}
function read(filePath){ var ptr_open = Module.findExportByName("libc.so","open"); const open = new NativeFunction(ptr_open,'int',['pointer','int']);
var ptr_read = Module.findExportByName("libc.so","read"); const read = new NativeFunction(ptr_read,'int',['int','pointer','int']);
var ptr_close = Module.findExportByName("libc.so","close"); const close = new NativeFunction(ptr_close,'int',['int']);
var fd = open(Memory.allocUtf8String(filePath),0); var size = get_file_size(fd); if(size >0){ var data = Memory.alloc(size + 5); if( read(fd,data,size) <0){ console.log('[+] Unable to read DLL [!]'); close(fd); return 0; } close(fd); return {data:data,size:size}; }
}
function get_file_size(fd){ var statBuff = Memory.alloc(500); var fstatSymbol = Module.findExportByName('libc.so', 'fstat'); var fstat = new NativeFunction(fstatSymbol, 'int', ['int', 'pointer']); if(fd > 0) { var ret = fstat(fd, statBuff); if(ret < 0) { console.log('[+] fstat --> failed [!]'); } } var size = Memory.readS32(statBuff.add(0x30)); if(size > 0) { return size; } else { return 0; } }
|