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


Python ServerConnectivityTester.perform方法代码示例

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


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

示例1: init_sslyze

# 需要导入模块: from sslyze.server_connectivity_tester import ServerConnectivityTester [as 别名]
# 或者: from sslyze.server_connectivity_tester.ServerConnectivityTester import perform [as 别名]
def init_sslyze(hostname, port, starttls_smtp, options, sync=False):
    global network_timeout, CA_FILE

    network_timeout = int(options.get("network_timeout", network_timeout))
    if options.get('ca_file'):
        CA_FILE = options['ca_file']

    tls_wrapped_protocol = TlsWrappedProtocolEnum.PLAIN_TLS
    if starttls_smtp:
        tls_wrapped_protocol = TlsWrappedProtocolEnum.STARTTLS_SMTP

    try:
        # logging.debug("\tTesting connectivity with timeout of %is." % network_timeout)
        server_tester = ServerConnectivityTester(hostname=hostname, port=port, tls_wrapped_protocol=tls_wrapped_protocol)
        server_info = server_tester.perform(network_timeout=network_timeout)
    except ServerConnectivityError:
        logging.warning("\tServer connectivity not established during test.")
        return None, None
    except Exception as err:
        utils.notify(err)
        logging.warning("\tUnknown exception when performing server connectivity info.")
        return None, None

    if sync:
        scanner = SynchronousScanner(network_timeout=network_timeout)
    else:
        scanner = ConcurrentScanner(network_timeout=network_timeout)

    return server_info, scanner
开发者ID:18F,项目名称:domain-scan,代码行数:31,代码来源:sslyze.py

示例2: test_tls_1_3_cipher_suites

# 需要导入模块: from sslyze.server_connectivity_tester import ServerConnectivityTester [as 别名]
# 或者: from sslyze.server_connectivity_tester.ServerConnectivityTester import perform [as 别名]
    def test_tls_1_3_cipher_suites(self):
        server_test = ServerConnectivityTester(hostname='www.cloudflare.com')
        server_info = server_test.perform()

        plugin = OpenSslCipherSuitesPlugin()
        plugin_result = plugin.process_task(server_info, Tlsv13ScanCommand())

        accepted_cipher_name_list = [cipher.name for cipher in plugin_result.accepted_cipher_list]
        assert {'TLS_CHACHA20_POLY1305_SHA256', 'TLS_AES_256_GCM_SHA384', 'TLS_AES_128_GCM_SHA256'} == \
            set(accepted_cipher_name_list)
开发者ID:nabla-c0d3,项目名称:sslyze,代码行数:12,代码来源:test_openssl_cipher_suites_plugin.py

示例3: test_optional_client_auth

# 需要导入模块: from sslyze.server_connectivity_tester import ServerConnectivityTester [as 别名]
# 或者: from sslyze.server_connectivity_tester.ServerConnectivityTester import perform [as 别名]
    def test_optional_client_auth(self):
        # Given a server that supports optional client authentication
        with ModernOpenSslServer(client_auth_config=ClientAuthConfigEnum.OPTIONAL) as server:
            server_test = ServerConnectivityTester(
                hostname=server.hostname,
                ip_address=server.ip_address,
                port=server.port
            )
            server_info = server_test.perform()

        # SSLyze correctly detects that client auth is optional
        assert server_info.client_auth_requirement == ClientAuthenticationServerConfigurationEnum.OPTIONAL
开发者ID:nabla-c0d3,项目名称:sslyze,代码行数:14,代码来源:test_client_authentication.py

示例4: test_required_client_auth_tls_1_2

# 需要导入模块: from sslyze.server_connectivity_tester import ServerConnectivityTester [as 别名]
# 或者: from sslyze.server_connectivity_tester.ServerConnectivityTester import perform [as 别名]
    def test_required_client_auth_tls_1_2(self):
        # Given a TLS 1.2 server that requires client authentication
        with LegacyOpenSslServer(client_auth_config=ClientAuthConfigEnum.REQUIRED) as server:
            server_test = ServerConnectivityTester(
                hostname=server.hostname,
                ip_address=server.ip_address,
                port=server.port
            )
            server_info = server_test.perform()

        # SSLyze correctly detects that client auth is required
        assert server_info.client_auth_requirement == ClientAuthenticationServerConfigurationEnum.REQUIRED
