# Copyright (c) 2016 Hubert Kario # Released under Mozilla Public License Version 2.0 """Typical Client Hello messages sent by different clients.""" import random from tlslite.messages import ClientHello from tlslite.constants import \ ECPointFormat, HashAlgorithm, SignatureAlgorithm from tlslite.mathtls import goodGroupParameters from tlslite.extensions import SNIExtension, SupportedGroupsExtension, \ TLSExtension, SignatureAlgorithmsExtension, NPNExtension, \ ECPointFormatsExtension, PaddingExtension from tlslite.utils.cryptomath import numberToByteArray from tlslite.utils.ecc import getCurveByName, encodeX962Point from tlslite.utils.cryptomath import powMod from .constants import CipherSuite, ExtensionType, GroupName from .extensions import KeyShareExtension class HelloConfig(object): """Base object for all Client Hello configurations.""" def __init__(self): """Initialize object with default settings.""" self._name = None self.modifications = [] self.callbacks = [] self.version = (3, 3) self.record_version = (3, 0) self.ciphers = [] self.extensions = None self.random = None self.session_id = bytearray(0) self.compression_methods = [0] self.ssl2 = False @property def name(self): """Return the name of config with all the modifications applied.""" if self.modifications: return "{0} ({1})".format(self._name, ", ".join(self.modifications)) else: return self._name @name.setter def name(self, value): """Set the base name of the configuration.""" self._name = value def __call__(self, hostname): """Generate a client hello object, use hostname in SNI extension.""" # SNI is special in that we don't want to send it if it is empty if self.extensions: sni = next((x for x in self.extensions if isinstance(x, SNIExtension)), None) if sni: if hostname is not None: if sni.serverNames is None: sni.serverNames = [] sni.hostNames = [hostname] else: # but if we were not provided with a host name, we want # to remove empty extension if sni.serverNames is None: self.extensions = [x for x in self.extensions if not isinstance(x, SNIExtension)] if self.random: rand = self.random else: # we're not doing any crypto with it, just need "something" # TODO: place unix time at the beginning rand = numberToByteArray(random.getrandbits(256), 32) ch = ClientHello(self.ssl2).create(self.version, rand, self.session_id, self.ciphers, extensions=self.extensions) ch.compression_methods = self.compression_methods for cb in self.callbacks: ch = cb(ch) return ch class Firefox_42(HelloConfig): """Create Client Hello like Firefox 42.""" def __init__(self): """Set the configuration to Firefox 42.""" super(Firefox_42, self).__init__() self._name = "Firefox 42" self.version = (3, 3) self.record_version = (3, 1) self.ciphers = [CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_DHE_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA] ext = self.extensions = [] ext.append(SNIExtension()) ext.append(TLSExtension(extType=ExtensionType.renegotiation_info) .create(bytearray(1))) ext.append(SupportedGroupsExtension().create([GroupName.secp256r1, GroupName.secp384r1, GroupName.secp521r1])) ext.append(ECPointFormatsExtension() .create([ECPointFormat.uncompressed])) ext.append(TLSExtension(extType=ExtensionType.session_ticket)) ext.append(NPNExtension()) ext.append(TLSExtension(extType=ExtensionType.alpn) .create(bytearray(b'\x00\x15' + b'\x02' + b'h2' + b'\x08' + b'spdy/3.1' + b'\x08' + b'http/1.1'))) ext.append(TLSExtension(extType=ExtensionType.status_request) .create(bytearray(b'\x01' + b'\x00\x00' + b'\x00\x00'))) sig_algs = [] for alg in ['sha256', 'sha384', 'sha512', 'sha1']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.rsa)) for alg in ['sha256', 'sha384', 'sha512', 'sha1']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.ecdsa)) for alg in ['sha256', 'sha1']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.dsa)) ext.append(SignatureAlgorithmsExtension() .create(sig_algs)) class Firefox_46(HelloConfig): """Create ClientHello like Firefox 46""" # verified by packet capture def __init__(self): super(Firefox_46, self).__init__() self._name = "Firefox 46" self.version = (3, 3) self.record_version = (3, 1) self.ciphers = [CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_DHE_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA] ext = self.extensions = [] ext.append(SNIExtension()) ext.append(TLSExtension(extType=ExtensionType.extended_master_secret)) ext.append(TLSExtension(extType=ExtensionType.renegotiation_info) .create(bytearray(1))) ext.append(SupportedGroupsExtension().create([GroupName.secp256r1, GroupName.secp384r1, GroupName.secp521r1])) ext.append(ECPointFormatsExtension().create([ECPointFormat.uncompressed])) ext.append(TLSExtension(extType=ExtensionType.session_ticket)) ext.append(NPNExtension()) ext.append(TLSExtension(extType=ExtensionType.alpn) .create(bytearray(b'\x00\x15' + b'\x02' + b'h2' + b'\x08' + b'spdy/3.1' + b'\x08' + b'http/1.1'))) ext.append(TLSExtension(extType=ExtensionType.status_request) .create(bytearray(b'\x01' + b'\x00\x00' + b'\x00\x00'))) sig_algs = [] for alg in ['sha256', 'sha384', 'sha512', 'sha1']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.rsa)) for alg in ['sha256', 'sha384', 'sha512', 'sha1']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.ecdsa)) for alg in ['sha256', 'sha1']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.dsa)) ext.append(SignatureAlgorithmsExtension() .create(sig_algs)) _ec_precomputed = { 'secp256r1' : [ bytearray(b'\x04\x85\x96\xe5\xa1\x92\x99\xf8\xb1\xb1}\xcd\xdc\x1c^\xfd05\xa1\xe1\xd3\xd0\x87s\xb1\xd8>\x00TX\xac\x86\xe1\xa3\xb0c~\x85\x8d&\xaf"X\xb5\x9cf\x8d\xf4\xf5d\xd7u\'&]\xbe\xe3\x83]ul\xff\x86e\x89'), bytearray(b'\x04\xa89\xfc\xb2r\xf3\x03p6\xca\xb6\xe2\xb1t2\t\x8b\xb2\x89\xce\x8f\x84\r\x8b\x1b\r\\\r/\xcd\xabn\xb6WE\xb7\x9a\xba\r\xdb\x03\xc3\x9c\xd9N\x19\x03[\xe0\nK\xf3\xfb\x00\xbe]d\x96e\xf2\xde\x94\td'), bytearray(b'\x04\xaa\xf1Q\xfb\xf1\x95\x03\xaa\x8d\x8c\xefB\x8c;\x04u\xdaG\xee\xe5\xd9`J\xe3\x90\xc3T\x02\xe7\x80\x9b\x0f,bi4m2\n\xffD\x9b\xb68\x10\xa3\xbdd]\x05\xa3\x81\xfe\x97J\x9aY\x0e\xe3\x1b\xad\xe4\x84\xbd'), bytearray(b'\x04\x17\xf9K\x1b\x95\xd3\xf7\xfc`y\xe7g*A\xeb4!\xbca\xd1)\xa0\x0e\xa88\xbd\xb0\xd6\x9a\x97\x95\xa1R2\xcc]$[\xc1\x90T\x83Lu\xbb%I\x81\x8a\x11\x0c\x01\x07)"\x80\xbb\xbaS\xa5`r\x91\xe6'), bytearray(b"\x04xGX\x06\xb2N\xe2\x9f\xfc\xdc}\xd2\xdbU\x9a$\xb6\xbc`\xb6\xec\xaa\xad(\xa4\x7fwU\xcfK/T\xea\xa5\xc2Y\xf7<\xfe\xa9\xaf\xa2f7\xa2\'/\xfd\x18\xae\x1e\xc0,\xa5cd\x8d2\x98\xeeA#\x13\x9c"), bytearray(b'\x04\x14\xf0\xf5_\xa1\xf6\xa5\x1c\xf4%\x17\xc4\x86uE|\xc3#\x11\x9b\xf8\xf2\xcc\xc8F/\xcb\xc46,\x81+@\xbeS\x93\xa59\xae\xc8\xe9 {\r\xdfE j!\xa7\xef\x85\x04\xa0\x9bI\xbbiC\x9c#II\xb2')], 'secp384r1' : [ bytearray(b'\x04*\x9c\x14\xfe!_\xea\xa7\xef\x8aR\xd7\x9d\xab\xc3fU6)\x8b\xce\x935q\x92l\xbc\xb84\x96$\xf0\x86\x05\x85\xaaEq\xca0\x99\xf6c\xf2+=\xc9!Ms%z\xf7\x98\x1auCOb\xcc\xdc\x89\x1d\x97\xa7y\xe0\x8e\xea/\x80brj\xd7\x1b\x17\x89<\xe5\xba\xa3*\x0c\xb5\r\xde}\xa7{\x94\x9f\x81\xb3:\x92'), bytearray(b"\x04\x9b]\xfap\xf5R\xefCv\x95\xc4c\xea\xee\xe1i\xf80\x97\x08\xdb\xe7\x83a\x8f~`\xd7`>A\x8aS6\x82\'\xd6711\x9b,+\xc9\xbb\xa7\xa3E\xe3\xfb\x1a\xa2\x83\xac\xf8\x0eV\x93y\xb2w\xe5\xf5hQ3H\xa0\xa9\x8d\xfdg\xe9\xac\x12\xcd%(bY\xc5+\x98o\xb5D1\xcbu\x7f\t\x8f\xfe\xfa\x16q"), bytearray(b'\x04@\'b\'{\x15H\xb0\x9c?\xe5dg\xbf\xe4\'\xe1D\xf7FIs\xb9\x153\x87x\xcb\xb7\xf6b\x9b\xe5\x10_\xfc%Z\x87\xa5\xae(\x13\xb1*]_g\xd4\xeaeH\x83\xed\xa0N\x82Mqz;\xbba\x0f\xf6\x9c\x08"\xca\x00\x8fq\xc5\xc7\t{\xf1l_h\x05\xec\x9a\x19N\x98+%=?\x14\xbf0\x94\x13"'), bytearray(b"\x04pM\xfe\xf0+h\xe3\x9d\xda\xe1x1\x02}\xa4\xa2\x83\'\xfem\x1a;\xbf\x10\xd7\xb2\xd9I\x06-\x9fY\xa3k9\xc4\xc8\xda\x1e>G\xaf\xcb|\x01\xd6j\xff|\xe0>\x81I\x8b\x03\xd3\xf8\xc9|\xab&w\xf8\x1b\x9a\x98\xb1CXAU\t\x03\xd6\xcf\xa0L\xd1B \x13Mr\xbe\x8b\xe6}\xf2\xb2oc\x98A\x94\x9eX"), bytearray(b'\x04\x1a[X\x13\x17"^\x02\x19d\xc4\xec\x14\xea<\x8c\xd2f\x95\xb4b\xdc\xbbG;pq\x9a^\xf8\xd0\xe7\x99Ofk\x1e#\x8dZ\xcb\xbf\x1e=p\xaa\xe5\x92\xda^\xb2\x86\xdf\xf8(\xfcIc\xde\xcempP\x82\xcd\x88\xe3\x87\xd1\x8b\xac\xe5\x19\xd4)\ndPX\\)\xf7\x1c\xdef\x0e` \x13\xa1\xa8YSun4'), bytearray(b"\x04\xce\xbe\xb9{$#\x03c\xdemi\xf0\xec\x07]Q8^\x8b\xdd,)~\x972]cI\xbe\xc9\x8b\xa0\xd7\xc7\x96H\xa4\xea\xb2\x86%\xee\xb2\xc8\x08\x1d\xa4\xb9\xc5Bc \xac-;J{\x10\xafh\xceU*+h\xda&7\'\x15\xb7d5\xfd\x94\x86\xd3\xe8=\xcc\xbf\x8d\x07\x17\xc9(\x17U@gH\x8d]\xc5\xe2\xe2;.S\xf9\xa1\x00\xc2\xb5\xb7\'\x05f\xe6\xf3\xf7Za\xa1\xa4\x9209\xf3I\xe3\xdd%\xd1\x8a\x82\n4Z\xa1ol?l(\x939_+(\x1c\xca\xa4\xc3\xdb\x01\x19\xc5\xb4\xfc\xb7\xa8\xa4\xd3\x14x\x0c\x1f\x91\xd1!5\x1a\xb0\x0b\xa7\xe9"), bytearray(b'\x04\x01\xban\x80\x85\xe8\xc7\xd0r\x17\x84\xea\x16\xc0\xfdM\xde\x98\xfe\x82\xd9\x06{\t\x1f*\xa2(t\xd4\x95y\xb7\x98\xbbP\xf1\xd9_9\xe3\xd3\xf8\xf1\xa9\xec\x1c\xce\xf6\\\xb1\xb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\x16\x15\xd1\x9d\xf6t\xee\xd5\xc1\xa5\x8f.\xa9\x01cl\x87\x95<&bW\xbf\x92\x88\x1e0s[')] } def _ff_key_share(name): if name in _ff_precomputed: return random.choice(_ff_precomputed[name]) ff_map = {'ffdhe8192' : goodGroupParameters[6], 'ffdhe6144' : goodGroupParameters[5], 'ffdhe4096' : goodGroupParameters[4], 'ffdhe3072' : goodGroupParameters[3], 'ffdhe2048' : goodGroupParameters[2]} generator = ff_map[name] secret = random.randint(2, generator[1]) ret = numberToByteArray(powMod(generator[0], secret, generator[1])) return ret class Xmas_tree(HelloConfig): """ Create a Xmas tree (all options enabled) Client Hello message Creates a ClientHello message with maximum number of options enabled, currently for TLS 1.3 protocol. """ def __init__(self): super(Xmas_tree, self).__init__() self._name = "Xmas tree" self.version = (3, 4) self.record_version = (3, 4) self.ciphers = [] self.ciphers.extend(CipherSuite.ecdheEcdsaSuites) self.ciphers.extend(CipherSuite.ecdheCertSuites) self.ciphers.extend(CipherSuite.dheCertSuites) self.ciphers.extend(range(0x0100, 0x0200)) self.ciphers.extend(CipherSuite.dheDssSuites) self.ciphers.extend(CipherSuite.certSuites) ext = self.extensions = [] ext.append(SNIExtension()) ext.append(TLSExtension(extType=ExtensionType.renegotiation_info) .create(bytearray(1))) groups =[GroupName.secp256r1, GroupName.secp384r1, GroupName.secp521r1, GroupName.ecdh_x25519, GroupName.ecdh_x448] groups.extend(GroupName.allFF) ext.append(SupportedGroupsExtension().create(groups)) formats = [ECPointFormat.uncompressed, ECPointFormat.ansiX962_compressed_prime, ECPointFormat.ansiX962_compressed_char2] ext.append(ECPointFormatsExtension().create(formats)) ext.append(TLSExtension(extType=ExtensionType.session_ticket)) ext.append(TLSExtension(extType=ExtensionType.max_fragment_legth) .create(bytearray(b'\x04'))) ext.append(NPNExtension()) ext.append(TLSExtension(extType=ExtensionType.alpn) .create(bytearray(b'\x00\x15' + b'\x02' + b'h2' + b'\x08' + b'spdy/3.1' + b'\x08' + b'http/1.1'))) ext.append(TLSExtension(extType=ExtensionType.status_request) .create(bytearray(b'\x01' + b'\x00\x00' + b'\x00\x00'))) ext.append(TLSExtension(extType=ExtensionType.status_request_v2) .create(bytearray(b'\x00\x07' + # overall length b'\x02' + # status type b'\x00\x04' + # request field length b'\x00\x00' + # responder id list b'\x00\x00'))) # request extensions sig_algs = [] # some not yet standardised algorithms: for s_alg in [4, 5, 6, 7]: for alg in ['sha256', 'sha384', 'sha512']: sig_algs.append((getattr(HashAlgorithm, alg), s_alg)) # some not yet standardised hashes: for s_alg in [SignatureAlgorithm.rsa, SignatureAlgorithm.ecdsa]: for alg in [7, 8, 9, 10, 11]: sig_algs.append((alg, s_alg)) for alg in ['sha256', 'sha384', 'sha512', 'sha224', 'sha1', 'md5']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.rsa)) for alg in ['sha256', 'sha384', 'sha512', 'sha224', 'sha1']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.ecdsa)) for alg in ['sha256', 'sha384', 'sha512', 'sha224', 'sha1', 'md5']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.dsa)) ext.append(SignatureAlgorithmsExtension() .create(sig_algs)) ext.append(KeyShareExtension() .create([(GroupName.secp384r1, _ec_key_share('secp384r1')), (GroupName.secp256r1, _ec_key_share('secp256r1')), (GroupName.secp521r1, _ec_key_share('secp521r1')), (GroupName.ffdhe8192, _ff_key_share('ffdhe8192'))])) ext.append(TLSExtension(extType=ExtensionType.heartbeat) .create(bytearray(b'\x01'))) # peer allowed to send ext.append(PaddingExtension().create(512)) ext.append(TLSExtension(extType=ExtensionType.encrypt_then_mac)) # place an empty extension to trigger intolerancies in specific servers ext.append(TLSExtension(extType=ExtensionType.extended_master_secret)) # interesting ones are 0, 1 self.compression_methods = list(range(0, 80)) class HugeCipherList(HelloConfig): """Client Hello with list of ciphers that doesn't fit a single record""" def __init__(self): super(HugeCipherList, self).__init__() self._name = "Huge Cipher List" self.record_version = (3, 1) self.version = (3, 3) self.ciphers = [] self.ciphers.extend(CipherSuite.ecdheEcdsaSuites) self.ciphers.extend(CipherSuite.ecdheCertSuites) self.ciphers.extend(CipherSuite.dheCertSuites) self.ciphers.extend(CipherSuite.dheDssSuites) self.ciphers.extend(CipherSuite.certSuites) self.ciphers.extend(range(0x2000, 0x2000+8192)) class VeryCompatible(HelloConfig): """ Cipher compatible client hello with minimal intolerancies Create a Client Hello that can connect to as many servers as possible without triggering intolerancies (with the exception of TLS extension intolerance) """ def __init__(self): super(VeryCompatible, self).__init__() self._name = "Very Compatible" self.version = (3, 3) self.record_version = (3, 1) self.ciphers = [CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_DHE_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA256, CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA, CipherSuite.TLS_RSA_WITH_RC4_128_SHA, CipherSuite.TLS_RSA_WITH_RC4_128_MD5, CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV] ext = self.extensions = [] ext.append(SNIExtension()) ext.append(SupportedGroupsExtension().create([GroupName.secp256r1, GroupName.secp384r1, GroupName.secp521r1])) ext.append(ECPointFormatsExtension().create([ECPointFormat.uncompressed])) ext.append(TLSExtension(extType=ExtensionType.session_ticket)) ext.append(NPNExtension()) ext.append(TLSExtension(extType=ExtensionType.alpn) .create(bytearray(b'\x00\x15' + b'\x02' + b'h2' + b'\x08' + b'spdy/3.1' + b'\x08' + b'http/1.1'))) ext.append(TLSExtension(extType=ExtensionType.status_request) .create(bytearray(b'\x01' + b'\x00\x00' + b'\x00\x00'))) sig_algs = [] for alg in ['sha256', 'sha384', 'sha512', 'sha1']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.rsa)) for alg in ['sha256', 'sha384', 'sha512', 'sha1']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.ecdsa)) for alg in ['sha256', 'sha1']: sig_algs.append((getattr(HashAlgorithm, alg), SignatureAlgorithm.dsa)) ext.append(SignatureAlgorithmsExtension() .create(sig_algs)) class IE_6(HelloConfig): """Create a Internet Explorer 6-like Client Hello message""" def __init__(self): super(IE_6, self).__init__() self._name = "IE 6" self.version = (3, 0) self.record_version = (0, 2) self.ciphers = [] self.ciphers.extend([CipherSuite.TLS_RSA_WITH_RC4_128_MD5, CipherSuite.TLS_RSA_WITH_RC4_128_SHA, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA, CipherSuite.SSL_CK_RC4_128_WITH_MD5, CipherSuite.SSL_CK_DES_192_EDE3_CBC_WITH_MD5, CipherSuite.SSL_CK_RC2_128_CBC_WITH_MD5, CipherSuite.TLS_RSA_WITH_DES_CBC_SHA, CipherSuite.SSL_CK_DES_64_CBC_WITH_MD5, CipherSuite.TLS_RSA_EXPORT1024_WITH_RC4_56_SHA, CipherSuite.TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA, CipherSuite.TLS_RSA_EXPORT_WITH_RC4_40_MD5, CipherSuite.TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5, CipherSuite.SSL_CK_RC4_128_EXPORT40_WITH_MD5, CipherSuite.SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5, CipherSuite.TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, CipherSuite.TLS_DHE_DSS_WITH_DES_CBC_SHA, CipherSuite.TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA]) self.ssl2=True class IE_8_Win_XP(HelloConfig): """Create a Internet Explorer 8 on WinXP-like Client Hello message""" def __init__(self): super(IE_8_Win_XP, self).__init__() self._name = "IE 8 on Win XP" self.version = (3, 1) self.record_version = (3, 0) self.ciphers = [] self.ciphers.extend([CipherSuite.TLS_RSA_WITH_RC4_128_MD5, CipherSuite.TLS_RSA_WITH_RC4_128_SHA, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA, CipherSuite.TLS_RSA_WITH_DES_CBC_SHA, CipherSuite.TLS_RSA_EXPORT1024_WITH_RC4_56_SHA, CipherSuite.TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA, CipherSuite.TLS_RSA_EXPORT_WITH_RC4_40_MD5, CipherSuite.TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5, CipherSuite.TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, CipherSuite.TLS_DHE_DSS_WITH_DES_CBC_SHA, CipherSuite.TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA]) class IE_11_Win_7(HelloConfig): """Create an Internet Explorer 11 on Win7-like Client Hello message""" def __init__(self): super(IE_11_Win_7, self).__init__() self._name = "IE 11 on Win 7" self.version = (3, 3) self.record_version = (3, 1) self.ciphers = [] self.ciphers.extend([CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA256, CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_RC4_128_SHA, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_DHE_DSS_WITH_AES_128_CBC_SHA, CipherSuite.TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, CipherSuite.TLS_DHE_DSS_WITH_AES_256_CBC_SHA, CipherSuite.TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, CipherSuite.TLS_RSA_WITH_RC4_128_MD5]) ext = self.extensions = [] ext.append(SNIExtension()) ext.append(TLSExtension(extType=ExtensionType.renegotiation_info) .create(bytearray(1))) groups = [GroupName.secp256r1, GroupName.secp384r1] ext.append(SupportedGroupsExtension().create(groups)) ext.append(TLSExtension(extType=ExtensionType.status_request) .create(bytearray(b'\x01' + b'\x00\x00' + b'\x00\x00'))) sig_algs = [] for s_alg in ['rsa', 'ecdsa']: for h_alg in ['sha256', 'sha384', 'sha1']: sig_algs.append((getattr(HashAlgorithm, h_alg), getattr(SignatureAlgorithm, s_alg))) sig_algs.append((HashAlgorithm.sha1, SignatureAlgorithm.dsa)) ext.append(SignatureAlgorithmsExtension().create(sig_algs)) class IE_11_Win_8_1(HelloConfig): """Create an Internet Explorer 11 on Win8.1-like Client Hello message""" def __init__(self): super(IE_11_Win_8_1, self).__init__() self._name = "IE 11 on Win 8.1" self.version = (3, 3) self.record_version = (3, 1) self.ciphers = [CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA256, CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_DHE_DSS_WITH_AES_128_CBC_SHA, CipherSuite.TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, CipherSuite.TLS_DHE_DSS_WITH_AES_256_CBC_SHA, CipherSuite.TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA] ext = self.extensions = [] ext.append(SNIExtension()) ext.append(TLSExtension(extType=ExtensionType.renegotiation_info) .create(bytearray(1))) groups = [GroupName.secp256r1, GroupName.secp384r1] ext.append(SupportedGroupsExtension().create(groups)) ext.append(TLSExtension(extType=ExtensionType.session_ticket)) ext.append(TLSExtension(extType=ExtensionType.status_request) .create(bytearray(b'\x01' + b'\x00\x00' + b'\x00\x00'))) sig_algs = [] for s_alg in ['rsa', 'ecdsa']: for h_alg in ['sha256', 'sha384', 'sha1']: sig_algs.append((getattr(HashAlgorithm, h_alg), getattr(SignatureAlgorithm, s_alg))) sig_algs.append((HashAlgorithm.sha1, SignatureAlgorithm.dsa)) ext.append(SignatureAlgorithmsExtension().create(sig_algs)) ext.append(NPNExtension()) ext.append(TLSExtension(extType=ExtensionType.alpn) .create(bytearray(b'\x00\x10' + b'\x06' + b'spdy/3' + b'\x08' + b'http/1.1')))