Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
command = Tlsv10ScanCommand()
scan_result = scanner.run_scan_command(server_info, command)
print(G+" [+] Available TLS v1.0 Ciphers:"+color.TR2+C)
for cipher in scan_result.accepted_cipher_list:
print(C+' {}'.format(cipher.name))
print('')
command = Tlsv11ScanCommand()
scan_result = scanner.run_scan_command(server_info, command)
print(G+" [+] Available TLS v1.1 Ciphers:"+color.TR2+C)
for cipher in scan_result.accepted_cipher_list:
print(C+' {}'.format(cipher.name))
print('')
command = Tlsv12ScanCommand()
scan_result = scanner.run_scan_command(server_info, command)
print(G+" [+] Available TLS v1.2 Ciphers:"+color.TR2+C)
for cipher in scan_result.accepted_cipher_list:
print(C+' {}'.format(cipher.name))
print('')
command = CertificateInfoScanCommand()
scan_result = scanner.run_scan_command(server_info, command)
print(G+' [+] Certificate Information:'+color.TR2+C)
for entry in scan_result.as_text():
if entry != '':
if 'certificate information' in entry.lower():
pass
elif ':' in entry:
print(GR+' [+] '+entry.strip().split(':', 1)[0].strip()+' : '+C+entry.strip().split(':', 1)[1].strip())
else:
mini_length = 256
start_time = None
end_time = None
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":
command = Tlsv10ScanCommand()
scan_result = scanner.run_scan_command(server_info, command)
print(G+" [+] Available TLS v1.0 Ciphers:")
for cipher in scan_result.accepted_cipher_list:
print(C+' {}'.format(cipher.name))
print('')
command = Tlsv11ScanCommand()
scan_result = scanner.run_scan_command(server_info, command)
print(G+" [+] Available TLS v1.1 Ciphers:")
for cipher in scan_result.accepted_cipher_list:
print(C+' {}'.format(cipher.name))
print('')
command = Tlsv12ScanCommand()
scan_result = scanner.run_scan_command(server_info, command)
print(G+" [+] Available TLS v1.2 Ciphers:")
for cipher in scan_result.accepted_cipher_list:
print(C+' {}'.format(cipher.name))
print('')
command = CertificateInfoScanCommand()
scan_result = scanner.run_scan_command(server_info, command)
print(G+' [+] Certificate Information:')
for entry in scan_result.as_text():
if entry != '':
if 'certificate information' in entry.lower():
pass
elif ':' in entry:
print(GR+' [+] '+entry.strip().split(':', 1)[0].strip()+' : '+C+entry.strip().split(':', 1)[1].strip())
else:
def get_ssl_cipher_suite_commands():
"""
Get a list of tuples containing (1) the SSL protocol string and (2) the Sslyze command to test
for connectivity for the given SSL protocol.
:return: A list of tuples containing (1) the SSL protocol string and (2) the Sslyze command to test
for connectivity for the given SSL protocol.
"""
return [
("sslv2", Sslv20ScanCommand),
("sslv3", Sslv30ScanCommand),
("tlsv1", Tlsv10ScanCommand),
("tlsv1.1", Tlsv11ScanCommand),
("tlsv1.2", Tlsv12ScanCommand),
]
def ssl_scan(self, target):
print("Running SSL Scan")
try:
server_tester = ServerConnectivityTester(hostname=target)
server_info = server_tester.perform()
synchronous_scanner = SynchronousScanner()
# TLS 1.0
command = Tlsv10ScanCommand()
scan_result = synchronous_scanner.run_scan_command(server_info, command)
print("Available TLSv1.0 Ciphers:")
for cipher in scan_result.accepted_cipher_list:
print(' {}'.format(cipher.name))
# TLSv1.2
command = Tlsv12ScanCommand()
scan_result = synchronous_scanner.run_scan_command(server_info, command)
print("Available TLSv1.2 Ciphers:")
for cipher in scan_result.accepted_cipher_list:
print(' {}'.format(cipher.name))
# Certificate information
command = CertificateInfoScanCommand()
scan_result = synchronous_scanner.run_scan_command(server_info, command)
for entry in scan_result.as_text():
print(entry)
# Heartbleed vulnerability info
command = HeartbleedScanCommand()
scan_result = synchronous_scanner.run_scan_command(server_info, command)
for entry in scan_result.as_text():
print(entry)