frida hook

环境搭建

安装模块

  • 安装frida模块和frida-tools模块
1
2
python -m pip install frida
python -m pip install frida-tools

image-20220913151243755

安装adb

https://developer.android.com/studio/releases/platform-tools

image-20220913153116467

添加adb至path环境变量中,cmd窗口输入 adb 检查是否成功

image-20220913153424302

模拟器配置

这里用的是夜神模拟器,选择 关于平板电脑,连续点击 版本号 进入开发者模式

image-20220913154216349

开发者选项开启USB调试

image-20220913154631846

找到 Nox\bin\BignoxVMS\nox 目录下的 nox.vbox 文件

image-20220913162256105

搜索 guestport="5555",找到所在行的hostiphostport,就是 adb 连接需要的 ip 和 port

image-20220913154028205

adb连接

1
2
adb connect 127.0.0.1:62001
adb devices

但此时连接大部分会出现以下报错

image-20220913160401987

原因是两者adb版本不匹配所导致

image-20220913160805218

更换nox_adb.exe与adb.exe一致,重启模拟器后成功连接

image-20220913162107480

查看CPU架构版本

1
getprop ro.product.cpu.abi 

image-20220913163710351

安装frida

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

选择对应版本的frida-sever端进行下载

image-20220913163919801

把frida上传至模拟器里,并加权限

1
2
3
4
5
adb push F:\android\frida\frida-server /data/local/tmp
cd /data/local/tmp
chmod +x frida-server
./frida-server
frida-ps -U

image-20220913165202555

新开一个命令行输入命令 frida-ps -U 列出手机进程,如果出现以下结果则表示安装成功

image-20220913165419692

每次运行前

1
2
adb shell "cd /data/local/tmp&&ls&&./frida-server"
adb forward tcp:27042 tcp:27042