mitmdump.py文件
from mitmproxy import http
class MitmProxy:
def __init__(self):
self.name = 'mitmproxy'
def request(self, flow: http.HTTPFlow):
# if the decision is done by domain, one could alse modify the server address here.
# We do it after CONNECT here to have the reqeust data available as well.
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
proxy = ("localhost", 7890)
# 这里配置二级代理的ip地址和端口
if flow.live:
if type(flow.live) != bool:
flow.live.change_upstream_proxy_server(proxy)
addons = [
MitmProxy()
]
cmd执行命令
mitmweb --mode upstream:http://127.0.0.1:7890 -s mitmdump.py -p 8080
或者直接执行
mitmweb --mode upstream:http://127.0.0.1:7890 -p 8080