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


Python ClientHello.compression_methods方法代码示例

本文整理汇总了Python中tlslite.messages.ClientHello.compression_methods方法的典型用法代码示例。如果您正苦于以下问题:Python ClientHello.compression_methods方法的具体用法?Python ClientHello.compression_methods怎么用?Python ClientHello.compression_methods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tlslite.messages.ClientHello的用法示例。


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

示例1: generate

# 需要导入模块: from tlslite.messages import ClientHello [as 别名]
# 或者: from tlslite.messages.ClientHello import compression_methods [as 别名]
    def generate(self, state):
        if self.version is None:
            self.version = state.client_version
        if self.random:
            state.client_random = self.random
        if self.session_id is None:
            self.session_id = state.session_id
        if not state.client_random:
            state.client_random = bytearray(32)

        extensions = None
        if self.extensions is not None:
            extensions = self._generate_extensions(state)

        clnt_hello = ClientHello().create(self.version,
                                          state.client_random,
                                          self.session_id,
                                          self.ciphers,
                                          extensions=extensions)
        clnt_hello.compression_methods = self.compression
        state.client_version = self.version

        self.msg = clnt_hello

        return clnt_hello
开发者ID:majinxin2003,项目名称:tlsfuzzer,代码行数:27,代码来源:messages.py

示例2: __call__

# 需要导入模块: from tlslite.messages import ClientHello [as 别名]
# 或者: from tlslite.messages.ClientHello import compression_methods [as 别名]
    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
开发者ID:MikeDawg,项目名称:cipherscan,代码行数:35,代码来源:config.py


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