mitmproxy fiddler 抓包 填坑

使用mitmproxy抓[DY]包填坑:
    参考资料:
        https://www.cnblogs.com/lsdb/p/10106655.html
        https://github.com/mitmproxy/mitmproxy
        https://docs.mitmproxy.org/stable/api/events.html
        https:cnblogs.com/findyou/p/3491014.html

 

手机条件:

    1、root

    2、下载豌豆荚,下载15.0.0版本的DY(其他版本暂未尝试是否可行)

 

抓https安装证书:
    参考:
        https://www.cnblogs.com/lsdb/p/10106655.html
        https://docs.mitmproxy.org/stable/howto-install-system-trusted-ca-android/
    证书采用上述参考资料安装后,可以抓取百度类的https请求,但无法抓取DY的。需要对证书进行二次处理,并放指定位置。
    证书处理:
        gitbash/linux中执行:hashed_name=`openssl x509 -inform PEM -subject_hash_old -in FiddlerRoot.cer | head -1` && cp FiddlerRoot.cer $hashed_name.0
        将生成:$hashed_name.0文件
        将文件拷贝到手机目录:adb push xxxxxxxx.0 /system/etc/security/cacerts/
        如果报:adb: error: failed to copy 'c8750f0d.0' to '/system/etc/security/cacerts/c8750f0d.0': remote couldn't create file: Permission denied
          解决:
              1、确定手机已经root过了
              2、进入手机:adb shell
              3、执行:su(这时候$会变#,否则说明没有root,必须先root)
              4、手机通过数据线连接,把文件拷贝进设备
              5、pc端拷贝文件:cp sdcard/c8750f0d.0 /system/etc/security/cacerts
              6、重启手机(完)

 

使用fiddler抓包:(MIT控制台看起来不直观,日志太多了,又不好操作,先用fiddler来看,然后用mit来拦截做业务处理)
    参考资料:
        https:cnblogs.com/findyou/p/3491014.html(安装与配置)
        https:cnblogs.com/chenxi188/p/11917840.html(证书导出)
    从fiddler导出来的证书是cert的,需要转换成pem:
        gitbash执行:openssl x509 -inform DER -in FiddlerRoot.cer -out FiddlerRoot.cer.pem
        拷贝到系统证书目录:cp sdcard/269953fb.0 /system/etc/security/cacerts
    配置fiddler:
        Tools > Options > HTTPS > CertEnroll engine[蓝色链接] > Clear server certs on exit(勾选上)
        运行about:config
            增加变量和值:fiddler.certmaker.validdays 5(证书有效期)
    重启fiddler(完)

posted @ 2021-12-02 17:13  流失的痕迹  阅读(336)  评论(0编辑  收藏  举报