安装Python3
wget https://www.moerats.com/usr/shell/Python3/Debian_Python3.6.sh && sh Debian_Python3.6.sh
使用pip3安装mitmproxy
pip3 install --upgrade pip
pip3 install mitmproxy
导出mitmproxy的证书
cd ~/.mitmproxy
cp mitmproxy-ca-cert.pem /root
导出到/root目录
运行命令
不带控制台
mitmdump --proxyauth "banana:qwe123" -p 12588 --set block_global=false -s /root/mitmpy/allinone.py
带控制台
mitmproxy --proxyauth "banana:qwe123" -p 12588 --set block_global=false -s /root/mitmpy/allinone.py
后台执行
nohup mitmdump --proxyauth "banana:qwe123" -p 12588 --set block_global=false -s /root/mitmpy/allinone.py &
停止
实在是找不到官方的停止命令,只能结束进程了
kill -9 pid
- 共有三种命令方式mitmproxy mitmdump mitmweb
- HTTP代理验证:--proxyauth "username:password"
- 指定代理端口:-p 端口 (默认是8080)
- block_global: 阻止来自全球可访问网络的连接,我们需要连接所以设定为false
- 载入脚本:-s /root/test.py
JS脚本移植到PY脚本
ASCII
var _0xf36b=["\x62\x6F\x64\x79","\x70\x61\x72\x73\x65","\x70\x72\x6F\x45\x6E\x64\x44\x61\x74\x65","\x32\x30\x39\x39\x2D\x30\x31\x2D\x30\x31\x54\x30\x30\x3A\x30\x30\x3A\x30\x30\x2E\x30\x30\x30\x2B\x30\x30\x30\x30","\x6E\x65\x65\x64\x53\x75\x62\x73\x63\x72\x69\x62\x65","\x70\x72\x6F","\x73\x74\x72\x69\x6E\x67\x69\x66\x79"];var body=$response[_0xf36b[0]];var obj=JSON[_0xf36b[1]](body);obj[_0xf36b[2]]= _0xf36b[3];obj[_0xf36b[4]]= false;obj[_0xf36b[5]]= true;body= JSON[_0xf36b[6]](obj);$done(body)
- \x 是十六进制,直接去掉
- 根据ASCII码对照表,\x62\x6F\x64\x79翻译过来就是body,以此类推
- 0xf36b代表["\x62\x6F\x64\x79",....]整体
- [_0xf36b[0]]代表\x62\x6F\x64\x79,即body,以此类推
Comments | NOTHING