aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-03-18 09:38:51 +1300
committerAldo Cortesi <aldo@nullcube.com>2011-03-18 09:38:51 +1300
commitf97c144869fa4cb8123d0a12ec9503ee0a8cf485 (patch)
tree57f92d2db9c6cd4097337e95ec8fc2170b2bfe73
parent4893e5e5a4e328c17b416af97bc21b1e785d9e36 (diff)
downloadmitmproxy-f97c144869fa4cb8123d0a12ec9503ee0a8cf485.tar.gz
mitmproxy-f97c144869fa4cb8123d0a12ec9503ee0a8cf485.tar.bz2
mitmproxy-f97c144869fa4cb8123d0a12ec9503ee0a8cf485.zip
Client playback shortcut in mitmproxy can now be used to interrupt a current client playback.
-rw-r--r--libmproxy/console.py25
-rw-r--r--libmproxy/flow.py3
2 files changed, 23 insertions, 5 deletions
diff --git a/libmproxy/console.py b/libmproxy/console.py
index 78e81035..4c53ef01 100644
--- a/libmproxy/console.py
+++ b/libmproxy/console.py
@@ -1298,11 +1298,22 @@ class ConsoleMaster(flow.FlowMaster):
if k == "?":
self.view_help()
elif k == "c":
- self.path_prompt(
- "Client replay: ",
- self.state.last_saveload,
- self.client_playback_path
- )
+ if not self.client_playback:
+ self.path_prompt(
+ "Client replay: ",
+ self.state.last_saveload,
+ self.client_playback_path
+ )
+ else:
+ self.prompt_onekey(
+ "Stop current client replay?",
+ (
+ ("yes", "y"),
+ ("no", "n"),
+ ),
+ self.stop_client_playback_prompt,
+ )
+
k = None
elif k == "l":
self.prompt("Limit: ", self.state.limit_txt, self.set_limit)
@@ -1384,6 +1395,10 @@ class ConsoleMaster(flow.FlowMaster):
except (Stop, KeyboardInterrupt):
pass
+ def stop_client_playback_prompt(self, a):
+ if a != "n":
+ self.stop_client_playback()
+
def quit(self, a):
if a != "n":
raise Stop
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index 62fba6ab..ea5e6cb8 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -464,6 +464,9 @@ class FlowMaster(controller.Master):
"""
self.client_playback = ClientPlaybackState(flows, exit)
+ def stop_client_playback(self):
+ self.client_playback = None
+
def start_server_playback(self, flows, kill, headers, exit):
"""
flows: A list of flows.