From 4b04566a345eb570e5c5a0ee1854310d8e5e8358 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Tue, 22 Nov 2016 22:22:56 +0100 Subject: add metadata info to flow detail view --- mitmproxy/proxy/protocol/websocket.py | 1 - mitmproxy/tools/console/flowdetailview.py | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mitmproxy/proxy/protocol/websocket.py b/mitmproxy/proxy/protocol/websocket.py index 45bc5a20..69eb898f 100644 --- a/mitmproxy/proxy/protocol/websocket.py +++ b/mitmproxy/proxy/protocol/websocket.py @@ -76,7 +76,6 @@ class WebSocketLayer(base.Layer): websocket_message = t(self.flow, not is_server, payload) self.flow.messages.append(websocket_message) - self.log("WebSocket message: {}".format(websocket_message.info), "info") self.channel.ask("websocket_message", self.flow) # chunk payload into multiple 10kB frames, and send them diff --git a/mitmproxy/tools/console/flowdetailview.py b/mitmproxy/tools/console/flowdetailview.py index 6e6ca1eb..7677efe4 100644 --- a/mitmproxy/tools/console/flowdetailview.py +++ b/mitmproxy/tools/console/flowdetailview.py @@ -14,10 +14,16 @@ def maybe_timestamp(base, attr): def flowdetails(state, flow): text = [] - cc = flow.client_conn sc = flow.server_conn + cc = flow.client_conn req = flow.request resp = flow.response + metadata = flow.metadata + + if metadata is not None and len(metadata.items()) > 0: + parts = [[str(k), repr(v)] for k, v in metadata.items()] + text.append(urwid.Text([("head", "Metadata:")])) + text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) if sc is not None: text.append(urwid.Text([("head", "Server Connection:")])) @@ -109,6 +115,7 @@ def flowdetails(state, flow): maybe_timestamp(cc, "timestamp_ssl_setup") ] ) + if sc is not None and sc.timestamp_start: parts.append( [ @@ -129,6 +136,7 @@ def flowdetails(state, flow): maybe_timestamp(sc, "timestamp_ssl_setup") ] ) + if req is not None and req.timestamp_start: parts.append( [ @@ -142,6 +150,7 @@ def flowdetails(state, flow): maybe_timestamp(req, "timestamp_end") ] ) + if resp is not None and resp.timestamp_start: parts.append( [ @@ -162,4 +171,5 @@ def flowdetails(state, flow): text.append(urwid.Text([("head", "Timing:")])) text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) + return searchable.Searchable(state, text) -- cgit v1.2.3