阿里系的app,用的mtopsdk,默认Spdy是开启的,fiddler是不显示网络请求的。

今天偶然搜到可以用frida hook,把Spdy关闭。这里记一下过程:

本文主要引用https://www.jianshu.com/p/fa14e8063f79的过程

要求 安卓手机需要已经root

首先安装frida模块和frida-tools工具,需要python3

pip3 install fridapip3 install frida-tools

如果下载比较慢,可以使用国内清华大学镜像

pip3 install frida -i https://pypi.mirrors.ustc.edu.cn/simple/pip3 install frida-tools -i https://pypi.mirrors.ustc.edu.cn/simple/

然后下载frida-server,这个是要运行在安卓手机上的,首先查看cpu类型

命令如下

adb shellgetprop ro.product.cpu.abi

我这里是arm64

server.png

frida-server 下载地址是https://github.com/frida/frida/releases 目前最新版是14.0.8

我下载的是 [frida-server-14.0.8-android-arm64.xz][]

image-1024x593.png

下载后,把文件解压,再push到安卓手机上

adb push frida-server-14.0.8-android-arm64 /data/local/tmp/frida-server14.0.8

然后adb shell进入虚拟机:

cd /data/local/tmp/    //进入frida-server所在目录chmod 777 frida-server14.0.8    //赋予权限./frida-server14.0.8 &    //启动运行

重新打开一个cmd窗口,本机执行 frida-ps -U 应该能看到模拟器上启动的包名。

然后启动一段python代码

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('fm.xiami.main')

script = process.create_script(jscode)

script.on('message', on_message)

script.load()

sys.stdin.read()

然后我们就可以测试抓包了。

[frida-hook.py][]下载

[frida-server-14.0.8-android-arm64.xz]
frida-server-14.0.8-android-arm64.xz 1[frida-server-14.0.8-android-arm64.xz 1]