dqzg12300/fridaUiTools

关于RegisterNative的问题

Opened this issue · 3 comments

命令行执行 frida -U -f com.example.nativedemo -l hook_RegisterNatives.js --no-pause 没有问题

但用python脚本 Interapter.attach中就不会执行

python代码

def hook():
# spawn模式
device = frida.get_usb_device()
pid = device.spawn(["com.example.nativedemo"])
device.resume(pid)
time.sleep(1)
session = device.attach(pid)
with open("hook_RegisterNatives.js", encoding="utf8") as f:
script = session.create_script(f.read())
script.on("message", message_handler)
script.load()
input()

#RegisterNative.js中内容
if (addrRegisterNatives != null) {
Interceptor.attach(addrRegisterNatives, {
onEnter: function (args) {
console.log('-----------------')
klog("[RegisterNatives] method_count:" + args[3]);

希望大神能解决一下。谢谢。

你的py脚本是另外写的吗?还是用我的工具无法hook到RegisterNative?由于我对这个脚本进行过小修改,调整了日志输出的方式。如果你是自己直接用py调用的。建议你使用原版本的。
链接在这里:https://github.com/lasting-yang/frida_hook_libart

谢谢回复
win11 linux frida版本都换过,实验过,用python脚本进行输出,所有脚本中的intercepor.attach-onEnter就不会执行了,命令行可以
手机系统是r0env 的安卓7
我在找找其他问题。

感觉按你这样子说。应该就是python脚本写的不太对。你最好是用个简单的例子来测试。js中用console.log来输出。先不要使用send来输出。