Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
server_tester = ServerConnectivityTester(hostname=url.netloc, port=url.port)
server_info = server_tester.perform()
except:
return error_result
synchronous_scanner = SynchronousScanner()
certificate_result = synchronous_scanner.run_scan_command(
server_info, CertificateInfoScanCommand()
)
cipher_result = synchronous_scanner.run_scan_command(
server_info, Tlsv12ScanCommand()
)
ccs_result = synchronous_scanner.run_scan_command(
server_info, OpenSslCcsInjectionScanCommand()
)
heartbleed_result = synchronous_scanner.run_scan_command(
server_info, HeartbleedScanCommand()
)
if certificate_result.leaf_certificate_subject_matches_hostname:
result_map["match"]["result"] = True
for result in certificate_result.as_text():
result_list = [x.strip() for x in result.split(": ")]
if len(result_list) == 2:
result_map["https"]["result"] = True
if result_list[0] == "Public Key Algorithm":
if result_list[1] == "_RSAPublicKey":
mini_length = 2048
if result_list[0] == "Key Size":
Get a dictionary that maps strings to commands supported by Sslyze for enumerating SSL-based
vulnerabilities.
:return: A dictionary that maps strings to commands supported by Sslyze for enumerating SSL-based
vulnerabilities.
"""
return {
"fallback_scsv": {
"command": FallbackScsvScanCommand,
"fields": ["supports_fallback_scsv"],
},
"heartbleed": {
"command": HeartbleedScanCommand,
"fields": ["is_vulnerable_to_heartbleed"],
},
"ccs_injection": {
"command": OpenSslCcsInjectionScanCommand,
"fields": ["is_vulnerable_to_ccs_injection"],
},
"session_renegotiation": {
"command": SessionRenegotiationScanCommand,
"fields": ["accepts_client_renegotiation", "supports_secure_renegotiation"],
},
"session_resumption": {
"command": SessionResumptionSupportScanCommand,
"fields": ["is_ticket_resumption_supported"],
},