mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
21 lines
412 B
Python
21 lines
412 B
Python
import random
|
|
import sys
|
|
|
|
from libmproxy.flow import FlowWriter
|
|
|
|
|
|
def start(context, argv):
|
|
if len(argv) != 2:
|
|
raise ValueError('Usage: -s "flowriter.py filename"')
|
|
|
|
if argv[1] == "-":
|
|
f = sys.stdout
|
|
else:
|
|
f = open(argv[1], "wb")
|
|
context.flow_writer = FlowWriter(f)
|
|
|
|
|
|
def response(context, flow):
|
|
if random.choice([True, False]):
|
|
context.flow_writer.add(flow)
|