diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-08-30 02:27:38 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-08-30 02:27:38 +0200 |
commit | 1dd09a5509219e7390abbb8c0b6818c7e792daa1 (patch) | |
tree | ef1f433ebbcb05003b7648f8cabdfce7f2f00de5 /libmproxy/protocol2/tls.py | |
parent | dd7f50d64bef38fa67b4cace91913d03691dde26 (diff) | |
download | mitmproxy-1dd09a5509219e7390abbb8c0b6818c7e792daa1.tar.gz mitmproxy-1dd09a5509219e7390abbb8c0b6818c7e792daa1.tar.bz2 mitmproxy-1dd09a5509219e7390abbb8c0b6818c7e792daa1.zip |
always insert tls layer for inline script upgrades
Diffstat (limited to 'libmproxy/protocol2/tls.py')
-rw-r--r-- | libmproxy/protocol2/tls.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libmproxy/protocol2/tls.py b/libmproxy/protocol2/tls.py index 0c02b0ea..041adaaa 100644 --- a/libmproxy/protocol2/tls.py +++ b/libmproxy/protocol2/tls.py @@ -18,6 +18,9 @@ def is_tls_record_magic(d): False, otherwise. """ d = d[:3] + + # TLS ClientHello magic, works for SSLv3, TLSv1.0, TLSv1.1, TLSv1.2 + # http://www.moserware.com/2009/06/first-few-milliseconds-of-https.html#client-hello return ( len(d) == 3 and d[0] == '\x16' and @@ -73,6 +76,16 @@ class TlsLayer(Layer): layer = self.ctx.next_layer(self) layer() + def __repr__(self): + if self._client_tls and self._server_tls: + return "TlsLayer(client and server)" + elif self._client_tls: + return "TlsLayer(client)" + elif self._server_tls: + return "TlsLayer(server)" + else: + return "TlsLayer(inactive)" + def _get_client_hello(self): """ Peek into the socket and read all records that contain the initial client hello message. |