aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-07-06 23:35:30 +0530
committerShadab Zafar <dufferzafar0@gmail.com>2016-07-20 10:03:00 +0530
commit5cf2228250830e79ddc913eda8212fda6ea0f9a4 (patch)
treedbdc0b3cb46214e1dc005206eec2ffdc81a3d830
parent6119f0f16afc39aee53d67b8d4ebafbf58454e25 (diff)
downloadmitmproxy-5cf2228250830e79ddc913eda8212fda6ea0f9a4.tar.gz
mitmproxy-5cf2228250830e79ddc913eda8212fda6ea0f9a4.tar.bz2
mitmproxy-5cf2228250830e79ddc913eda8212fda6ea0f9a4.zip
Export to file (p) or clipboard (P)
-rw-r--r--mitmproxy/console/common.py18
-rw-r--r--mitmproxy/console/flowlist.py18
-rw-r--r--mitmproxy/console/flowview.py1
3 files changed, 24 insertions, 13 deletions
diff --git a/mitmproxy/console/common.py b/mitmproxy/console/common.py
index 1c71117a..c143f0c9 100644
--- a/mitmproxy/console/common.py
+++ b/mitmproxy/console/common.py
@@ -284,12 +284,6 @@ def copy_flow_format_data(part, scope, flow):
return data, False
-def export_prompt(k, f):
- for exporter in flow.export.EXPORTERS:
- if k == exporter[1]:
- copy_to_clipboard_or_prompt(exporter[2](f))
-
-
def copy_to_clipboard_or_prompt(data):
# pyperclip calls encode('utf-8') on data to be copied without checking.
# if data are already encoded that way UnicodeDecodeError is thrown.
@@ -395,6 +389,18 @@ def ask_save_body(part, master, state, flow):
signals.status_message.send(message="No content to save.")
+def export_to_clipboard(k, f):
+ for exporter in flow.export.EXPORTERS:
+ if k == exporter[1]:
+ copy_to_clipboard_or_prompt(exporter[2](f))
+
+
+def export_to_file(k, f):
+ for exporter in flow.export.EXPORTERS:
+ if k == exporter[1]:
+ ask_save_path("File path", exporter[2](f))
+
+
flowcache = utils.LRUCache(800)
diff --git a/mitmproxy/console/flowlist.py b/mitmproxy/console/flowlist.py
index e8bbe24d..5b1701d8 100644
--- a/mitmproxy/console/flowlist.py
+++ b/mitmproxy/console/flowlist.py
@@ -17,7 +17,6 @@ def _mkhelp():
("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"),
@@ -25,7 +24,8 @@ def _mkhelp():
("m", "toggle flow mark"),
("M", "toggle marked flow view"),
("n", "create a new request"),
- ("P", "copy flow to clipboard"),
+ ("p", "export flow to file"),
+ ("P", "export flow to clipboard"),
("r", "replay request"),
("U", "unmark all marked flows"),
("V", "revert changes to request"),
@@ -264,14 +264,20 @@ class ConnectionItem(urwid.WidgetWrap):
callback = self.master.run_script_once,
args = (self.flow,)
)
+ elif key == "p":
+ signals.status_prompt_onekey.send(
+ self,
+ prompt = "Export to file",
+ keys = [(e[0], e[1]) for e in export.EXPORTERS],
+ callback = common.export_to_file,
+ args = (self.flow,)
+ )
elif key == "P":
- common.ask_copy_part("a", self.flow, self.master, self.state)
- elif key == "E":
signals.status_prompt_onekey.send(
self,
- prompt = "Export",
+ prompt = "Export to clipboard",
keys = [(e[0], e[1]) for e in export.EXPORTERS],
- callback = common.export_prompt,
+ callback = common.export_to_clipboard,
args = (self.flow,)
)
elif key == "b":
diff --git a/mitmproxy/console/flowview.py b/mitmproxy/console/flowview.py
index c85a9f73..9b89be98 100644
--- a/mitmproxy/console/flowview.py
+++ b/mitmproxy/console/flowview.py
@@ -34,7 +34,6 @@ def _mkhelp():
("b", "save request/response body"),
("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"),