From 91e5a4a4b5bf1beb083afb0731294cfeaca62944 Mon Sep 17 00:00:00 2001 From: Marcelo Glezer Date: Mon, 2 Mar 2015 18:30:46 -0300 Subject: #487 added microsecond support to format_timestamp and used in FlowDetailView. Still WIP. --- libmproxy/console/flowdetailview.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libmproxy/console') diff --git a/libmproxy/console/flowdetailview.py b/libmproxy/console/flowdetailview.py index 51ae8da6..d0326f1a 100644 --- a/libmproxy/console/flowdetailview.py +++ b/libmproxy/console/flowdetailview.py @@ -40,8 +40,8 @@ class FlowDetailsView(urwid.ListBox): sc = self.flow.server_conn parts = [ ["Address", "%s:%s" % sc.address()], - ["Start time", utils.format_timestamp(sc.timestamp_start)], - ["End time", utils.format_timestamp(sc.timestamp_end) if sc.timestamp_end else "active"], + ["Start time", utils.format_timestamp(sc.timestamp_start, True)], + ["End time", utils.format_timestamp(sc.timestamp_end, True) if sc.timestamp_end else "active"], ] text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) @@ -84,10 +84,10 @@ class FlowDetailsView(urwid.ListBox): cc = self.flow.client_conn parts = [ ["Address", "%s:%s" % cc.address()], - ["Start time", utils.format_timestamp(cc.timestamp_start)], + ["Start time", utils.format_timestamp(cc.timestamp_start, True)], # ["Requests", "%s"%cc.requestcount], - ["End time", utils.format_timestamp(cc.timestamp_end) if cc.timestamp_end else "active"], + ["End time", utils.format_timestamp(cc.timestamp_end, True) if cc.timestamp_end else "active"], ] text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) - + return text -- cgit v1.2.3 From 58dba3f49083288e19f6e9edb7cc60e88dd446e3 Mon Sep 17 00:00:00 2001 From: Marcelo Glezer Date: Mon, 2 Mar 2015 23:22:44 -0300 Subject: fixed formatting and added a 'test' (sort of) --- libmproxy/console/flowdetailview.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libmproxy/console') diff --git a/libmproxy/console/flowdetailview.py b/libmproxy/console/flowdetailview.py index d0326f1a..e1339d77 100644 --- a/libmproxy/console/flowdetailview.py +++ b/libmproxy/console/flowdetailview.py @@ -40,8 +40,8 @@ class FlowDetailsView(urwid.ListBox): sc = self.flow.server_conn parts = [ ["Address", "%s:%s" % sc.address()], - ["Start time", utils.format_timestamp(sc.timestamp_start, True)], - ["End time", utils.format_timestamp(sc.timestamp_end, True) if sc.timestamp_end else "active"], + ["Start time", utils.format_timestamp_with_milli(sc.timestamp_start)], + ["End time", utils.format_timestamp_with_milli(sc.timestamp_end) if sc.timestamp_end else "active"], ] text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) @@ -84,9 +84,9 @@ class FlowDetailsView(urwid.ListBox): cc = self.flow.client_conn parts = [ ["Address", "%s:%s" % cc.address()], - ["Start time", utils.format_timestamp(cc.timestamp_start, True)], + ["Start time", utils.format_timestamp_with_milli(cc.timestamp_start)], # ["Requests", "%s"%cc.requestcount], - ["End time", utils.format_timestamp(cc.timestamp_end, True) if cc.timestamp_end else "active"], + ["End time", utils.format_timestamp_with_milli(cc.timestamp_end) if cc.timestamp_end else "active"], ] text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) -- cgit v1.2.3 From f514eacd7a7aca1eb406cab79c92f730f5143fc4 Mon Sep 17 00:00:00 2001 From: Marcelo Glezer Date: Tue, 3 Mar 2015 00:44:31 -0300 Subject: added timing information to FlowDetailView --- libmproxy/console/flowdetailview.py | 40 +++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'libmproxy/console') diff --git a/libmproxy/console/flowdetailview.py b/libmproxy/console/flowdetailview.py index e1339d77..301be9b8 100644 --- a/libmproxy/console/flowdetailview.py +++ b/libmproxy/console/flowdetailview.py @@ -35,14 +35,37 @@ class FlowDetailsView(urwid.ListBox): title = urwid.AttrWrap(title, "heading") text.append(title) - if self.flow.server_conn: + cc = self.flow.client_conn + sc = self.flow.server_conn + req = self.flow.request; + resp = self.flow.response; + + timing_parts = [] + if cc: + timing_parts.append(["Client conn. established", utils.format_timestamp_with_milli(cc.timestamp_start) if cc.timestamp_start else "active"]) + if sc: + timing_parts.append(["Server conn. initiated", utils.format_timestamp_with_milli(sc.timestamp_start)]) + timing_parts.append(["Server conn. TCP handshake", utils.format_timestamp_with_milli(sc.timestamp_tcp_setup) if sc.timestamp_tcp_setup else "active"]) + if sc.ssl_established: + timing_parts.append(["Server conn. SSL handshake", utils.format_timestamp_with_milli(sc.timestamp_ssl_setup) if sc.timestamp_ssl_setup else "active"]) + if cc: + if sc.ssl_established: + timing_parts.append(["Client conn. SSL handshake", utils.format_timestamp_with_milli(cc.timestamp_ssl_setup) if cc.timestamp_ssl_setup else "active"]) + + timing_parts.append(["First request byte", utils.format_timestamp_with_milli(req.timestamp_start)]) + timing_parts.append(["Request complete", utils.format_timestamp_with_milli(req.timestamp_end) if req.timestamp_end else "active"]) + + if resp: + timing_parts.append(["First response byte", utils.format_timestamp_with_milli(resp.timestamp_start)]) + timing_parts.append(["response complete", utils.format_timestamp_with_milli(resp.timestamp_end) if resp.timestamp_end else "active"]) + + + if sc: text.append(urwid.Text([("head", "Server Connection:")])) - sc = self.flow.server_conn parts = [ ["Address", "%s:%s" % sc.address()], - ["Start time", utils.format_timestamp_with_milli(sc.timestamp_start)], - ["End time", utils.format_timestamp_with_milli(sc.timestamp_end) if sc.timestamp_end else "active"], ] + text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) c = self.flow.server_conn.cert @@ -79,15 +102,16 @@ class FlowDetailsView(urwid.ListBox): ) text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) - if self.flow.client_conn: + if cc: text.append(urwid.Text([("head", "Client Connection:")])) - cc = self.flow.client_conn + parts = [ ["Address", "%s:%s" % cc.address()], - ["Start time", utils.format_timestamp_with_milli(cc.timestamp_start)], # ["Requests", "%s"%cc.requestcount], - ["End time", utils.format_timestamp_with_milli(cc.timestamp_end) if cc.timestamp_end else "active"], ] + text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) + text.append(urwid.Text([("head", "Timing:")])) + text.extend(common.format_keyvals(timing_parts, key="key", val="text", indent=4)) return text -- cgit v1.2.3 From 8a672b7955a4a1bc3268755022afd2ca0e05e283 Mon Sep 17 00:00:00 2001 From: Marcelo Glezer Date: Tue, 3 Mar 2015 00:55:23 -0300 Subject: minor refactor --- libmproxy/console/flowdetailview.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'libmproxy/console') diff --git a/libmproxy/console/flowdetailview.py b/libmproxy/console/flowdetailview.py index 301be9b8..8f1f013e 100644 --- a/libmproxy/console/flowdetailview.py +++ b/libmproxy/console/flowdetailview.py @@ -48,9 +48,9 @@ class FlowDetailsView(urwid.ListBox): timing_parts.append(["Server conn. TCP handshake", utils.format_timestamp_with_milli(sc.timestamp_tcp_setup) if sc.timestamp_tcp_setup else "active"]) if sc.ssl_established: timing_parts.append(["Server conn. SSL handshake", utils.format_timestamp_with_milli(sc.timestamp_ssl_setup) if sc.timestamp_ssl_setup else "active"]) - if cc: - if sc.ssl_established: - timing_parts.append(["Client conn. SSL handshake", utils.format_timestamp_with_milli(cc.timestamp_ssl_setup) if cc.timestamp_ssl_setup else "active"]) + + if cc and sc.ssl_established: + timing_parts.append(["Client conn. SSL handshake", utils.format_timestamp_with_milli(cc.timestamp_ssl_setup) if cc.timestamp_ssl_setup else "active"]) timing_parts.append(["First request byte", utils.format_timestamp_with_milli(req.timestamp_start)]) timing_parts.append(["Request complete", utils.format_timestamp_with_milli(req.timestamp_end) if req.timestamp_end else "active"]) @@ -59,7 +59,6 @@ class FlowDetailsView(urwid.ListBox): timing_parts.append(["First response byte", utils.format_timestamp_with_milli(resp.timestamp_start)]) timing_parts.append(["response complete", utils.format_timestamp_with_milli(resp.timestamp_end) if resp.timestamp_end else "active"]) - if sc: text.append(urwid.Text([("head", "Server Connection:")])) parts = [ @@ -68,7 +67,7 @@ class FlowDetailsView(urwid.ListBox): text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) - c = self.flow.server_conn.cert + c = sc.cert if c: text.append(urwid.Text([("head", "Server Certificate:")])) parts = [ -- cgit v1.2.3 From b49d573c8ba2aac2f2ec9082c9982cc097a094b9 Mon Sep 17 00:00:00 2001 From: Marcelo Glezer Date: Tue, 3 Mar 2015 18:38:16 -0300 Subject: sorted timing information by timestamp --- libmproxy/console/flowdetailview.py | 39 +++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'libmproxy/console') diff --git a/libmproxy/console/flowdetailview.py b/libmproxy/console/flowdetailview.py index 8f1f013e..1299443d 100644 --- a/libmproxy/console/flowdetailview.py +++ b/libmproxy/console/flowdetailview.py @@ -40,25 +40,6 @@ class FlowDetailsView(urwid.ListBox): req = self.flow.request; resp = self.flow.response; - timing_parts = [] - if cc: - timing_parts.append(["Client conn. established", utils.format_timestamp_with_milli(cc.timestamp_start) if cc.timestamp_start else "active"]) - if sc: - timing_parts.append(["Server conn. initiated", utils.format_timestamp_with_milli(sc.timestamp_start)]) - timing_parts.append(["Server conn. TCP handshake", utils.format_timestamp_with_milli(sc.timestamp_tcp_setup) if sc.timestamp_tcp_setup else "active"]) - if sc.ssl_established: - timing_parts.append(["Server conn. SSL handshake", utils.format_timestamp_with_milli(sc.timestamp_ssl_setup) if sc.timestamp_ssl_setup else "active"]) - - if cc and sc.ssl_established: - timing_parts.append(["Client conn. SSL handshake", utils.format_timestamp_with_milli(cc.timestamp_ssl_setup) if cc.timestamp_ssl_setup else "active"]) - - timing_parts.append(["First request byte", utils.format_timestamp_with_milli(req.timestamp_start)]) - timing_parts.append(["Request complete", utils.format_timestamp_with_milli(req.timestamp_end) if req.timestamp_end else "active"]) - - if resp: - timing_parts.append(["First response byte", utils.format_timestamp_with_milli(resp.timestamp_start)]) - timing_parts.append(["response complete", utils.format_timestamp_with_milli(resp.timestamp_end) if resp.timestamp_end else "active"]) - if sc: text.append(urwid.Text([("head", "Server Connection:")])) parts = [ @@ -110,7 +91,23 @@ class FlowDetailsView(urwid.ListBox): ] text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) - + + parts = [] + + parts.append(["Client conn. established", utils.format_timestamp_with_milli(cc.timestamp_start) if (cc and cc.timestamp_start) else "active"]) + parts.append(["Server conn. initiated", utils.format_timestamp_with_milli(sc.timestamp_start) if sc else "active" ]) + parts.append(["Server conn. TCP handshake", utils.format_timestamp_with_milli(sc.timestamp_tcp_setup) if (sc and sc.timestamp_tcp_setup) else "active"]) + if sc.ssl_established: + parts.append(["Server conn. SSL handshake", utils.format_timestamp_with_milli(sc.timestamp_ssl_setup) if sc.timestamp_ssl_setup else "active"]) + parts.append(["Client conn. SSL handshake", utils.format_timestamp_with_milli(cc.timestamp_ssl_setup) if (cc and cc.timestamp_ssl_setup) else "active"]) + parts.append(["First request byte", utils.format_timestamp_with_milli(req.timestamp_start)]) + parts.append(["Request complete", utils.format_timestamp_with_milli(req.timestamp_end) if req.timestamp_end else "active"]) + parts.append(["First response byte", utils.format_timestamp_with_milli(resp.timestamp_start) if resp else "active"]) + parts.append(["Response complete", utils.format_timestamp_with_milli(resp.timestamp_end) if (resp and resp.timestamp_end) else "active"]) + + # sort operations by timestamp + parts = sorted(parts, key=lambda p: p[1]) + text.append(urwid.Text([("head", "Timing:")])) - text.extend(common.format_keyvals(timing_parts, key="key", val="text", indent=4)) + text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) return text -- cgit v1.2.3 From 48023db59e048da20484ca631d41aa524425f5dd Mon Sep 17 00:00:00 2001 From: Tarashish Mishra Date: Wed, 4 Mar 2015 22:32:01 +0530 Subject: Minor refactor to PR #496 --- libmproxy/console/flowdetailview.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libmproxy/console') diff --git a/libmproxy/console/flowdetailview.py b/libmproxy/console/flowdetailview.py index 1299443d..4164c416 100644 --- a/libmproxy/console/flowdetailview.py +++ b/libmproxy/console/flowdetailview.py @@ -37,15 +37,15 @@ class FlowDetailsView(urwid.ListBox): cc = self.flow.client_conn sc = self.flow.server_conn - req = self.flow.request; - resp = self.flow.response; + req = self.flow.request + resp = self.flow.response if sc: text.append(urwid.Text([("head", "Server Connection:")])) parts = [ ["Address", "%s:%s" % sc.address()], ] - + text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) c = sc.cert @@ -89,7 +89,7 @@ class FlowDetailsView(urwid.ListBox): ["Address", "%s:%s" % cc.address()], # ["Requests", "%s"%cc.requestcount], ] - + text.extend(common.format_keyvals(parts, key="key", val="text", indent=4)) parts = [] @@ -105,7 +105,7 @@ class FlowDetailsView(urwid.ListBox): parts.append(["First response byte", utils.format_timestamp_with_milli(resp.timestamp_start) if resp else "active"]) parts.append(["Response complete", utils.format_timestamp_with_milli(resp.timestamp_end) if (resp and resp.timestamp_end) else "active"]) - # sort operations by timestamp + # sort operations by timestamp parts = sorted(parts, key=lambda p: p[1]) text.append(urwid.Text([("head", "Timing:")])) -- cgit v1.2.3