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:
Aldo Cortesi
2011-02-21 11:08:35 +13:00
parent c3e3897071
commit fe99871df8
6 changed files with 40 additions and 11 deletions

View File

@@ -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):