本文整理汇总了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
示例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)
示例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
示例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
示例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
示例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)
示例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)
示例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)