mitmdump --mode upstream:http://default-upstream-proxy.local:8080/ -s ./change_upstream_proxy.py
http 代理
# change_upstream_proxy.py
def request(flow: http.HTTPFlow) -> None:
if flow.request.method == "CONNECT":
# If the decision is done by domain, one could also modify the server address here.
# We do it after CONNECT here to have the request data available as well.
return
client_ip = flow.client_conn.address[0]
if 'ip.cn' in flow.request.url:
ctx.log.info(flow.request.url)
proxy =("localhost", 8888)
else:
proxy = ("localhost", 3800)
# 这里配置二级代理的ip地址和端口
if flow.live:
flow.live.change_upstream_proxy_server(proxy)
https代理
先安装好根证书 https://www.jianshu.com/p/60332f71a89f
再输入命令
mitmdump --mode upstream:http://someproxy:someport -s ./change_upstream_proxy.py
# change_upstream_proxy.py
def request(flow: http.HTTPFlow) -> None:
pass