diff options
-rw-r--r-- | libmproxy/console/__init__.py | 2 | ||||
-rw-r--r-- | libmproxy/console/flowlist.py | 44 | ||||
-rw-r--r-- | libmproxy/flow.py | 2 |
3 files changed, 47 insertions, 1 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index 15de4de9..9327ad2c 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -868,7 +868,7 @@ class ConsoleMaster(flow.FlowMaster): elif k == "S": if not self.server_playback: self.path_prompt( - "Server replay: ", + "Server replay path: ", self.state.last_saveload, self.server_playback_path ) diff --git a/libmproxy/console/flowlist.py b/libmproxy/console/flowlist.py index 293b1eae..2b443636 100644 --- a/libmproxy/console/flowlist.py +++ b/libmproxy/console/flowlist.py @@ -127,6 +127,30 @@ class ConnectionItem(common.WWrap): self.flow ) + def stop_server_playback_prompt(self, a): + if a != "n": + self.master.stop_server_playback() + + def server_replay_prompt(self, k): + if k == "a": + self.master.start_server_playback( + [i.copy() for i in self.master.state.view], + self.master.killextra, self.master.rheaders, + False, self.master.nopop + ) + elif k == "t": + self.master.start_server_playback( + [self.flow.copy()], + self.master.killextra, self.master.rheaders, + False, self.master.nopop + ) + else: + self.master.path_prompt( + "Server replay path: ", + self.state.last_saveload, + self.master.server_playback_path + ) + def keypress(self, (maxcol,), key): key = common.shortcuts(key) if key == "a": @@ -146,6 +170,26 @@ class ConnectionItem(common.WWrap): if r: self.master.statusbar.message(r) self.master.sync_list_view() + elif key == "S": + if not self.master.server_playback: + self.master.prompt_onekey( + "Server Replay", + ( + ("all flows", "a"), + ("this flow", "t"), + ("file", "f"), + ), + self.server_replay_prompt, + ) + else: + self.master.prompt_onekey( + "Stop current server replay?", + ( + ("yes", "y"), + ("no", "n"), + ), + self.stop_server_playback_prompt, + ) elif key == "V": if not self.flow.modified(): self.master.statusbar.message("Flow not modified.") diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 30928177..674197a4 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -1317,6 +1317,8 @@ class FlowMaster(controller.Master): if self.refresh_server_playback: response.refresh() flow.request._ack(response) + if self.server_playback.count() == 0: + self.stop_server_playback() return True return None |