[Mobi] frida Hook 略知一二: frida-CLI, frida-server

Frida 是一款基于 python + javascript 的 hook 框架,主流平台都支持,由于是基于脚本的交互,因此相比 xposed 和 substrace cydia 更加便捷。

使用时,电脑上需要安装有:adb, python, frida, frida-tool.

PC 上使用的工具一般是 frida CLI,是 firda 的其中一款工具。

$ pip install frida && pip install frida-tools

[Mobi] frida Hook 略知一二: frida-CLI, frida-server

 

Android 设备安装 frida-server 即服务端,手机要求已 root,需要下载适应手机 CPU 的版本。

可用 adb 命令查看手机CPU型号。MacOS 安装设置 ADB (Android Dedug Bridge)

$ adb shell getprop ro.product.cpu.abi

将下载好的 frida-server 使用 adb push 命令从PC端传输到手机端。

https://github.com/frida/frida/releases

$ adb push /path/to/frida-server /data/local/tmp/

$ adb shell

$ cd /data/local/tmp/frida-server

$ chmod +x frida-server

$ ./frida-server &

frida 工具使用:

$ frida -U com.android.chrome        # 连接frida, 并注入到设备上的chrome应用的进程上(Attach模式)

$ frida -U -f com.android.chrome    # Spawn 模式

$ frida -U com.android.chrome -l test.js   # 连接frida, 并将 test.js 注入到设备上的chrome应用的进程上(Attach模式, 推荐)

$ frida-ps -U                # 连接 frida 到一个USB设备上,同时列出该设备上运行中的进程

$ frida-ps -Ua               # 列出运行中的进程

$ frida-ps -Uai              # 列出安装的程序

$ frida-ps -D 0454xxxxx          # 连接到一个指定的设备

Hook模块编写。

Ref:https://github.com/frida/frida

Link:https://www.cnblogs.com/farwish/p/15483847.html

原文地址:https://www.cnblogs.com/farwish/p/15483847.html