mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
0c6663d0d5
- Add an options parameter to the start() event. This is to be used by addons on startup to add custom options. - Add a running() event that is called once the proxy is up and running. - With the new paradigm we can't log during master __init__, so add a tiny termstatus addon to print proxy status to terminal once we're running.
18 lines
398 B
Python
18 lines
398 B
Python
import argparse
|
|
|
|
|
|
class Replacer:
|
|
def __init__(self, src, dst):
|
|
self.src, self.dst = src, dst
|
|
|
|
def response(self, flow):
|
|
flow.response.replace(self.src, self.dst)
|
|
|
|
|
|
def start(opts):
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("src", type=str)
|
|
parser.add_argument("dst", type=str)
|
|
args = parser.parse_args()
|
|
return Replacer(args.src, args.dst)
|