frida的脚本库:https://github.com/iddoeldor/frida-snippets?tab=readme-ov-file#change-location
我用的是公司的试验机,没有条件的小伙伴最后弄一台可以root的设备。
首先,在Windows上安装Frida客户端。你可以通过pip命令来安装Frida和Frida-Tools。打开命令提示符(cmd),然后输入以下命令:
pip install frida
pip install frida-tools
frida --version
在安装了客户端之后,你需要在你的Android设备上安装Frida服务端。
首先,你需要查看你的Android设备的CPU架构,以便根据需要下载和安装相应的Frida服务器版本。
你可以通过连接设备到电脑并运行以下命令来查看CPU架构:
adb shell getprop ro.product.cpu.abi
根据你得到的CPU架构信息,你可以去Frida的GitHub页面
(https://github.com/frida/frida/releases)下载相应的Frida服务器版本,并推送到你的设备上。
然后,你需要修改服务器的权限,以便它可以在没有root权限的情况下运行:
adb shell su -c “chmod 777 /data/local/tmp/frida-server”
把下载的frida-server push到车机里的 data/local/tmp目录下
我是进入adb shell 下面。进入了firda的安装目录,然后 “ ./frida-server-16.1.11-android & ” 就运行起来了
Frida服务器运行成功后,可以在电脑上新开一个shell,运行 frida-ps -U命令,即可显示手机中正在运行的进程。
.\nox_adb.exe forward tcp:27043 tcp:27043
.\nox_adb.exe forward tcp:27042 tcp:27042
用frida修改一个静态变量
import frida, sys
def on_message(message, data):
if message['type'] == 'send':
print("[*] {0}".format(message['payload']))
else:
print(message)
jscode = """
Java.perform(() => {
var activityThread = Java.use('android.app.ActivityThread');
activityThread.DEBUG_CONFIGURATION.value = true;
})
"""
process = frida.get_usb_device().attach('com.test.app.myapp')
script = process.create_script(jscode)
script.on('message', on_message)
print('[*] Running CTF')
script.load()
sys.stdin.read()