Frida spawn进程在Android上失败

时间:2016-04-17 17:57:31

标签: android frida

运行命令" frida-trace -U -i open -f com.example.hellojni" ,应用程序HelloJni将正常设置。但在我执行了同行的python脚本之后,我遇到了崩溃。

device = frida.get_device_manager().enumerate_devices()[-1]
session = device.attach(device.spawn(["com.example.hellojni"]))   
ss = '''
       console.log("hello")
'''    
script = session.create_script(ss)
script.load()
session.detach()

日志"你好"在控制台中显示。但该应用程序刚刚崩溃,即使用户界面也没有显示出来。 logcat打印出类似这样的东西:

04-17 06:14:58.279: E/WindowManager(570): Starting window AppWindowToken{41e429c0 token=Token{41f753c8 ActivityRecord{41ea5dc0 u0 com.example.hellojni/.view.MainActivity t39}}} timed out
04-17 06:14:58.279: W/ActivityManager(570): Process ProcessRecord{41dffd18 16943:com.example.hellojni/u0a203} failed to attach
04-17 06:14:58.289: I/ActivityManager(570): Killing 16943:com.example.hellojni/u0a203 (adj -100): start timeout

我的剧本错了吗?我使用android4.4.4(dalvik模式),windows7,frida7.0.11 .. 任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:5)

该工具非常出色,但是他们非常需要更新他们的文档。花了将近一个星期的时间来深入研究源代码,试图解决同样的问题,但却发现根本没有问题。只是我们需要在设置完所有内容后调用device.resume()。在你的情况下:

device = frida.get_device_manager().enumerate_devices()[-1]
pid = device.spawn(["com.example.hellojni"])
session = device.attach(pid)
ss = '''
       console.log("hello")
'''    
script = session.create_script(ss)
script.load()
device.resume(pid)
session.detach()