function
print_arg(){
var
libtprtaddr = Module.findBaseAddress(
"libtprt.so"
);
var
libil2cppaddr = Module.findBaseAddress(
"libil2cpp.so"
);
console.log(
"\n"
);
console.log(
"libtprt基址:"
,libtprtaddr);
console.log(
"libil2cpp基址:"
,libil2cppaddr);
var
function_addr = libtprtaddr.add(0x1BCA50);
var
hooked =
false
;
Interceptor.attach(function_addr,{
onEnter:
function
(args) {
this
.len = parseInt(
this
.context.x1);
},
onLeave:
function
(returnValue) {
if
(!hooked){
hooked =
true
;
var
currentApplication = Java.use(
"android.app.ActivityThread"
).currentApplication();
var
dir = currentApplication.getApplicationContext().getFilesDir().getPath();
var
file_path = dir +
"/global-metadata.dat"
;
var
file_handle =
new
File(file_path,
"wb"
);
if
(file_handle && file_handle !=
null
) {
var
buffer = ptr(
this
.context.x0).readByteArray(
this
.len);
file_handle.write(buffer);
file_handle.flush();
file_handle.close();
console.log(
"[dump]:"
, file_path);
}
}
}
})
}
var
isCalled =
false
;
function
hookdlopen() {
var
dlopen = Module.findExportByName(
null
,
"dlopen"
);
Interceptor.attach(dlopen, {
onEnter:
function
(args) {
var
path = args[0].readCString();
if
(path && path.indexOf(
'libil2cpp.so'
) !== -1) {
this
.path = path;
}
},
onLeave:
function
(retval) {
if
(
this
.path &&
this
.path.indexOf(
'libil2cpp.so'
) !== -1 && !isCalled) {
print_arg();
isCalled =
true
;
}
}
});
}
hookdlopen();