aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-07-17 10:15:30 +0530
committerShadab Zafar <dufferzafar0@gmail.com>2016-07-20 14:41:21 +0530
commita933b82064d42318627cea5080029967aa1d671e (patch)
tree540e1d6c497cfa2922317359ba6fb54597de03df
parent3321e7bef3fd4cb8ff09605e4dc7b47eca132b1d (diff)
downloadmitmproxy-a933b82064d42318627cea5080029967aa1d671e.tar.gz
mitmproxy-a933b82064d42318627cea5080029967aa1d671e.tar.bz2
mitmproxy-a933b82064d42318627cea5080029967aa1d671e.zip
Make necessary changes in flowview
-rw-r--r--mitmproxy/console/flowview.py51
1 files changed, 28 insertions, 23 deletions
diff --git a/mitmproxy/console/flowview.py b/mitmproxy/console/flowview.py
index 9b89be98..8fffaf07 100644
--- a/mitmproxy/console/flowview.py
+++ b/mitmproxy/console/flowview.py
@@ -18,6 +18,7 @@ from mitmproxy.console import grideditor
from mitmproxy.console import searchable
from mitmproxy.console import signals
from mitmproxy.console import tabs
+from mitmproxy.flow import export
from netlib.http import Headers
from netlib.http import status_codes
@@ -74,8 +75,8 @@ def _mkhelp():
[("text", ": XML")]
),
("M", "change default body display mode"),
- ("p", "previous flow"),
- ("P", "copy request/response (content/headers) to clipboard"),
+ ("p", "export flow to file"),
+ ("P", "export flow to clipboard"),
("r", "replay request"),
("V", "revert changes to request"),
("v", "view body in external viewer"),
@@ -588,20 +589,6 @@ class FlowView(tabs.Tabs):
callback = self.master.save_one_flow,
args = (self.flow,)
)
- elif key == "E":
- signals.status_prompt_onekey.send(
- self,
- prompt = "Export",
- keys = (
- ("as curl command", "c"),
- ("as python code", "p"),
- ("as raw request", "r"),
- ("as locust code", "l"),
- ("as locust task", "t"),
- ),
- callback = common.export_prompt,
- args = (self.flow,)
- )
elif key == "|":
signals.status_prompt_path.send(
prompt = "Send flow to script",
@@ -609,7 +596,7 @@ class FlowView(tabs.Tabs):
args = (self.flow,)
)
- if not conn and key in set(list("befgmxvz")):
+ if not conn and key in set(list("befgmxvzpP")):
signals.status_message.send(
message = "Tab to the request or response",
expire = 1
@@ -662,12 +649,6 @@ class FlowView(tabs.Tabs):
)
signals.flow_change.send(self, flow = self.flow)
signals.status_message.send(message="")
- elif key == "P":
- if self.tab_offset == TAB_REQ:
- scope = "q"
- else:
- scope = "s"
- common.ask_copy_part(scope, self.flow, self.master, self.state)
elif key == "m":
p = list(contentviews.view_prompts)
p.insert(0, ("Clear", "C"))
@@ -678,6 +659,30 @@ class FlowView(tabs.Tabs):
callback = self.change_this_display_mode
)
key = None
+ elif key == "p":
+ if self.tab_offset == TAB_REQ:
+ scope = "q"
+ else:
+ scope = "s"
+ signals.status_prompt_onekey.send(
+ self,
+ prompt = "Export to file",
+ keys = [(e[0], e[1]) for e in export.EXPORTERS],
+ callback = common.export_to_clip_or_file,
+ args = (scope, self.flow, common.ask_save_path)
+ )
+ elif key == "P":
+ if self.tab_offset == TAB_REQ:
+ scope = "q"
+ else:
+ scope = "s"
+ signals.status_prompt_onekey.send(
+ self,
+ prompt = "Export to clipboard",
+ keys = [(e[0], e[1]) for e in export.EXPORTERS],
+ callback = common.export_to_clip_or_file,
+ args = (scope, self.flow, common.copy_to_clipboard_or_prompt)
+ )
elif key == "x":
signals.status_prompt_onekey.send(
prompt = "Delete body",