var soName
=
"libmod.so"
function myfun()
{
var moduleBaseAddress
=
Module.getBaseAddress(soName);
console.log(soName
+
"_address:"
, moduleBaseAddress);
var nativePointer
=
moduleBaseAddress.add(
0x19F974
);
Interceptor.attach(nativePointer,
{
onEnter: function (args)
{
this.v1051
=
this.context.x0
var str3
=
this.context.x3.readUtf8String();
console.log(
"str3:"
+
str3);
},
onLeave: function (retval)
{
console.log(
"this.v1051:"
,this.v1051.readUtf8String());
}
}
);
}
function hook_dlopen()
{
var is_can_hook
=
false;
Interceptor.attach(Module.findExportByName(null,
"dlopen"
),
{
onEnter: function (args)
{
var pathptr
=
args[
0
];
if
(pathptr !
=
=
undefined && pathptr !
=
null)
{
var path
=
ptr(pathptr).readCString();
if
(path.indexOf(soName) >
=
0
)
{
this.is_can_hook
=
true;
}
}
},
onLeave: function (retval)
{
if
(this.is_can_hook)
{
myfun()
}
}
}
);
Interceptor.attach(Module.findExportByName(null,
"android_dlopen_ext"
),
{
onEnter: function (args)
{
var pathptr
=
args[
0
];
if
(pathptr !
=
=
undefined && pathptr !
=
null)
{
var path
=
ptr(pathptr).readCString();
if
(path.indexOf(soName) >
=
0
)
{
this.is_can_hook
=
true;
}
}
},
onLeave: function (retval)
{
if
(this.is_can_hook)
{
myfun()
}
}
}
);
}
setImmediate(hook_dlopen);