安裝mitmproxy Https抓包證書
macbook上 mitmproxy 抓取安卓手機https流量
重點是安裝mitmproxy Https抓包證書
前提
手機需要root,macbook上需要安裝好mitmproxy
macbook安裝mitmproxy
需要完成下文1-3:
https://github.com/doug-leith/cydia
(接入有線網(wǎng)并開啟無線熱點)
啟用 IP 轉(zhuǎn)發(fā):
sudo sysctl -w net.inet.ip.forwarding=1
保存文件:
https://github.com/doug-leith/cydia/blob/main/pf.conf
最后兩行改為:
rdr on bridge100 inet proto tcp to any port {80, 443} -> 127.0.0.1 port 8080
block drop quick on bridge100 inet proto udp to any port 443
在pf.conf所在文件夾執(zhí)行:
sudo pfctl -f pf.conf
sudo pfctl -e
編輯文件/etc/sudoers,末尾加上一行:
ALL ALL=NOPASSWD: /sbin/pfctl -s state
測試mitmproxy
普通模式:
mitmweb --showhost --ssl-insecure --rawtcp --listen-port 8888
透明模式:
mitmweb --mode transparent –showhost
upstream模式:
mitmweb --mode upstream:127.0.0.1:7890 --showhost --ssl-insecure --rawtcp --listen-port 8888
安裝證書到手機并設(shè)置為系統(tǒng)證書
macbook上命令行輸入 mitmproxy完成首次啟動,獲得~/.mitmproxy,其中包含mitmproxy的CA證書
在macbook中找到mitmproxy的證書(例如在/Users/gossip/.mitmproxy)
cd ~/.mitmproxy/
openssl x509 -inform PEM -subject_hash_old -in mitmproxy-ca-cert.cer | head -1
得到輸出,例如c8450d0d
cp mitmproxy-ca-cert.cer c8750f0d.0
adb push c8750f0d.0 /data/local/tmp
從https://github.com/doug-leith/cydia/blob/main/下載cacert_setup.sh 和 cacert.sh,將其中內(nèi)容用c8750f0d替換后,放入手機
adb push cacert.sh /data/local/tmp
adb push cacert_setup.sh /data/local/tmp
adb shell
su
cd /data/local/tmp
chmod a+x cacert*
cp cacert.sh /data/adb/service.d/
./cacert_setup.sh文章來源:http://www.zghlxwxcb.cn/news/detail-815159.html
如果出現(xiàn)No such file or directory提示,通常是由于dos格式與unix 格式差異。
使用vi或者vim,看sh腳本通??梢园l(fā)現(xiàn)問題
例如,每行末尾多了^M
去掉即可文章來源地址http://www.zghlxwxcb.cn/news/detail-815159.html
到了這里,關(guān)于【Android安全】安裝mitmproxy Https抓包證書 | 安卓SSL抓包的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!