美文网首页
fiddler抓取https请求(Android篇)

fiddler抓取https请求(Android篇)

作者: 邓立_全栈UncleLi | 来源:发表于2021-09-08 09:03 被阅读0次

今天测试小哥思彬说我只有一篇 iOS 篇的抓包文章,为啥没有安卓的。。。理论上,它和苹果是一样,以前也确实可以抓取 https,事实上,我后面再试了几次,没成功就没管了。。。此时测试小哥仿佛要向我吐一口浓痰,心里默念着 你个垃鸡、菜B。。。基于我前几次测试都失败了,今天和测试小哥决定再抓不了 Android 的 https 请求,就不回家了,由我来负责监督他睡公司!哈哈,是个狠人!

  • 设置 fiddler ,勾上捕捉 HTTPS 链接等操作


    fiddler设置
  • 安装 fiddler 证书。此处 Android 众多机型,安装最终以下图为基准,因为个别手机无法直接在浏览器打开下载的 FidderRoot.cer 文件,所以最终办法是找到下载的文件所在位置,直接打开安装


    无法直接打开证书
最终授信的凭证
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config>
        <domain includeSubdomains="true">******</domain> // 此处是项目域名,按真实各位真实域名填写,我这写*号只是展示
        <trust-anchors>
            <certificates src="@raw/fiddler_root"/>
        </trust-anchors>
    </domain-config>
</network-security-config>
  • AndroidManifest.xml 配置,关键是 android:networkSecurityConfig="@xml/network_security_config",其它不用看
<application
        android:name=".app.MLApplication"
        android:allowBackup="true"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/pdd_icon"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:roundIcon="@mipmap/pdd_icon"
        android:supportsRtl="true"
        android:theme="@style/Theme.MaiLang"
        android:usesCleartextTraffic="true">
    .......// 省略代码
</application>
  • 经过如上问题的排查和配置,现在就可以抓取 Android 的 https 请求了


    抓取图

iOS 篇请跳转此地址:https://www.jianshu.com/p/8d0ee661c74c

相关文章

网友评论

      本文标题:fiddler抓取https请求(Android篇)

      本文链接:https://www.haomeiwen.com/subject/vpdpwltx.html