Пример #1
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         ServerECDHParamsField("params"),
         VectorUInt16Field("signed_params")
     ]
Пример #2
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         VersionField("version"),
         VectorUInt8Field("cookie")
     ]
Пример #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
Пример #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"
Пример #5
0
    def __init__(self, **kwargs):
        Protocol.__init__(self, **kwargs)
        self.payload = None

        self.fields = [
            ServerDHParamsField("params")
        ]
Пример #6
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         ServerECDHParamsField("params"),
         VectorUInt16Field("signed_params")
     ]
Пример #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"
Пример #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
Пример #9
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField("type", None, {
             1: "change_cipher_spec",
             255: None
         }),
     ]
Пример #10
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUShortField(
             "elliptic_curve_list",
             item_class=UShortField
         ),
     ]
Пример #11
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUShortField(
             "supported_signature_algorithms",
             item_class=SignatureAndHashAlgorithmField
         ),
     ]
Пример #12
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUInt8Field(
             "point_format_list",
             item_class=UInt8Field,
             item_class_args=[None, None]
         ),
     ]
Пример #13
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUInt16Field(
             "elliptic_curve_list",
             item_class=UInt16Field,
             item_class_args=[None, None]
         ),
     ]
Пример #14
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUInt16Field(
             "protocol_name_list",
             item_class=VectorUInt8Field,
             item_class_args=[None]
         ),
     ]
Пример #15
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUInt16Field(
             "supported_signature_algorithms",
             item_class=SignatureAndHashAlgorithmField,
             item_class_args=[None, None]
         ),
     ]
Пример #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"),
     ]
Пример #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"),
     ]
Пример #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""
Пример #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""
Пример #20
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField(
             "type",
             None,
             {
                 1: "change_cipher_spec",
                 255: None
             }
         ),
     ]
Пример #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
             }
         ),
     ]
Пример #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
             }
         ),
     ]
Пример #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""
Пример #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""
Пример #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"
Пример #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"
Пример #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"
Пример #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
Пример #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""
Пример #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""
Пример #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
Пример #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
             }
         ),
     ]
Пример #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"
Пример #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"
Пример #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
Пример #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
Пример #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
Пример #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
Пример #39
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         CertificateListField("certificate_list"),
     ]
Пример #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)
Пример #41
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [VersionField("version"), VectorUInt8Field("cookie")]
Пример #42
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         ServerNameListField("server_name_list"),
     ]
Пример #43
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorUInt16Field("data"),
     ]
Пример #44
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         ServerNameListField("server_name_list"),
     ]
Пример #45
0
    def __init__(self, **kwargs):
        Protocol.__init__(self, **kwargs)
        self.payload = None

        self.fields = [ServerDHParamsField("params")]
Пример #46
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = []
Пример #47
0
 def assemble(self):
     data = Protocol.assemble(self)
     data = data + self.padding
     return data
Пример #48
0
 def assemble(self):
     data = Protocol.assemble(self)
     data = data + self.padding
     return data
Пример #49
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = []
Пример #50
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = [
         CertificateListField("certificate_list"),
     ]
Пример #51
0
 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.payload = None
     self.fields = []
Пример #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)
Пример #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
     ]