==Mac系统的frida版本要与Android中的版本号保持一致==。python
升级Mac系统中的frida为最新版本的命令:android
sudo pip install --upgrade frida
复制代码
或者安装指定版本的frida,这里安装frida的12.1.2版本:git
pip install frida==12.1.2
复制代码
个人root设备是Android4.4.4系统github
下载frida-server到电脑中,地址:github.com/frida/frida…chrome
选择合适的版本,我这里下载的是frida-server-12.1.2-android-arm.xzshell
下载到电脑要解压这个.xz文件,Mac系统若是不能识别这个文件,可到App Store安装一个叫"The Unarchiver"的工具。bash
解压后修改文件名为"frida-server",并复制文件到手机对应的目录下:app
adb push frida-server /data/local/tmp/
复制代码
继续在终端输入命令,为frida-server添加执行权限,并启动手机中的frida-server:python2.7
$ adb shell
shell@hammerhead:/ $ su
root@hammerhead:/ # cd /data/local/tmp/
root@hammerhead:/data/local/tmp # chmod 777 frida-server
root@hammerhead:/data/local/tmp # ./frida-server &
复制代码
手机会重启,重启以后,mac新开一个终端输入命令检查手机上的frida是否运行成功:工具
frida-ps -U
复制代码
成功则会打印手机中运行的进程:
PID Name
----- ----------------------------------------------
25851 adb
25767 adbd
31402 android.process.acore
31675 android.process.media
187 bridgemgrd
32228 com.android.defcontainer
...
...
复制代码
错误1
$ frida -U --no-pause -f com.android.chrome
____
/ _ | Frida 12.1.2 - A world-class dynamic instrumentation toolkit
| (_| |
> _ | Commands:
/_/ |_| help -> Displays the help system
. . . . object? -> Display information about 'object'
. . . . exit/quit -> Exit
. . . .
. . . . More info at http://www.frida.re/docs/home/
Failed to spawn: the connection is closed
复制代码
错误2
$frida-ps -Ua
Failed to enumerate applications: the connection is closed
复制代码
我遇到的错误1和错误2,都是由于手机的Frida版本和Mac电脑的Frida版本不一样致使的,安装相同版本的Frida就可解决。
使用frida强制启动chrome报错
$ frida -U --no-pause -f com.android.chrome
Traceback (most recent call last):
File "/Users/king/Documents/PythonProject/Tornado/test/venv/bin/frida", line 11, in <module>
sys.exit(main())
File "/Users/king/Documents/PythonProject/Tornado/test/venv/lib/python2.7/site-packages/frida_tools/repl.py", line 23, in main
from prompt_toolkit.shortcuts import create_prompt_application, create_output, create_eventloop
ImportError: cannot import name create_prompt_application
复制代码
解决:
pip install 'prompt-toolkit==1.0.15'
复制代码