aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-10-24 19:56:05 -0700
committerGitHub <noreply@github.com>2016-10-24 19:56:05 -0700
commit145c2892f720300020fdeec8a257c3247c8dff5b (patch)
tree132b3ecc01421ca914e17a076d657d4478f37dca
parentef4e9b2b855337b61a18ecdfbeaad3bb6a011af4 (diff)
parent39ac29e37c25b998f4fca48d980b5e09907f2566 (diff)
downloadmitmproxy-145c2892f720300020fdeec8a257c3247c8dff5b.tar.gz
mitmproxy-145c2892f720300020fdeec8a257c3247c8dff5b.tar.bz2
mitmproxy-145c2892f720300020fdeec8a257c3247c8dff5b.zip
Merge pull request #1664 from chhsiao90/sni-display-#1639
Resolved #1639: display sni on ClientConnection
-rw-r--r--mitmproxy/connections.py7
-rw-r--r--mitmproxy/io_compat.py1
-rw-r--r--mitmproxy/tools/console/flowdetailview.py2
-rw-r--r--test/mitmproxy/tutils.py1
4 files changed, 10 insertions, 1 deletions
diff --git a/mitmproxy/connections.py b/mitmproxy/connections.py
index 015d0689..1c35ec7f 100644
--- a/mitmproxy/connections.py
+++ b/mitmproxy/connections.py
@@ -20,6 +20,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
timestamp_start: Connection start timestamp
timestamp_ssl_setup: TLS established timestamp
timestamp_end: Connection end timestamp
+ sni: Server Name Indication sent by client during the TLS handshake
"""
def __init__(self, client_connection, address, server):
@@ -40,6 +41,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
self.timestamp_end = None
self.timestamp_ssl_setup = None
self.protocol = None
+ self.sni = None
def __bool__(self):
return bool(self.connection) and not self.finished
@@ -61,6 +63,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
timestamp_start=float,
timestamp_ssl_setup=float,
timestamp_end=float,
+ sni=str,
)
def copy(self):
@@ -86,12 +89,14 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
ssl_established=False,
timestamp_start=None,
timestamp_end=None,
- timestamp_ssl_setup=None
+ timestamp_ssl_setup=None,
+ sni=None
))
def convert_to_ssl(self, *args, **kwargs):
super().convert_to_ssl(*args, **kwargs)
self.timestamp_ssl_setup = time.time()
+ self.sni = self.connection.get_servername()
def finish(self):
super().finish()
diff --git a/mitmproxy/io_compat.py b/mitmproxy/io_compat.py
index 68c747ea..ea0e2dee 100644
--- a/mitmproxy/io_compat.py
+++ b/mitmproxy/io_compat.py
@@ -66,6 +66,7 @@ def convert_017_018(data):
def convert_018_019(data):
data["version"] = (0, 19)
+ data["client_conn"]["sni"] = None
return data
diff --git a/mitmproxy/tools/console/flowdetailview.py b/mitmproxy/tools/console/flowdetailview.py
index 7591c3d1..a3f07cd5 100644
--- a/mitmproxy/tools/console/flowdetailview.py
+++ b/mitmproxy/tools/console/flowdetailview.py
@@ -82,6 +82,8 @@ def flowdetails(state, flow):
parts = [
["Address", repr(cc.address)],
]
+ if cc.sni:
+ parts.append(["Server Name Indication", cc.sni])
text.extend(
common.format_keyvals(parts, key="key", val="text", indent=4)
diff --git a/test/mitmproxy/tutils.py b/test/mitmproxy/tutils.py
index c83223f6..9db65e00 100644
--- a/test/mitmproxy/tutils.py
+++ b/test/mitmproxy/tutils.py
@@ -132,6 +132,7 @@ def tclient_conn():
timestamp_start=1,
timestamp_ssl_setup=2,
timestamp_end=3,
+ sni="address",
))
c.reply = controller.DummyReply()
return c