MITMdump应用举例

def request(flow: http.HTTPFlow) -> None:
    # pretty_url takes the "Host" header of the request into account, which
    # is useful in transparent mode where we usually only have the IP otherwise.
    ctx.log.info(str(flow.request.pretty_url))
   
    if "m.baidu.com" in  flow.request.pretty_url :
        flow.response = http.HTTPResponse.make(
            200,  # (optional) status code
            b"Hello World",  # (optional) content
            {"Content-Type": "text/html"}  # (optional) headers
)

 

posted @ 2023-05-28 05:28  myrj  阅读(27)  评论(0)    收藏  举报