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 )