Ejemplo n.º 1
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         ServerECDHParamsField("params"),
         VectorUInt16Field("signed_params")
     ]
Ejemplo n.º 2
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         VersionField("version"),
         VectorUInt8Field("cookie")
     ]
Ejemplo n.º 3
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.length = 0
     self.is_escape = None
     self.padding_length = None
     self.padding = b""
     self.type = None
Ejemplo n.º 4
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField(
             "type",
             None,
             {
                 0: "hello_request",
                 1: "client_hello",
                 2: "server_hello",
                 3: "hello_verify_request",
                 11: "certificate",
                 12: "server_key_exchange",
                 13: "certificate_request",
                 14: "server_hello_done",
                 15: "certificate_verify",
                 16: "client_key_exchange",
                 20: "finished",
                 255: None
             }
         ),
         UInt24Field("length", 0),
         UInt16Field("message_seq", 0),
         UInt24Field("fragment_offset", 0),
         UInt24Field("fragment_length", 0)
     ]
     self.payload_identifier_field = "type"
     self.payload_length_field = "length"
     self.payload_fragment_length_field = "fragment_length"
     self.payload_fragment_offset_field = "fragment_offset"
Ejemplo n.º 5
0
    def __init__(self, **kwargs):
        Protocol.__init__(self, **kwargs)
        self.payload = None

        self.fields = [
            ServerDHParamsField("params")
        ]
Ejemplo n.º 6
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         ServerECDHParamsField("params"),
         VectorUInt16Field("signed_params")
     ]
Ejemplo n.º 7
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField(
             "type", None, {
                 0: "hello_request",
                 1: "client_hello",
                 2: "server_hello",
                 3: "hello_verify_request",
                 11: "certificate",
                 12: "server_key_exchange",
                 13: "certificate_request",
                 14: "server_hello_done",
                 15: "certificate_verify",
                 16: "client_key_exchange",
                 20: "finished",
                 255: None
             }),
         UInt24Field("length", 0),
         UInt16Field("message_seq", 0),
         UInt24Field("fragment_offset", 0),
         UInt24Field("fragment_length", 0)
     ]
     self.payload_identifier_field = "type"
     self.payload_length_field = "length"
     self.payload_fragment_length_field = "fragment_length"
     self.payload_fragment_offset_field = "fragment_offset"
Ejemplo n.º 8
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.length = 0
     self.is_escape = None
     self.padding_length = None
     self.padding = b""
     self.type = None
Ejemplo n.º 9
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField("type", None, {
             1: "change_cipher_spec",
             255: None
         }),
     ]
Ejemplo n.º 10
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUShortField(
             "elliptic_curve_list",
             item_class=UShortField
         ),
     ]
Ejemplo n.º 11
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUShortField(
             "supported_signature_algorithms",
             item_class=SignatureAndHashAlgorithmField
         ),
     ]
Ejemplo n.º 12
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUInt8Field(
             "point_format_list",
             item_class=UInt8Field,
             item_class_args=[None, None]
         ),
     ]
Ejemplo n.º 13
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUInt16Field(
             "elliptic_curve_list",
             item_class=UInt16Field,
             item_class_args=[None, None]
         ),
     ]
Ejemplo n.º 14
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUInt16Field(
             "protocol_name_list",
             item_class=VectorUInt8Field,
             item_class_args=[None]
         ),
     ]
Ejemplo n.º 15
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUInt16Field(
             "supported_signature_algorithms",
             item_class=SignatureAndHashAlgorithmField,
             item_class_args=[None, None]
         ),
     ]
Ejemplo n.º 16
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         VersionField("version"),
         RandomField("random"),
         VectorUInt8Field("session_id"),
         CipherSuiteField("cipher_suite"),
         CompressionMethodField("compression_method"),
         ExtensionsField("extensions"),
     ]
Ejemplo n.º 17
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         VersionField("version"),
         RandomField("random"),
         VectorUInt8Field("session_id"),
         CipherSuiteField("cipher_suite"),
         CompressionMethodField("compression_method"),
         ExtensionsField("extensions"),
     ]
Ejemplo n.º 18
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         VersionField("version"),
         UInt16Field("cipher_suites_length", 0),
         UInt16Field("session_id_length", 0),
         UInt16Field("challenge_length", 0),
     ]
     self.cipher_suites = []
     self.session_id = b""
     self.challenge = b""
Ejemplo n.º 19
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         VersionField("version"),
         UInt16Field("cipher_suites_length", 0),
         UInt16Field("session_id_length", 0),
         UInt16Field("challenge_length", 0),
     ]
     self.cipher_suites = []
     self.session_id = b""
     self.challenge = b""
