1.安裝frida
本機環境mac 或者win10 (AMD64)都一樣、python3.6.4
pip install frida
如果報錯: ERROR: Command errored out with exit status 1
解決方法: 安裝Wordcloud.whl文件,下載地址:
https://www.lfd.uci.edu/~gohlke/pythonlibs/
找到對應自己的版本.下載后 pip install wordcloud…whl 即可.
pip install frida-tools
安裝完成后frida后,再pip安裝frida-tools
2.安裝木木模擬器
直接去官網下載. http://mumu.163.com/
此過程省略… 下載后首先:
開啟模擬器的root權限
打開模擬器USB調試
在開發者選項中。
3.下載frida服務端
到 https://github.com/frida/frida/releases 下載相應的版本
這里是給木木模擬器安裝Android版本,所以下載下面這個:
frida-server-12.8.20-android-x86.xz
解壓縮上面的文件,並且重命名為frida-server
4. 安裝adb工具
方法有很多,我這里是下載了android studio,然后在環境變量中設置了adb的路徑,使用adb devices 能看到木木瀏覽器
5. 將frida-server 通過adb push指令推送到木木瀏覽器下的/data/local/tmp目錄下,然后開啟權限並啟動
adb root # might be required adb push frida-server /data/local/tmp/ adb shell "chmod 777 /data/local/tmp/frida-server" adb shell "/data/local/tmp/frida-server &"
6.查看是否啟動成功
重新打開一個cmd窗口, 執行下面的命令, 查看當前運行的進程. 有輸出則說明啟動成功.
frida-ps -U
7.如果需要進行debug的話,將手機端的端口轉發到PC端進行通信
adb forward tcp:27042 tcp:27042 adb forward tcp:27043 tcp:27043
使用python調用
簡單測試:
import frida import sys #獲取設備信息 rdev = frida.get_remote_device() #獲取在前台運行的APP front_app = rdev.get_frontmost_application() print (front_app)
你在模擬器上運行一個微信。
weixin = "com.tencent.mm"
# 枚舉進程中加載指定模塊中的導出函數
session = rdev.attach(weixin) # 也可以使用attach(pid)的方式
# 我找了半天,老版本的enumerateModules方法沒了,現在只能通過js入口
jscode = """ Process.enumerateModules({ onMatch:function(exp){ send(exp.name); }, onComplete:function(){ send("stop"); } }) """ script = session.create_script(jscode) def on_message(message, data): print(message) script.on('message', on_message) script.load() sys.stdin.read()