安装:
yum install python-devel libxml2-devel libxslt-devel libffi-devel libjpeg-devel openssl-devel python-pip
pip install mitmproxy
启动透明代理模式:
mitmproxy -T --host
端口重定向:
iptables -t nat -A PREROUTING -i eno16777736 -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -t nat -A PREROUTING -i eno16777736 -p tcp --dport 443 -j REDIRECT --to-port 8080
数据转发:
echo 1 > /proc/sys/net/ipv4/ip_forward
导入CA证书:
ls ~/.mitmproxy/
mitmproxy-ca-cert.cer linux下
mitmproxy-ca-cert.p12 windows下
mitmproxy-ca-cert.pem android下
mitmproxy-ca.pem
mitmproxy-dhparam.pem
非本机将网关设置为本机IP,开始。
参考:http://liuxiang.logdown.com/posts/192057-use-mitmproxy-to-monitor-http-requests