firda安裝和使用

frida是一個輕量級別的hook框架。
frida由兩部分組成:一部分是運行在系統上的交互工具frida CLI,另一部分是運行在目標機器上的代碼注入工具frida-server。
推薦使用python3來安裝frida。
官方文檔://frida.re/docs/home/
 
firda安裝:
 
windows上安裝frida
使用pip3安裝
pip3 install frida-tools
# 或使用國內源
pip3 install frida-tools -i //pypi.tuna.tsinghua.edu.cn/simple/
 
安裝過程遇到Running setup.py bdist_wheel for frida …\ 會卡住,靜候一陣子會好的。。。
 
windows的frida目前只支持python2.7和python3.7
 
也可以從Frida的GitHub 版本頁面中獲取其他二進制文件。
 
linux上安裝firda
pip3 install frida-tools
# 或使用國內源
pip3 install frida-tools -i //pypi.tuna.tsinghua.edu.cn/simple/
 
順利安裝上後,就可以使用以下命令:
frida
frida-kill
frida-ps
frida-discover
frida-ls-devices
frida-trace
 
frida-server
注意一點:frida-server版本要和frida版本一致。
 
源碼編譯安裝
git clone git://github.com/frida/frida.git
cd frida
make
 
測試是否安裝成功
1.開一個notepad.exe
2.輸入如下測試代碼
import frida
 
def on_message(message, data):
print(“[on_message] message:”, message, “data:”, data)
 
session = frida.attach(“notepad.exe”)
 
script = session.create_script(“””
rpc.exports.enumerateModules = function () {
return Process.enumerateModules();
};
“””)
script.on(“message”, on_message)
script.load()
 
print([m[“name”] for m in script.exports.enumerate_modules()])
 
測試成功:
 
查看 frida 版本號
frida –version 12.9.7
 
frida 共有6個工具:
frida
frida-kill
frida-ps
frida-discover
frida-ls-devices
frida-trace
 
服務端配置
//github.com/frida/frida/releases下載對應平台的服務端
然後解壓,移動到Android設備
adb devices
 
adb push frida-server-12.9.7-android-arm /data/local/tmp/
adb shell
cd /data/local/tmp/
chmod 777 frida-server-12.9.7-android-arm
 
然後啟動運行,轉發端口
./frida-server-12.9.7-android-arm
adb forward tcp:27042 tcp:27042
這個時候就設置好了
 
基礎運行
  • 查看連接到的設備
frida-ls-devices
  • 查看設備上的進程信息
frida-ps -U
 
PS
如果出現「frida.ServerNotRunningError: unable to connect to remote frida-server」的錯誤,試試之前的端口轉發adb forward tcp:27042 tcp:27042
 
frida常用命令
frida-ps -U 查看usb設備進程列表
frida-ps -R 遠程frida-server 進程列表
frida-ps -Ua 運行中APP 應用列表(系統app/用戶app)
frida-ps -Uai 所有已安裝的App 應用列表(系統app/用戶app)
 
執行frida -U -f com.xxx.xxx 進行連接,選擇一個進程,等待一段時間則進入該應用
frida -U -f com.android.browser
 
安裝apk
adb install Termux.apk
 
 
下載最新adb(platform-tools)
下載://developer.android.com/studio/releases/platform-tools
 
ADB和Fastboot for Windows
 
ADB和Fastboot for Mac
 
ADB和Fastboot for Linux
 
參考鏈接