开发者ID:nabla-c0d3,项目名称:sslyze,代码行数:14,代码来源:test_client_authentication.py

示例5: test_required_client_auth_tls_1_3

# 需要导入模块: from sslyze.server_connectivity_tester import ServerConnectivityTester [as 别名]
# 或者: from sslyze.server_connectivity_tester.ServerConnectivityTester import perform [as 别名]
    def test_required_client_auth_tls_1_3(self):
        # Given a TLS 1.3 server that requires client authentication
        with ModernOpenSslServer(client_auth_config=ClientAuthConfigEnum.REQUIRED) as server:
            server_test = ServerConnectivityTester(
                hostname=server.hostname,
                ip_address=server.ip_address,
                port=server.port
            )
            server_info = server_test.perform()

        # SSLyze correctly detects that client auth is required
        # TODO(AD): Fix this bug; it should be REQUIRED
        assert server_info.client_auth_requirement == ClientAuthenticationServerConfigurationEnum.OPTIONAL
开发者ID:nabla-c0d3,项目名称:sslyze,代码行数:15,代码来源:test_client_authentication.py

示例6: test_expect_ct_disabled

# 需要导入模块: from sslyze.server_connectivity_tester import ServerConnectivityTester [as 别名]
# 或者: from sslyze.server_connectivity_tester.ServerConnectivityTester import perform [as 别名]
    def test_expect_ct_disabled(self):
        server_test = ServerConnectivityTester(hostname='hsts.badssl.com')
        server_info = server_test.perform()

        plugin = HttpHeadersPlugin()
        plugin_result = plugin.process_task(server_info, HttpHeadersScanCommand())

        assert not plugin_result.expect_ct_header

        assert plugin_result.as_text()
        assert plugin_result.as_xml()

        assert pickle.dumps(plugin_result)
开发者ID:nabla-c0d3,项目名称:sslyze,代码行数:15,代码来源:test_http_headers_plugin.py

示例7: test_compression_disabled

# 需要导入模块: from sslyze.server_connectivity_tester import ServerConnectivityTester [as 别名]
# 或者: from sslyze.server_connectivity_tester.ServerConnectivityTester import perform [as 别名]
    def test_compression_disabled(self):
        server_test = ServerConnectivityTester(hostname='www.google.com')
        server_info = server_test.perform()

        plugin = CompressionPlugin()
        plugin_result = plugin.process_task(server_info, CompressionScanCommand())

        assert not plugin_result.compression_name

        assert plugin_result.as_text()
        assert plugin_result.as_xml()

        # Ensure the results are pickable so the ConcurrentScanner can receive them via a Queue
        assert pickle.dumps(plugin_result)
开发者ID:nabla-c0d3,项目名称:sslyze,代码行数:16,代码来源:test_compression_plugin.py

示例8: test_heartbleed_good

# 需要导入模块: from sslyze.server_connectivity_tester import ServerConnectivityTester [as 别名]
# 或者: from sslyze.server_connectivity_tester.ServerConnectivityTester import perform [as 别名]
    def test_heartbleed_good(self):
        server_test = ServerConnectivityTester(hostname='www.google.com')
        server_info = server_test.perform()

        plugin = HeartbleedPlugin()
        plugin_result = plugin.process_task(server_info, HeartbleedScanCommand())

        assert not plugin_result.is_vulnerable_to_heartbleed

        assert plugin_result.as_text()
        assert plugin_result.as_xml()

        # Ensure the results are pickable so the ConcurrentScanner can receive them via a Queue
        assert pickle.dumps(plugin_result)
开发者ID:nabla-c0d3,项目名称:sslyze,代码行数:16,代码来源:test_heartbleed_plugin.py


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