当前位置: 首页>>代码示例>>Python>>正文


Python protocol.Protocol类代码示例

本文整理汇总了Python中flextls.protocol.Protocol的典型用法代码示例。如果您正苦于以下问题:Python Protocol类的具体用法?Python Protocol怎么用?Python Protocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Protocol类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, **kwargs):
        Protocol.__init__(self, **kwargs)
        self.payload = None

        self.fields = [
            ServerDHParamsField("params")
        ]
开发者ID:DinoTools,项目名称:python-flextls,代码行数:7,代码来源:__init__.py

示例2: __init__

 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
开发者ID:DinoTools,项目名称:python-flextls,代码行数:7,代码来源:record.py

示例3: __init__

 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUShortField(
             "supported_signature_algorithms",
             item_class=SignatureAndHashAlgorithmField
         ),
     ]
开发者ID:tyll,项目名称:python-flextls,代码行数:8,代码来源:extension.py

示例4: __init__

 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         VectorListUInt16Field(
             "elliptic_curve_list",
             item_class=UInt16Field,
             item_class_args=[None, None]
         ),
     ]
开发者ID:DinoTools,项目名称:python-flextls,代码行数:9,代码来源:extension.py

示例5: __init__

 def __init__(self, **kwargs):
     Protocol.__init__(self, **kwargs)
     self.fields = [
         UInt8EnumField(
             "type",
             None,
             {
                 1: "change_cipher_spec",
                 255: None
             }
         ),
     ]
开发者ID:DinoTools,项目名称:python-flextls,代码行数:12,代码来源:change_cipher_spec.py

示例6: __init__

 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
开发者ID:tyll,项目名称:python-flextls,代码行数:17,代码来源:heartbeat.py

示例7: dissect

 def dissect(self, data, payload_auto_decode=True):
     data = Protocol.dissect(
         self,
         data,
         payload_auto_decode=payload_auto_decode
     )
     self.padding = data
     return b""
开发者ID:tyll,项目名称:python-flextls,代码行数:8,代码来源:heartbeat.py

示例8: __init__

 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
             }
         ),
     ]
开发者ID:DinoTools,项目名称:python-flextls,代码行数:45,代码来源:alert.py

示例9: __init__

 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"
开发者ID:tyll,项目名称:python-flextls,代码行数:24,代码来源:__init__.py

示例10: assemble

    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
开发者ID:DinoTools,项目名称:python-flextls,代码行数:19,代码来源:__init__.py

示例11: dissect

    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
开发者ID:DinoTools,项目名称:python-flextls,代码行数:22,代码来源:__init__.py

示例12: assemble

 def assemble(self):
     data = Protocol.assemble(self)
     data = data + self.padding
     return data
开发者ID:tyll,项目名称:python-flextls,代码行数:4,代码来源:heartbeat.py


注:本文中的flextls.protocol.Protocol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。