diff options
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/console/__init__.py | 13 | ||||
-rw-r--r-- | libmproxy/console/flowlist.py | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index 482c762d..8ce91d73 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -175,6 +175,8 @@ class StatusBar(common.WWrap): opts.append("killextra") if self.master.server.config.no_upstream_cert: opts.append("no-upstream-cert") + if self.master.state.follow_focus: + opts.append("following") if opts: r.append("[%s]"%(":".join(opts))) @@ -252,6 +254,7 @@ class ConsoleState(flow.State): def __init__(self): flow.State.__init__(self) self.focus = None + self.follow_focus = None self.default_body_view = contentview.VIEW_AUTO self.view_flow_mode = common.VIEW_FLOW_REQUEST self.last_script = "" @@ -270,6 +273,8 @@ class ConsoleState(flow.State): f = flow.State.add_request(self, req) if self.focus is None: self.set_focus(0) + elif self.follow_focus: + self.set_focus(len(self.view) - 1) return f def add_response(self, resp): @@ -935,6 +940,14 @@ class ConsoleMaster(flow.FlowMaster): self.state.clear() self.sync_list_view() + def toggle_follow_flows(self): + # toggle flow follow + self.state.follow_focus = not self.state.follow_focus + # jump to most recent flow if follow is now on + if self.state.follow_focus: + self.state.set_focus(self.state.flow_count()) + self.sync_list_view() + def delete_flow(self, f): self.state.delete_flow(f) self.sync_list_view() diff --git a/libmproxy/console/flowlist.py b/libmproxy/console/flowlist.py index 71214e5e..293b1eae 100644 --- a/libmproxy/console/flowlist.py +++ b/libmproxy/console/flowlist.py @@ -25,6 +25,7 @@ def _mkhelp(): ("d", "delete flow"), ("D", "duplicate flow"), ("e", "toggle eventlog"), + ("F", "toggle follow flow list"), ("l", "set limit filter pattern"), ("L", "load saved flows"), ("r", "replay request"), @@ -225,6 +226,8 @@ class FlowListBox(urwid.ListBox): self.master.state.last_saveload, self.master.load_flows_callback ) + elif key == "F": + self.master.toggle_follow_flows() elif key == "W": if self.master.stream: self.master.stop_stream() |