예제 #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
     ]