mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Show tls version on console
This commit is contained in:
parent
960f2e8bf0
commit
d52f35428c
@ -22,6 +22,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
|
|||||||
timestamp_end: Connection end timestamp
|
timestamp_end: Connection end timestamp
|
||||||
sni: Server Name Indication sent by client during the TLS handshake
|
sni: Server Name Indication sent by client during the TLS handshake
|
||||||
cipher_name: The current used cipher
|
cipher_name: The current used cipher
|
||||||
|
tls_version: TLS version
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, client_connection, address, server):
|
def __init__(self, client_connection, address, server):
|
||||||
@ -44,6 +45,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
|
|||||||
self.protocol = None
|
self.protocol = None
|
||||||
self.sni = None
|
self.sni = None
|
||||||
self.cipher_name = None
|
self.cipher_name = None
|
||||||
|
self.tls_version = None
|
||||||
|
|
||||||
def __bool__(self):
|
def __bool__(self):
|
||||||
return bool(self.connection) and not self.finished
|
return bool(self.connection) and not self.finished
|
||||||
@ -67,6 +69,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
|
|||||||
timestamp_end=float,
|
timestamp_end=float,
|
||||||
sni=str,
|
sni=str,
|
||||||
cipher_name=str,
|
cipher_name=str,
|
||||||
|
tls_version=str,
|
||||||
)
|
)
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
@ -95,6 +98,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
|
|||||||
timestamp_ssl_setup=None,
|
timestamp_ssl_setup=None,
|
||||||
sni=None,
|
sni=None,
|
||||||
cipher_name=None,
|
cipher_name=None,
|
||||||
|
tls_version=None,
|
||||||
))
|
))
|
||||||
|
|
||||||
def convert_to_ssl(self, *args, **kwargs):
|
def convert_to_ssl(self, *args, **kwargs):
|
||||||
@ -102,6 +106,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
|
|||||||
self.timestamp_ssl_setup = time.time()
|
self.timestamp_ssl_setup = time.time()
|
||||||
self.sni = self.connection.get_servername()
|
self.sni = self.connection.get_servername()
|
||||||
self.cipher_name = self.connection.get_cipher_name()
|
self.cipher_name = self.connection.get_cipher_name()
|
||||||
|
self.tls_version = self.connection.get_protocol_version_name()
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
super().finish()
|
super().finish()
|
||||||
|
@ -68,6 +68,7 @@ def convert_018_019(data):
|
|||||||
data["version"] = (0, 19)
|
data["version"] = (0, 19)
|
||||||
data["client_conn"]["sni"] = None
|
data["client_conn"]["sni"] = None
|
||||||
data["client_conn"]["cipher_name"] = None
|
data["client_conn"]["cipher_name"] = None
|
||||||
|
data["client_conn"]["tls_version"] = None
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,6 +82,8 @@ def flowdetails(state, flow):
|
|||||||
parts = [
|
parts = [
|
||||||
["Address", repr(cc.address)],
|
["Address", repr(cc.address)],
|
||||||
]
|
]
|
||||||
|
if cc.tls_version:
|
||||||
|
parts.append(["TLS Version", cc.tls_version])
|
||||||
if cc.sni:
|
if cc.sni:
|
||||||
parts.append(["Server Name Indication", cc.sni])
|
parts.append(["Server Name Indication", cc.sni])
|
||||||
if cc.cipher_name:
|
if cc.cipher_name:
|
||||||
|
@ -134,6 +134,7 @@ def tclient_conn():
|
|||||||
timestamp_end=3,
|
timestamp_end=3,
|
||||||
sni="address",
|
sni="address",
|
||||||
cipher_name="cipher",
|
cipher_name="cipher",
|
||||||
|
tls_version="TLSv1.2",
|
||||||
))
|
))
|
||||||
c.reply = controller.DummyReply()
|
c.reply = controller.DummyReply()
|
||||||
return c
|
return c
|
||||||
|
Loading…
Reference in New Issue
Block a user