我正在使用mitmdump -dd > outfile
解析内容,这给了我完整的请求和响应“ header 及其正文内容”(这也删除了流量的垃圾部分,即没有证书和没有压缩数据)。
但这使我的文件变得非常大。我怎样才能只获取流量的请求部分......
任何建议或链接如何做到这一点?
谢谢
最佳答案
我处理不准确但类似情况的方法是使用 mitmdump 的 -s
标志并在我的脚本中获取 flow.request.content
并将其记录到某个日志中文件将非常整洁干净
下面的代码可能会有所帮助(另存为 t.py 并运行 mitmdump -s t.py
)
from mitmproxy import http
import time,re
import logging
def response(flow: http.HTTPFlow) -> None:
flow.response.headers["newheader"] = "foo"
def request(flow: http.HTTPFlow) -> None:
print(flow.request.content)
request_content = flow.request.content
# here u get the request content and then log it and use it
关于mitmproxy - 如何解析Mitmdump/Mitmproxy内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40056196/