Resolved #582: display ClientConnection select cipher of TLS

This commit is contained in:
chhsiao90
2016-10-26 11:32:42 +08:00
parent 145c2892f7
commit 960f2e8bf0
4 changed files with 10 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
timestamp_ssl_setup: TLS established timestamp
timestamp_end: Connection end timestamp
sni: Server Name Indication sent by client during the TLS handshake
cipher_name: The current used cipher
"""
def __init__(self, client_connection, address, server):
@@ -42,6 +43,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
self.timestamp_ssl_setup = None
self.protocol = None
self.sni = None
self.cipher_name = None
def __bool__(self):
return bool(self.connection) and not self.finished
@@ -64,6 +66,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
timestamp_ssl_setup=float,
timestamp_end=float,
sni=str,
cipher_name=str,
)
def copy(self):
@@ -90,13 +93,15 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
timestamp_start=None,
timestamp_end=None,
timestamp_ssl_setup=None,
sni=None
sni=None,
cipher_name=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()
self.cipher_name = self.connection.get_cipher_name()
def finish(self):
super().finish()

View File

@@ -67,6 +67,7 @@ def convert_017_018(data):
def convert_018_019(data):
data["version"] = (0, 19)
data["client_conn"]["sni"] = None
data["client_conn"]["cipher_name"] = None
return data

View File

@@ -84,6 +84,8 @@ def flowdetails(state, flow):
]
if cc.sni:
parts.append(["Server Name Indication", cc.sni])
if cc.cipher_name:
parts.append(["Cipher Name", cc.cipher_name])
text.extend(
common.format_keyvals(parts, key="key", val="text", indent=4)

View File

@@ -133,6 +133,7 @@ def tclient_conn():
timestamp_ssl_setup=2,
timestamp_end=3,
sni="address",
cipher_name="cipher",
))
c.reply = controller.DummyReply()
return c