diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-02-08 22:28:15 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-02-08 22:28:15 +1300 |
commit | 866a93a8bc28fed47dde04f49c13592a7163bff4 (patch) | |
tree | c1620ebf1809a1cdce2771a2399c393d537e12ab /libmproxy | |
parent | e3f28e1c06093147660e2857adce24b441d6530f (diff) | |
download | mitmproxy-866a93a8bc28fed47dde04f49c13592a7163bff4.tar.gz mitmproxy-866a93a8bc28fed47dde04f49c13592a7163bff4.tar.bz2 mitmproxy-866a93a8bc28fed47dde04f49c13592a7163bff4.zip |
Start consolidating keybindings.
I want each view to have a more coherent set of bindings. This means minimizing
the global bindings, and making some bindings accessible only from screens
related to their functionality.
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/console/__init__.py | 14 | ||||
-rw-r--r-- | libmproxy/console/connlist.py | 12 | ||||
-rw-r--r-- | libmproxy/console/connview.py | 30 | ||||
-rw-r--r-- | libmproxy/console/help.py | 17 |
4 files changed, 41 insertions, 32 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index 196e71c7..69a50f18 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -372,11 +372,13 @@ class ConsoleMaster(flow.FlowMaster): sys.exit(1) def run_script_once(self, path, f): + if not path: + return ret = self.get_script(path) if ret[0]: self.statusbar.message(ret[0]) + return s = ret[1] - if f.request: s.run("request", f) if f.response: @@ -781,16 +783,6 @@ class ConsoleMaster(flow.FlowMaster): self.set_intercept ) self.sync_list_view() - elif k == "m": - self.prompt_onekey( - "View", - ( - ("raw", "r"), - ("pretty", "p"), - ("hex", "h"), - ), - self.changeview - ) elif k == "Q": raise Stop elif k == "q": diff --git a/libmproxy/console/connlist.py b/libmproxy/console/connlist.py index 1d34fba9..d9ef258b 100644 --- a/libmproxy/console/connlist.py +++ b/libmproxy/console/connlist.py @@ -4,12 +4,15 @@ import common def _mkhelp(): text = [] keys = [ + ("A", "accept all intercepted connections"), + ("a", "accept this intercepted connection"), ("C", "clear connection list or eventlog"), ("d", "delete connection from view"), ("v", "toggle eventlog"), ("X", "kill and delete connection, even if it's mid-intercept"), ("tab", "tab between eventlog and connection list"), ("enter", "view connection"), + ("|", "run script on this flow"), ] text.extend(common.format_keyvals(keys, key="key", val="text", indent=4)) return text @@ -117,10 +120,13 @@ class ConnectionItem(common.WWrap): self.master.view_flow(self.flow) elif key == "|": self.master.path_prompt( - "Send flow to script: ", self.state.last_script, - self.master.run_script_once, self.flow + "Send flow to script: ", + self.state.last_script, + self.master.run_script_once, + self.flow ) - return key + else: + return key class ConnectionListView(urwid.ListWalker): diff --git a/libmproxy/console/connview.py b/libmproxy/console/connview.py index f6d24d5e..49418d01 100644 --- a/libmproxy/console/connview.py +++ b/libmproxy/console/connview.py @@ -5,13 +5,29 @@ from .. import utils, encoding, flow def _mkhelp(): text = [] keys = [ + ("A", "accept all intercepted connections"), + ("a", "accept this intercepted connection"), ("b", "save request/response body"), ("e", "edit request/response"), + ("m", "change body display mode"), + (None, + common.highlight_key("raw", "r") + + [("text", ": raw data")] + ), + (None, + common.highlight_key("pretty", "p") + + [("text", ": pretty-print XML, HTML and JSON")] + ), + (None, + common.highlight_key("hex", "h") + + [("text", ": hex dump")] + ), ("p", "previous flow"), ("v", "view body in external viewer"), ("z", "encode/decode a request/response"), ("tab", "toggle request/response view"), ("space", "next flow"), + ("|", "run script on this flow"), ] text.extend(common.format_keyvals(keys, key="key", val="text", indent=4)) return text @@ -433,6 +449,17 @@ class ConnectionView(common.WWrap): self.edit ) key = None + elif key == "m": + self.master.prompt_onekey( + "View", + ( + ("raw", "r"), + ("pretty", "p"), + ("hex", "h"), + ), + self.master.changeview + ) + key = None elif key == "p": self.view_prev_flow(self.flow) elif key == "r": @@ -490,7 +517,8 @@ class ConnectionView(common.WWrap): conn ) self.master.refresh_connection(self.flow) - return key + else: + return key def encode_callback(self, key, conn): encoding_map = { diff --git a/libmproxy/console/help.py b/libmproxy/console/help.py index b2eafbf0..0c710c7b 100644 --- a/libmproxy/console/help.py +++ b/libmproxy/console/help.py @@ -28,28 +28,12 @@ class HelpView(urwid.ListBox): text.append(("head", "\n\nGlobal keys:\n")) keys = [ - ("A", "accept all intercepted connections"), - ("a", "accept this intercepted connection"), ("c", "client replay"), ("i", "set interception pattern"), ("j, k", "up, down"), ("l", "set limit filter pattern"), ("L", "load saved flows"), - ("m", "change body display mode"), - (None, - common.highlight_key("raw", "r") + - [("text", ": raw data")] - ), - (None, - common.highlight_key("pretty", "p") + - [("text", ": pretty-print XML, HTML and JSON")] - ), - (None, - common.highlight_key("hex", "h") + - [("text", ": hex dump")] - ), - ("o", "toggle options:"), (None, common.highlight_key("anticache", "a") + @@ -78,7 +62,6 @@ class HelpView(urwid.ListBox): ("u", "set sticky auth expression"), ("w", "save all flows matching current limit"), ("W", "save this flow"), - ("|", "run script on this flow"), ("space", "page down"), ("pg up/down", "page up/down"), ] |