3

如何从脚本中退出 mitmpdump 命令?

尝试过sys.exit(0),但它没有完成进程 mitmpdump,它只会停止过滤。

这是我的脚本

"""
This script adds a filter.
Usage:
  mitmdump -s "script.py"
"""
import sys
from mitmproxy import flowfilter

class Filter:
  def __init__(self):
    self.filter = flowfilter.parse("~h my_filter")

  def response(self, flow):
    if flowfilter.match(self.filter, flow):
      print("Flow matches filter:")
      print(flow.request.headers["my_filter"])
      sys.exit(0)

def start():
  return Filter()
4

0 回答 0