I try to write a script like “sslscan” to scan and grab all cipher suites that a website is using.
this is my sample code, it just grab one cipher.
import ssl
import socket
def ssl_scan(hostname, port):
context = ssl.create_default_context()
with socket.create_connection((hostname, port)) as sock:
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
cipher_suites = ssock.cipher()
print(cipher_suites)
if __name__ == "__main__":
hostname = "host.co,"
port = 443
ssl_scan(hostname, port)
I want to print all cipher suites.