mitmproxy虚拟机使用指南
- 请配合这篇一起看:https://github.com/wangyu-/UDPspeeder/issues/87
- 环境:
- 主力机是mac或linux的直接看mitmproxy官方手册
- 宿主机: Win 10 无线网卡;
- 抓包用的虚拟机:VirtualBox + Ubuntu 18.03LTS(kali的ebtables好像没有broute表,暂未成功;VMWave暂未成功),以桥接模式与宿主机、移动设备处于同一局域网中;
- 被抓包的Android(默认网关设置为虚拟机的ip)
- 安装工具
1 2 3 4 5
sudo apt-get install python3-dev python3-pip libffi-dev libssl-dev sudo pip3 install mitmproxy 或者 pip3 install --user mitmproxy sudo apt-get install net-tools sudo apt-get install ebtables sudo apt-get install bridge-tools
安装网卡驱动: https://blog.csdn.net/mythest/article/details/86591252
Virtualbox 控制→设置→网络,混杂模式全部启动
共享设置:https://blog.csdn.net/tryeverything/article/details/85076900
1 2 3 4 5 6 7 8
sudo sysctl -w net.ipv4.ip_forward=1 sudo sysctl -w net.ipv4.conf.all.send_redirects=0 sudo brctl addbr br0 sudo brctl addif br0 enp0s3 sudo ifconfig br0 up sudo ebtables -t broute -A BROUTING -i enp0s3 -j redirect --redirect-target DROP sudo iptables -t raw -A PREROUTING -s 192.168.1.27 -j DROP
- 可能会用到的命令:
1 2 3
sudo ebtables -t broute --list sudo ebtables -t broute -D BROUTING 1 sudo iptables -t raw -D PREROUTING 1
- ubuntu安装证书
1 2 3 4 5
cd .mitmproxy openssl x509 -in mitmproxy-ca-cert.pem -inform PEM -out mitmproxy-ca-cert.crt sudo mkdir /usr/share/ca-certificates/extra sudo cp mitmproxy-ca-cert.crt /usr/share/ca-certificates/extra/mitmproxy-ca-cert.crt sudo dpkg-reconfigure ca-certificates
iptables转发端口:
1 2 3 4 5
sudo iptables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 80 -j REDIRECT --to-port 8080 sudo iptables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 443 -j REDIRECT --to-port 8080 sudo ip6tables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 80 -j REDIRECT --to-port 8080 sudo ip6tables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 443 -j REDIRECT --to-port 8080
启动
1 2 3 4
mitmproxy --mode transparent --showhost mitmproxy --mode transparent --showhost --intercept xxx.xyx.com --view-filter xyz
常用命令:
i: xxx.xyz.com|yyy.xyz.com f: ~u xyz.jp
快捷键G是到最下面
This post is licensed under CC BY 4.0 by the author.