Ejemplo n.º 20
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField(
             "type",
             None,
             {
                 1: "change_cipher_spec",
                 255: None
             }
         ),
     ]
Ejemplo n.º 21
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField(
             "mode",
             None,
             {
                 1: "peer_allowed_to_send",
                 2: "peer_not_allowed_to_send",
                 255: None
             }
         ),
     ]
Ejemplo n.º 22
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UByteEnumField(
             "mode",
             None,
             {
                 1: "peer_allowed_to_send",
                 2: "peer_not_allowed_to_send",
                 255: None
             }
         ),
     ]
Ejemplo n.º 23
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         UInt8Field("session_id_hit", 0),
         UInt8Field("certificate_type", 0),
         VersionField("version"),
         UInt16Field("certificate_length", 0),
         UInt16Field("cipher_suites_length", 0),
         UInt16Field("connection_id_length", 0),
     ]
     self.certificate = b""
     self.cipher_suites = []
     self.connection_id = b""
Ejemplo n.º 24
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         UInt8Field("session_id_hit", 0),
         UInt8Field("certificate_type", 0),
         VersionField("version"),
         UInt16Field("certificate_length", 0),
         UInt16Field("cipher_suites_length", 0),
         UInt16Field("connection_id_length", 0),
     ]
     self.certificate = b""
     self.cipher_suites = []
     self.connection_id = b""
Ejemplo n.º 25
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UShortEnumField(
             "type",
             None,
             {
                 13: "signature_algorithms",
                 65535: None
             }
         ),
         UShortField("length", 0),
     ]
     self.payload_identifier_field = "type"
     self.payload_length_field = "length"
Ejemplo n.º 26
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt16EnumField(
             "type",
             None,
             {
                 13: "signature_algorithms",
                 65535: None
             }
         ),
         UInt16Field("length", 0),
     ]
     self.payload_identifier_field = "type"
     self.payload_length_field = "length"
Ejemplo n.º 27
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField(
             "content_type", None, {
                 20: "change_cipher_spec",
                 21: "alert",
                 22: "handshake",
                 23: "application_data",
                 255: None
             }),
         VersionField("version"),
         UInt16Field("length", 0),
     ]
     self.payload_identifier_field = "content_type"
     self.payload_length_field = "length"
Ejemplo n.º 28
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField(
             "type",
             None,
             {
                 1: "request",
                 2: "response",
                 255: None
             }
         ),
         UInt16Field("payload_length", 0)
     ]
     self.padding = b""
     self.payload_length_field = "payload_length"
     self.payload_identifier_field = False
Ejemplo n.º 29
0
 def dissect(self, data, payload_auto_decode=True):
     data = Protocol.dissect(
         self,
         data,
         payload_auto_decode=payload_auto_decode
     )
     self.padding = data
     return b""
Ejemplo n.º 30
0
 def dissect(self, data, payload_auto_decode=True):
     data = Protocol.dissect(
         self,
         data,
         payload_auto_decode=payload_auto_decode
     )
     self.padding = data
     return b""
Ejemplo n.º 31
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UByteEnumField(
             "type",
             None,
             {
                 1: "request",
                 2: "response",
                 255: None
             }
         ),
         UShortField("payload_length", 0)
     ]
     self.padding = b""
     self.payload_length_field = "payload_length"
     self.payload_identifier_field = False
Ejemplo n.º 32
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField(
             "level",
             None,
             {
                 1: "warning",
                 2: "fatal",
                 255: None
             }
         ),
         UInt8EnumField(
             "description",
             None,
             {
                 0: "close_notify",
                 10: "unexpected_message",
                 20: "bad_record_mac",
                 21: "decryption_failed_RESERVED",
                 22: "record_overflow",
                 30: "decompression_failure",
                 40: "handshake_failure",
                 41: "no_certificate_RESERVED",
                 42: "bad_certificate",
                 43: "unsupported_certificate",
                 44: "certificate_revoked",
                 45: "certificate_expired",
                 46: "certificate_unknown",
                 47: "illegal_parameter",
                 48: "unknown_ca",
                 49: "access_denied",
                 50: "decode_error",
                 51: "decrypt_error",
                 60: "export_restriction_RESERVED",
                 70: "protocol_version",
                 71: "insufficient_security",
                 80: "user_canceled",
                 90: "user_canceled",
                 100: "no_renegotiation",
                 110: "unsupported_extension",
                 255: None
             }
         ),
     ]
Ejemplo n.º 33
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField(
             "content_type",
             None,
             {
                 20: "change_cipher_spec",
                 21: "alert",
                 22: "handshake",
                 23: "application_data",
                 255: None
             }
         ),
         VersionField("version"),
         UInt16Field("length", 0),
     ]
     self.payload_identifier_field = "content_type"
     self.payload_length_field = "length"
