前序:
mitmproxy真的很強(qiáng)大,或許是大家都各自使用,或者沒有相關(guān)的需求,導(dǎo)致我廢了很大精力找了很久的資料都很難找到二次代理的配置方法,看了很久源代碼加上搜了很久的資料,最終讓我終于找到方法,下面記錄一下,大家就不用跟我一樣踩坑了。
成都創(chuàng)新互聯(lián)是專業(yè)的蓬溪網(wǎng)站建設(shè)公司,蓬溪接單;提供成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè),網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行蓬溪網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
以下配置使用mitmproxy版本信息如下
Mitmproxy: 4.0.4
Python: 3.6.3
配置步驟實(shí)際相當(dāng)簡(jiǎn)單,但所有步驟缺一不可:
注:只有在一開始啟動(dòng)了upstream模式,后續(xù)才可以進(jìn)行定制化跳轉(zhuǎn)
mitmdump --mode upstream:http://default-upstream-proxy.local:8080/ -s ./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)
# 這里配置二級(jí)代理的ip地址和端口
if flow.live:
flow.live.change_upstream_proxy_server(proxy)
設(shè)備連接mitmproxy后,訪問http://www.ip.cn 及 http://httpbin.org/ip
分享標(biāo)題:MITMProxy如何配置二次代理
URL網(wǎng)址:http://sd-ha.com/article46/gcjihg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、網(wǎng)站導(dǎo)航、營(yíng)銷型網(wǎng)站建設(shè)、、小程序開發(fā)、Google
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)