Mitmproxy 新版配置上游(二级)代理
生活随笔
收集整理的這篇文章主要介紹了
Mitmproxy 新版配置上游(二级)代理
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
Mitmproxy 最新新版配置上游代理
由于在?4.0版本之后flow.live.change_upstream_proxy_server(proxy)方法已經(jīng)棄用,
會(huì)引發(fā):
AttributeError: 'NoneType' object has no attribute 'change_upstream_proxy_server'使用flow.server_conn.via = ServerSpec(("http", proxy))方法配置上游代理
#!/usr/bin/python # -*- coding: UTF-8 -*- """ @file:maplocal.py @time:2022/11/27 """ from mitmproxy import http import requests from mitmproxy import ctxfrom mitmproxy.net.server_spec import ServerSpecclass 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.client_ip = flow.client_conn.address[0]if 'get' in flow.request.url: ip_ = '上游代理ip:str'port_ = '上游代理端口:int'proxy = (ip_, int(port_))flow.server_conn.via = ServerSpec(("http", proxy))addons = [MitmProxy() ]然后直接使用在命令行運(yùn)行Mitmproxy
mitmdump -s 絕對路徑/mitmdump.py -p 端口總結(jié)
以上是生活随笔為你收集整理的Mitmproxy 新版配置上游(二级)代理的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: RGGEDU-Rob Grimm静物食物
- 下一篇: 站群服务器用SS5 SOCKS5 配置多