mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Merge branch 'master' of github.com:mitmproxy/mitmproxy
This commit is contained in:
commit
5977e844e7
@ -67,10 +67,10 @@ def _mkhelp():
|
||||
("W", "save this flow"),
|
||||
("x", "delete body"),
|
||||
("z", "encode/decode a request/response"),
|
||||
("tab", "toggle request/response view"),
|
||||
("tab", "next tab"),
|
||||
("space", "next flow"),
|
||||
("|", "run script on this flow"),
|
||||
("/", "search in response body (case sensitive)"),
|
||||
("/", "search (case sensitive)"),
|
||||
("n", "repeat search forward"),
|
||||
("N", "repeat search backwards"),
|
||||
]
|
||||
@ -367,25 +367,25 @@ class FlowView(tabs.Tabs):
|
||||
self.set_query, message
|
||||
)
|
||||
)
|
||||
elif part == "u" and self.tab_offset == TAB_REQ:
|
||||
elif part == "u":
|
||||
signals.status_prompt.send(
|
||||
prompt = "URL",
|
||||
text = message.url,
|
||||
callback = self.set_url
|
||||
)
|
||||
elif part == "m" and self.tab_offset == TAB_REQ:
|
||||
elif part == "m":
|
||||
signals.status_prompt_onekey.send(
|
||||
prompt = "Method",
|
||||
keys = common.METHOD_OPTIONS,
|
||||
callback = self.edit_method
|
||||
)
|
||||
elif part == "c" and self.tab_offset == TAB_RESP:
|
||||
elif part == "c":
|
||||
signals.status_prompt.send(
|
||||
prompt = "Code",
|
||||
text = str(message.code),
|
||||
callback = self.set_resp_code
|
||||
)
|
||||
elif part == "m" and self.tab_offset == TAB_RESP:
|
||||
elif part == "m":
|
||||
signals.status_prompt.send(
|
||||
prompt = "Message",
|
||||
text = message.msg,
|
||||
@ -441,8 +441,10 @@ class FlowView(tabs.Tabs):
|
||||
key = common.shortcuts(key)
|
||||
if self.tab_offset == TAB_REQ:
|
||||
conn = self.flow.request
|
||||
else:
|
||||
elif self.tab_offset == TAB_RESP:
|
||||
conn = self.flow.response
|
||||
else:
|
||||
conn = None
|
||||
|
||||
if key == "q":
|
||||
signals.pop_view_state.send(self)
|
||||
@ -456,11 +458,6 @@ class FlowView(tabs.Tabs):
|
||||
elif key == "A":
|
||||
self.master.accept_all()
|
||||
self.master.view_flow(self.flow)
|
||||
elif key == "b":
|
||||
if self.tab_offset == TAB_REQ:
|
||||
common.ask_save_body("q", self.master, self.state, self.flow)
|
||||
else:
|
||||
common.ask_save_body("s", self.master, self.state, self.flow)
|
||||
elif key == "d":
|
||||
if self.state.flow_count() == 1:
|
||||
self.master.view_flowlist()
|
||||
@ -475,6 +472,44 @@ class FlowView(tabs.Tabs):
|
||||
f = self.master.duplicate_flow(self.flow)
|
||||
self.master.view_flow(f)
|
||||
signals.status_message.send(message="Duplicated.")
|
||||
elif key == "p":
|
||||
self.view_prev_flow(self.flow)
|
||||
elif key == "r":
|
||||
r = self.master.replay_request(self.flow)
|
||||
if r:
|
||||
signals.status_message.send(message=r)
|
||||
signals.flow_change.send(self, flow = self.flow)
|
||||
elif key == "V":
|
||||
if not self.flow.modified():
|
||||
signals.status_message.send(message="Flow not modified.")
|
||||
return
|
||||
self.state.revert(self.flow)
|
||||
signals.flow_change.send(self, flow = self.flow)
|
||||
signals.status_message.send(message="Reverted.")
|
||||
elif key == "W":
|
||||
signals.status_prompt_path.send(
|
||||
prompt = "Save this flow",
|
||||
callback = self.master.save_one_flow,
|
||||
args = (self.flow,)
|
||||
)
|
||||
elif key == "|":
|
||||
signals.status_prompt_path.send(
|
||||
prompt = "Send flow to script",
|
||||
callback = self.master.run_script_once,
|
||||
args = (self.flow,)
|
||||
)
|
||||
|
||||
if not conn and key in "befgmxvz":
|
||||
signals.status_message.send(
|
||||
message = "Tab to the request or response",
|
||||
expire = 1
|
||||
)
|
||||
elif conn:
|
||||
if key == "b":
|
||||
if self.tab_offset == TAB_REQ:
|
||||
common.ask_save_body("q", self.master, self.state, self.flow)
|
||||
else:
|
||||
common.ask_save_body("s", self.master, self.state, self.flow)
|
||||
elif key == "e":
|
||||
if self.tab_offset == TAB_REQ:
|
||||
signals.status_prompt_onekey.send(
|
||||
@ -506,7 +541,7 @@ class FlowView(tabs.Tabs):
|
||||
signals.status_message.send(message="Loading all body data...")
|
||||
self.state.add_flow_setting(
|
||||
self.flow,
|
||||
(self.tab_state, "fullcontents"),
|
||||
(self.tab_offset, "fullcontents"),
|
||||
True
|
||||
)
|
||||
signals.flow_change.send(self, flow = self.flow)
|
||||
@ -527,42 +562,6 @@ class FlowView(tabs.Tabs):
|
||||
callback = self.change_this_display_mode
|
||||
)
|
||||
key = None
|
||||
elif key == "p":
|
||||
self.view_prev_flow(self.flow)
|
||||
elif key == "r":
|
||||
r = self.master.replay_request(self.flow)
|
||||
if r:
|
||||
signals.status_message.send(message=r)
|
||||
signals.flow_change.send(self, flow = self.flow)
|
||||
elif key == "V":
|
||||
if not self.flow.modified():
|
||||
signals.status_message.send(message="Flow not modified.")
|
||||
return
|
||||
self.state.revert(self.flow)
|
||||
signals.flow_change.send(self, flow = self.flow)
|
||||
signals.status_message.send(message="Reverted.")
|
||||
elif key == "W":
|
||||
signals.status_prompt_path.send(
|
||||
prompt = "Save this flow",
|
||||
callback = self.master.save_one_flow,
|
||||
args = (self.flow,)
|
||||
)
|
||||
elif key == "v":
|
||||
if conn and conn.content:
|
||||
t = conn.headers["content-type"] or [None]
|
||||
t = t[0]
|
||||
if os.environ.has_key("EDITOR") or os.environ.has_key("PAGER"):
|
||||
self.master.spawn_external_viewer(conn.content, t)
|
||||
else:
|
||||
signals.status_message.send(
|
||||
message = "Error! Set $EDITOR or $PAGER."
|
||||
)
|
||||
elif key == "|":
|
||||
signals.status_prompt_path.send(
|
||||
prompt = "Send flow to script",
|
||||
callback = self.master.run_script_once,
|
||||
args = (self.flow,)
|
||||
)
|
||||
elif key == "x":
|
||||
signals.status_prompt_onekey.send(
|
||||
prompt = "Delete body",
|
||||
@ -573,8 +572,17 @@ class FlowView(tabs.Tabs):
|
||||
callback = self.delete_body
|
||||
)
|
||||
key = None
|
||||
elif key == "v":
|
||||
if conn.content:
|
||||
t = conn.headers["content-type"] or [None]
|
||||
t = t[0]
|
||||
if os.environ.has_key("EDITOR") or os.environ.has_key("PAGER"):
|
||||
self.master.spawn_external_viewer(conn.content, t)
|
||||
else:
|
||||
signals.status_message.send(
|
||||
message = "Error! Set $EDITOR or $PAGER."
|
||||
)
|
||||
elif key == "z":
|
||||
if conn:
|
||||
self.flow.backup()
|
||||
e = conn.headers.get_first("content-encoding", "identity")
|
||||
if e != "identity":
|
||||
@ -595,6 +603,8 @@ class FlowView(tabs.Tabs):
|
||||
signals.flow_change.send(self, flow = self.flow)
|
||||
else:
|
||||
return super(self.__class__, self).keypress(size, key)
|
||||
else:
|
||||
return super(self.__class__, self).keypress(size, key)
|
||||
|
||||
def encode_callback(self, key, conn):
|
||||
encoding_map = {
|
||||
|
Loading…
Reference in New Issue
Block a user