diff options
author | Marcelo Glezer <marcelo.glezer@gmail.com> | 2015-10-11 11:04:18 -0300 |
---|---|---|
committer | Shadab Zafar <dufferzafar0@gmail.com> | 2016-01-13 15:29:44 +0530 |
commit | 9facd190c6937287eb93b430c24d13c13b5560b8 (patch) | |
tree | c24fe739bff1342e207d7ec011bf410b4dcdfa28 /libmproxy | |
parent | b2e3d2ce7054a15d0b2a707709105c6cc0638151 (diff) | |
download | mitmproxy-9facd190c6937287eb93b430c24d13c13b5560b8.tar.gz mitmproxy-9facd190c6937287eb93b430c24d13c13b5560b8.tar.bz2 mitmproxy-9facd190c6937287eb93b430c24d13c13b5560b8.zip |
refactored export as curl to be 'E' to export and 'c' to as curl command
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/console/common.py | 4 | ||||
-rw-r--r-- | libmproxy/console/flowlist.py | 14 | ||||
-rw-r--r-- | libmproxy/console/flowview.py | 16 |
3 files changed, 27 insertions, 7 deletions
diff --git a/libmproxy/console/common.py b/libmproxy/console/common.py index ff820987..6a7064ff 100644 --- a/libmproxy/console/common.py +++ b/libmproxy/console/common.py @@ -276,6 +276,10 @@ def copy_flow_format_data(part, scope, flow): raise ValueError("Unknown part: {}".format(part)) return data, False +def export_prompt(k, flow): + if k == "c": + copy_as_curl_command(flow) + def copy_as_curl_command(flow): if flow.request.content is None or flow.request.content == CONTENT_MISSING: diff --git a/libmproxy/console/flowlist.py b/libmproxy/console/flowlist.py index 6edf5212..6c0ff3d0 100644 --- a/libmproxy/console/flowlist.py +++ b/libmproxy/console/flowlist.py @@ -13,10 +13,10 @@ def _mkhelp(): ("A", "accept all intercepted flows"), ("a", "accept this intercepted flow"), ("b", "save request/response body"), - ("Z", "copy request as curl command"), ("C", "clear flow list or eventlog"), ("d", "delete flow"), ("D", "duplicate flow"), + ("E", "export"), ("e", "toggle eventlog"), ("F", "toggle follow flow list"), ("l", "set limit filter pattern"), @@ -255,8 +255,16 @@ class ConnectionItem(urwid.WidgetWrap): ) elif key == "P": common.ask_copy_part("a", self.flow, self.master, self.state) - elif key == "Z": - common.copy_as_curl_command(self.flow) + elif key == "E": + signals.status_prompt_onekey.send( + self, + prompt = "Export", + keys = ( + ("as curl command", "c"), + ), + callback = common.export_prompt, + args = (self.flow,) + ) elif key == "b": common.ask_save_body(None, self.master, self.state, self.flow) else: diff --git a/libmproxy/console/flowview.py b/libmproxy/console/flowview.py index 518817d4..95d52c98 100644 --- a/libmproxy/console/flowview.py +++ b/libmproxy/console/flowview.py @@ -25,9 +25,9 @@ def _mkhelp(): ("A", "accept all intercepted flows"), ("a", "accept this intercepted flow"), ("b", "save request/response body"), - ("Z", "copy as curl command"), - ("d", "delete flow"), ("D", "duplicate flow"), + ("d", "delete flow"), + ("E", "export"), ("e", "edit request/response"), ("f", "load full body data"), ("m", "change body display mode for this entity"), @@ -575,8 +575,16 @@ class FlowView(tabs.Tabs): callback = self.master.save_one_flow, args = (self.flow,) ) - elif key == "Z": - common.copy_as_curl_command(self.flow) + elif key == "E": + signals.status_prompt_onekey.send( + self, + prompt = "Export", + keys = ( + ("as curl command", "c"), + ), + callback = common.export_prompt, + args = (self.flow,) + ) elif key == "|": signals.status_prompt_path.send( prompt = "Send flow to script", |