aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <Kriechi@users.noreply.github.com>2017-06-22 09:39:12 +0200
committerGitHub <noreply@github.com>2017-06-22 09:39:12 +0200
commitba38a120e410f47e85387fc50f25d93f5f0fd503 (patch)
tree02172e6489cc7104ac0af65775c7faa505cce3c8
parent6d284f5a2e6f208eadaf911840eb94a59e023109 (diff)
parent6380e74821e8e9304649513b993ed413330a767c (diff)
downloadmitmproxy-ba38a120e410f47e85387fc50f25d93f5f0fd503.tar.gz
mitmproxy-ba38a120e410f47e85387fc50f25d93f5f0fd503.tar.bz2
mitmproxy-ba38a120e410f47e85387fc50f25d93f5f0fd503.zip
Merge pull request #2406 from ujjwal96/tls-parser
Removed redundant type
-rw-r--r--mitmproxy/contrib/kaitaistruct/tls_client_hello.py9
-rw-r--r--mitmproxy/contrib/tls_client_hello.ksy7
-rw-r--r--mitmproxy/proxy/protocol/tls.py4
3 files changed, 4 insertions, 16 deletions
diff --git a/mitmproxy/contrib/kaitaistruct/tls_client_hello.py b/mitmproxy/contrib/kaitaistruct/tls_client_hello.py
index 6aff9b14..10e5367f 100644
--- a/mitmproxy/contrib/kaitaistruct/tls_client_hello.py
+++ b/mitmproxy/contrib/kaitaistruct/tls_client_hello.py
@@ -73,7 +73,7 @@ class TlsClientHello(KaitaiStruct):
self.len = self._io.read_u2be()
self.cipher_suites = [None] * (self.len // 2)
for i in range(self.len // 2):
- self.cipher_suites[i] = self._root.CipherSuite(self._io, self, self._root)
+ self.cipher_suites[i] = self._io.read_u2be()
class CompressionMethods(KaitaiStruct):
def __init__(self, _io, _parent=None, _root=None):
@@ -111,13 +111,6 @@ class TlsClientHello(KaitaiStruct):
self.major = self._io.read_u1()
self.minor = self._io.read_u1()
- class CipherSuite(KaitaiStruct):
- def __init__(self, _io, _parent=None, _root=None):
- self._io = _io
- self._parent = _parent
- self._root = _root if _root else self
- self.cipher_suite = self._io.read_u2be()
-
class Protocol(KaitaiStruct):
def __init__(self, _io, _parent=None, _root=None):
self._io = _io
diff --git a/mitmproxy/contrib/tls_client_hello.ksy b/mitmproxy/contrib/tls_client_hello.ksy
index 5b6eb0fb..921c11b5 100644
--- a/mitmproxy/contrib/tls_client_hello.ksy
+++ b/mitmproxy/contrib/tls_client_hello.ksy
@@ -59,14 +59,9 @@ types:
type: u2
- id: cipher_suites
- type: cipher_suite
+ type: u2
repeat: expr
repeat-expr: len/2
-
- cipher_suite:
- seq:
- - id: cipher_suite
- type: u2
compression_methods:
seq:
diff --git a/mitmproxy/proxy/protocol/tls.py b/mitmproxy/proxy/protocol/tls.py
index d42c7fdd..b7bc6b1c 100644
--- a/mitmproxy/proxy/protocol/tls.py
+++ b/mitmproxy/proxy/protocol/tls.py
@@ -539,8 +539,8 @@ class TlsLayer(base.Layer):
if not ciphers_server and self._client_tls:
ciphers_server = []
for id in self._client_hello.cipher_suites:
- if id.cipher_suite in CIPHER_ID_NAME_MAP.keys():
- ciphers_server.append(CIPHER_ID_NAME_MAP[id.cipher_suite])
+ if id in CIPHER_ID_NAME_MAP.keys():
+ ciphers_server.append(CIPHER_ID_NAME_MAP[id])
ciphers_server = ':'.join(ciphers_server)
self.server_conn.establish_ssl(