mitmproxy 二次代理

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
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容