标签:https ati mamicode 成功 输入 request img ase 参数
打开mitmproxy官网,可以看到官方提供的安装命令,使用brew来直接进行安装
brew install mitmproxy
如果是windows系统,可以看考mitmproxy的windows安装方法来进行安装
#命令行输入mitmweb,即可在浏览器中打开本地的mitmweb的监听页面
mitmweb
mitmdump
mitmdump -p 8090
可以参考官方文档的插件例子
import mitmproxy.http
from mitmproxy import ctx
class ZWmaplocal:
def __init__(self):
self.num = 0
def request(self, flow: mitmproxy.http.HTTPFlow):
self.num += 1
ctx.log.info("We‘ve seen %d flows" % self.num)
ctx.log.info("Base content %s" % str(flow.get_state()))
addons = [
ZWmaplocal()
]
from mitmproxy import http, ctx
class ZWmaplocal:
def __init__(self):
self.num = 0
def request(self, flow: http.HTTPFlow):
# if "baidu" in flow.request.pretty_url:
if f"v5/stock/batch/quote.json" in flow.request.pretty_url:
with open(r"/Users/CreamK/Desktop/maplocal.json", "r", encoding="utf-8") as f:
flow.response = http.HTTPResponse.make(
200, # (optional) status code
f.read(), # (optional) content
{"Content-Type": "application/json"} # (optional) headers
)
addons = [
ZWmaplocal()
]
标签:https ati mamicode 成功 输入 request img ase 参数
原文地址:https://www.cnblogs.com/creamk87/p/14885563.html