From 6380e74821e8e9304649513b993ed413330a767c Mon Sep 17 00:00:00 2001 From: Ujjwal Verma Date: Thu, 22 Jun 2017 06:28:11 +0530 Subject: [PATCH] Removed redundant type --- mitmproxy/contrib/kaitaistruct/tls_client_hello.py | 9 +-------- mitmproxy/contrib/tls_client_hello.ksy | 7 +------ mitmproxy/proxy/protocol/tls.py | 4 ++-- 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 6aff9b142..10e5367fa 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 5b6eb0fb9..921c11b5b 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 d42c7fdd2..b7bc6b1c8 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(