mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 10:26:23 +00:00
bea0bd236a
- No output to stdout on load in examples - they muck up the test suite. - Use the odict module directly, rather than aliasing it. The small convenience this gives to scripters is not worth it. - Move the cookie tests from the flow test module to the protocol_http test module.
15 lines
393 B
Python
15 lines
393 B
Python
# This scripts demonstrates how to use mitmproxy's filter pattern in inline scripts.
|
|
# Usage: mitmdump -s "filt.py FILTER"
|
|
|
|
from libmproxy import filt
|
|
|
|
def start(context, argv):
|
|
if len(argv) != 2:
|
|
raise ValueError("Usage: -s 'filt.py FILTER'")
|
|
context.filter = filt.parse(argv[1])
|
|
|
|
def response(context, flow):
|
|
if flow.match(context.filter):
|
|
print("Flow matches filter:")
|
|
print(flow)
|