安卓hook工具Frida怎麼安裝

雖然網上一堆教程,但是我能說我搞定整個環境用了整整3天!!

中間踩了一堆坑,總之就是frida需要的各部分版本需要能互相兼容!最後我成功的版本是python3.7+frida 12.7.5+ frida-server x86 +win10+模擬器安卓5.1版本,每一部分的版本我都換過才解決了所有問題,所以不想浪費時間的就老老實實得裝一樣的版本吧。雖然說最好用真機,但是我的華爲不打算root掉,所以最後用了某神模擬器

首先本機安裝python3的frida模塊和frida-tools工具
pip3 install frida==12.7.5
pip3 install frida-tools

然後下載符合自己模擬器cpu版本的frida-server
frida-server下載地址
https://github.com/frida/frida/releases

nox_adb.exe(模擬器自帶的adb程序) shell 裏輸入 getprop ro.product.cpu.abi 可以看cpu類型,我是x86 的,所以就下載了x86的frida-server安裝包,版本需要和本機的一致,然後把文件解壓後push到
模擬器上

nox_adb.exe push frida-server-12.7.5-android-x86 /data/local/tmp/frida-server

然後nox_adb.exe shell進入虛擬機,

cd  /data/local/tmp/ 
chmod 777  frida-server
./frida-server 

運行 運行之後不要關閉窗口,就讓他運行着就好了

本機執行 frida-ps -U 應該能看到模擬器上啓動的包名
frida -U -f com.taobao.taobao 命令能啓動模擬器上的淘寶

最後送一個某寶請求hook例子,hook了之後就能用fiddler抓淘寶的包了,不然是抓不了的。

import frida, sys

jscode = """
Java.perform(function () {
var SwitchConfig = Java.use('mtopsdk.mtop.global.SwitchConfig');
    SwitchConfig.isGlobalSpdySwitchOpen.overload().implementation = function(){
        var ret = this.isGlobalSpdySwitchOpen.apply(this, arguments);
        console.log("isGlobalSpdySwitchOpenl "+ret)
        
        return false
    }
})
"""

def on_message(message, data):
    if message['type'] == 'send':
        print("[*] {0}".format(message['payload']))
    else:
        print(message)


process = frida.get_usb_device().attach('com.taobao.taobao')
script = process.create_script(jscode)
script.on('message', on_message)
script.load()
sys.stdin.read()

還在學習中,逆向好tm難啊。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章