diff options
-rw-r--r-- | libmproxy/console/common.py | 7 | ||||
-rw-r--r-- | libmproxy/console/flowlist.py | 8 | ||||
-rw-r--r-- | libmproxy/protocol/primitives.py | 7 |
3 files changed, 22 insertions, 0 deletions
diff --git a/libmproxy/console/common.py b/libmproxy/console/common.py index e5bebf7f..584b7475 100644 --- a/libmproxy/console/common.py +++ b/libmproxy/console/common.py @@ -115,6 +115,7 @@ def fcol(s, attr): if urwid.util.detected_encoding: SYMBOL_REPLAY = u"\u21ba" SYMBOL_RETURN = u"\u2190" + SYMBOL_MARK = "===" else: SYMBOL_REPLAY = u"[r]" SYMBOL_RETURN = u"<-" @@ -133,6 +134,10 @@ def raw_format_flow(f, focus, extended, padding): ) else: req.append(fcol(">>" if focus else " ", "focus")) + + if f["marked"]: + req.append(fcol(SYMBOL_MARK, "mark")) + if f["req_is_replay"]: req.append(fcol(SYMBOL_REPLAY, "replay")) req.append(fcol(f["req_method"], "method")) @@ -384,6 +389,8 @@ def format_flow(f, focus, extended=False, hostheader=False, padding=2): err_msg = f.error.msg if f.error else None, resp_code = f.response.code if f.response else None, + + marked = f.marked, ) if f.response: if f.response.content: diff --git a/libmproxy/console/flowlist.py b/libmproxy/console/flowlist.py index 39245984..8bb6f87a 100644 --- a/libmproxy/console/flowlist.py +++ b/libmproxy/console/flowlist.py @@ -17,6 +17,7 @@ def _mkhelp(): ("F", "toggle follow flow list"), ("l", "set limit filter pattern"), ("L", "load saved flows"), + ("m", "toggle flow mark"), ("n", "create a new request"), ("P", "copy flow to clipboard"), ("r", "replay request"), @@ -177,6 +178,13 @@ class ConnectionItem(urwid.WidgetWrap): elif key == "D": f = self.master.duplicate_flow(self.flow) self.master.view_flow(f) + elif key == "m": + self.flow.toggle_mark() + signals.flowlist_change.send(self) + if self.flow.marked: + signals.status_message.send(message="Flow is now marked") + else: + signals.status_message.send(message="Flow is now not marked") elif key == "r": r = self.master.replay_request(self.flow) if r: diff --git a/libmproxy/protocol/primitives.py b/libmproxy/protocol/primitives.py index 2f8ea3e0..1d2389c3 100644 --- a/libmproxy/protocol/primitives.py +++ b/libmproxy/protocol/primitives.py @@ -77,6 +77,7 @@ class Flow(stateobject.StateObject): """@type: bool""" self._backup = None self.reply = None + self.marked = False _stateobject_attributes = dict( id=str, @@ -165,6 +166,12 @@ class Flow(stateobject.StateObject): self.intercepted = False self.reply() master.handle_accept_intercept(self) + + def toggle_mark(self): + if self.marked: + self.marked = False + else: + self.marked = True class ProtocolHandler(object): |