Ejemplo n.º 34
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UByteEnumField(
             "type",
             None,
             {
                 0: "hello_request",
                 1: "client_hello",
                 2: "server_hello",
                 11: "certificate",
                 12: "server_key_exchange",
                 13: "certificate_request",
                 14: "server_hello_done",
                 15: "certificate_verify",
                 16: "client_key_exchange",
                 20: "finished",
                 255: None
             }
         ),
         UInteger3Field("length", 0),
     ]
     self.payload_identifier_field = "type"
     self.payload_length_field = "length"
Ejemplo n.º 35
0
    def assemble(self):
        cipher_data = b""
        for cipher in self.cipher_suites:
            cipher_data = cipher_data + cipher.assemble()

        if len(self.challenge) == 0:
            # ToDo: error
            pass

        self.cipher_suites_length = len(cipher_data)
        self.session_id_length = len(self.session_id)
        self.challenge_length = len(self.challenge)

        data = cipher_data
        data += self.session_id
        data += self.challenge

        data = Protocol.assemble(self) + data
        return data
Ejemplo n.º 36
0
    def assemble(self):
        cipher_data = b""
        for cipher in self.cipher_suites:
            cipher_data = cipher_data + cipher.assemble()

        if len(self.challenge) == 0:
            # ToDo: error
            pass

        self.cipher_suites_length = len(cipher_data)
        self.session_id_length = len(self.session_id)
        self.challenge_length = len(self.challenge)

        data = cipher_data
        data += self.session_id
        data += self.challenge

        data = Protocol.assemble(self) + data
        return data
Ejemplo n.º 37
0
    def dissect(self, data, payload_auto_decode=True):
        data = Protocol.dissect(self,
                                data,
                                payload_auto_decode=payload_auto_decode)
        cipher_data = data[:self.cipher_suites_length]
        data = data[self.cipher_suites_length:]
        while len(cipher_data) > 0:
            if len(cipher_data) < 3:
                # ToDo: error
                break
            cipher = SSLv2CipherSuiteField()
            cipher_data = cipher.dissect(cipher_data)
            self.cipher_suites.append(cipher)

        self.session_id = data[:self.session_id_length]
        data = data[self.session_id_length:]
        self.challenge = data[:self.challenge_length]
        data = data[self.challenge_length:]

        return data
Ejemplo n.º 38
0
    def dissect(self, data, payload_auto_decode=True):
        data = Protocol.dissect(
            self,
            data,
            payload_auto_decode=payload_auto_decode
        )
        cipher_data = data[:self.cipher_suites_length]
        data = data[self.cipher_suites_length:]
        while len(cipher_data) > 0:
            if len(cipher_data) < 3:
                # ToDo: error
                break
            cipher = SSLv2CipherSuiteField()
            cipher_data = cipher.dissect(cipher_data)
            self.cipher_suites.append(cipher)

        self.session_id = data[:self.session_id_length]
        data = data[self.session_id_length:]
        self.challenge = data[:self.challenge_length]
        data = data[self.challenge_length:]

        return data
Ejemplo n.º 39
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         CertificateListField("certificate_list"),
     ]
Ejemplo n.º 40
0
 def assemble(self):
     Protocol.assemble(self)
     # ToDo: Fragmentation is not supported
     self.fragment_offset = 0
     self.fragment_length = self.length
     return Protocol.assemble(self)
Ejemplo n.º 41
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [VersionField("version"), VectorUInt8Field("cookie")]
Ejemplo n.º 42
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         ServerNameListField("server_name_list"),
     ]
Ejemplo n.º 43
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorUInt16Field("data"),
     ]
Ejemplo n.º 44
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         ServerNameListField("server_name_list"),
     ]
Ejemplo n.º 45
0
    def __init__(self, **kwargs):
        Protocol.__init__(self, **kwargs)
        self.payload = None

        self.fields = [ServerDHParamsField("params")]
Ejemplo n.º 46
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = []
Ejemplo n.º 47
0
 def assemble(self):
     data = Protocol.assemble(self)
     data = data + self.padding
     return data
Ejemplo n.º 48
0
 def assemble(self):
     data = Protocol.assemble(self)
     data = data + self.padding
     return data
Ejemplo n.º 49
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = []
Ejemplo n.º 50
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         CertificateListField("certificate_list"),
     ]
Ejemplo n.º 51
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = []
Ejemplo n.º 52
0
 def assemble(self):
     Protocol.assemble(self)
     # ToDo: Fragmentation is not supported
     self.fragment_offset = 0
     self.fragment_length = self.length
     return Protocol.assemble(self)
Ejemplo n.º 53
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         # ToDo: need a state object to parse the server params
     ]