mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-26 05:14:57 +08:00
Add --kill option to mitmdump
If this option is passed all requests that are not part of a replayed conversation are killed. If the option is not passed, such requests are passed through to the server as usual.
This commit is contained in:
@@ -6,11 +6,12 @@ class DumpError(Exception): pass
|
||||
|
||||
class Options(object):
|
||||
__slots__ = [
|
||||
"verbosity",
|
||||
"wfile",
|
||||
"kill",
|
||||
"request_script",
|
||||
"response_script",
|
||||
"replay",
|
||||
"verbosity",
|
||||
"wfile",
|
||||
]
|
||||
def __init__(self, **kwargs):
|
||||
for k, v in kwargs.items():
|
||||
@@ -66,7 +67,15 @@ class DumpMaster(flow.FlowMaster):
|
||||
f = flow.FlowMaster.handle_request(self, r)
|
||||
if self.o.request_script:
|
||||
self._runscript(f, self.o.request_script)
|
||||
if not self.playback(f):
|
||||
|
||||
if self.o.replay:
|
||||
pb = self.playback(f)
|
||||
if not pb:
|
||||
if self.o.kill:
|
||||
self.state.kill_flow(f)
|
||||
else:
|
||||
r.ack()
|
||||
else:
|
||||
r.ack()
|
||||
|
||||
def indent(self, n, t):
|
||||
|
||||
Reference in New Issue
Block a user