console.log("==== retAddress ===="); console.log(retAddress); // Store callback so it doesn't get garbage collected. callbacks.push(new SyscallCallback(frida, callback)); // Return pointer to the instructions. return callbacks[callbacks.length - 1].frida; }
Java.perform(function () { console.log("Full call stack: "); var android_dlopen_ext = Module.findExportByName(null, "android_dlopen_ext"); Interceptor.attach(android_dlopen_ext, { onEnter: function (args) { this.call_hook = false; var so_name = ptr(args[0]).readCString(); if (so_name.indexOf("libnative-lib.so") >= 0) { console.log("android_dlopen_ext:", ptr(args[0]).readCString()); this.call_hook = true; }
}, onLeave: function (retval) { if (this.call_hook) { inline_hook(); } } });
});
function inline_hook() { var libnative_lib_addr = Module.findBaseAddress("libnative-lib.so"); console.log("libnative_lib_addr:", libnative_lib_addr); if (libnative_lib_addr){ var address = libnative_lib_addr.add(0x81F8); // var address = libnative_lib_addr.add(0x47D66); // 0x47FB4 0x42634 0x43B3A 0x4256E 0x42862 0x47ECC 0x44CBE 0x446BE 0x440B2 console.log(address); hookSyscall(address, new NativeCallback(function (dirfd, pathname, mode, flags) { let path = pathname.readCString(); console.log(`Called faccessat hook11`); console.log('- X0: ' + dirfd); console.log('- X1: ' + path); console.log('- X2: ' + mode); console.log('- X3: ' + flags);