tlsenum/__init__.py
def cli(host, port):
    """
    A command line tool to enumerate TLS cipher-suites supported by a server.

    """
    cipher_suites_list = [i.name for i in CipherSuites]

    extension = Extensions()
    extension.sni = host
    extension.ec_curves = [i.name for i in ECCurves]
    extension.ec_point_format = [i.name for i in ECPointFormat]

    client_hello = ClientHello()
    client_hello.deflate = False
    client_hello.extensions = extension.build()
    client_hello.cipher_suites = cipher_suites_list

    supported_tls_versions = []

    try:
        send_sslv2_client_hello(host, port)
        supported_tls_versions.append("2.0")
    except HandshakeFailure:
        pass

    for i in TLSProtocolVersion:
        client_hello.protocol_version = i
        try:
            server_hello = send_client_hello(host, port, client_hello.build())
            server_hello = ServerHello.parse_server_hello(server_hello)
        except HandshakeFailure:
            continue

        except ProtocolVersionFailure:
            continue

        supported_tls_versions.append(server_hello.protocol_version)

    supported_tls_versions = sorted(
        list(set(supported_tls_versions)),
        key=lambda x: 0 if x == "2.0" else TLSProtocolVersion.index(x) + 1
    )

    print("TLS Versions supported by server: {0}".format(
        ", ".join(supported_tls_versions)
    ))

    client_hello.protocol_version = supported_tls_versions[-1]
    client_hello.deflate = True

    try:
        server_hello = send_client_hello(host, port, client_hello.build())
        server_hello = ServerHello.parse_server_hello(server_hello)
    except HandshakeFailure:
        pass

    print("Deflate compression: {0}".format(
        "Yes" if server_hello.deflate else "No"
    ))

    client_hello.deflate = False

    supported_cipher_suites = []

    print("Supported Cipher suites in order of priority: ")

    while True:
        client_hello.cipher_suites = cipher_suites_list
        try:
            server_hello = send_client_hello(host, port, client_hello.build())
            server_hello = ServerHello.parse_server_hello(server_hello)
        except HandshakeFailure:
            break

        supported_cipher_suites.append(server_hello.cipher_suite)
        cipher_suites_list.remove(server_hello.cipher_suite)

    for i in supported_cipher_suites:
        print(i)

    A command line tool to enumerate TLS cipher-suites supported by a server.

    
A command line tool to enumerate TLS cipher-suites supported by a server.
A command line tool to enumerate TLS cipher - suites supported by a server .
def cli(host, port):
    cipher_suites_list = [i.name for i in CipherSuites]
    extension = Extensions()
    extension.sni = host
    extension.ec_curves = [i.name for i in ECCurves]
    extension.ec_point_format = [i.name for i in ECPointFormat]
    client_hello = ClientHello()
    client_hello.deflate = False
    client_hello.extensions = extension.build()
    client_hello.cipher_suites = cipher_suites_list
    supported_tls_versions = []
    try:
        send_sslv2_client_hello(host, port)
        supported_tls_versions.append("2.0")
    except HandshakeFailure:
        pass
    for i in TLSProtocolVersion:
        client_hello.protocol_version = i
        try:
            server_hello = send_client_hello(host, port, client_hello.build())
            server_hello = ServerHello.parse_server_hello(server_hello)
        except HandshakeFailure:
            continue
        except ProtocolVersionFailure:
            continue
        supported_tls_versions.append(server_hello.protocol_version)
    supported_tls_versions = sorted(
        list(set(supported_tls_versions)),
        key=lambda x: 0 if x == "2.0" else TLSProtocolVersion.index(x) + 1
    )
    print("TLS Versions supported by server: {0}".format(
        ", ".join(supported_tls_versions)
    ))
    client_hello.protocol_version = supported_tls_versions[-1]
    client_hello.deflate = True
    try:
        server_hello = send_client_hello(host, port, client_hello.build())
        server_hello = ServerHello.parse_server_hello(server_hello)
    except HandshakeFailure:
        pass
    print("Deflate compression: {0}".format(
        "Yes" if server_hello.deflate else "No"
    ))
    client_hello.deflate = False
    supported_cipher_suites = []
    print("Supported Cipher suites in order of priority: ")
    while True:
        client_hello.cipher_suites = cipher_suites_list
        try:
            server_hello = send_client_hello(host, port, client_hello.build())
            server_hello = ServerHello.parse_server_hello(server_hello)
        except HandshakeFailure:
            break
        supported_cipher_suites.append(server_hello.cipher_suite)
        cipher_suites_list.remove(server_hello.cipher_suite)
    for i in supported_cipher_suites:
        print(i)
def cli ( host , port ) : cipher_suites_list = [ i . name for i in CipherSuites ] extension = Extensions ( ) extension . sni = host extension . ec_curves = [ i . name for i in ECCurves ] extension . ec_point_format = [ i . name for i in ECPointFormat ] client_hello = ClientHello ( ) client_hello . deflate = False client_hello . extensions = extension . build ( ) client_hello . cipher_suites = cipher_suites_list supported_tls_versions = [ ] try : send_sslv2_client_hello ( host , port ) supported_tls_versions . append ( "2.0" ) except HandshakeFailure : pass for i in TLSProtocolVersion : client_hello . protocol_version = i try : server_hello = send_client_hello ( host , port , client_hello . build ( ) ) server_hello = ServerHello . parse_server_hello ( server_hello ) except HandshakeFailure : continue except ProtocolVersionFailure : continue supported_tls_versions . append ( server_hello . protocol_version ) supported_tls_versions = sorted ( list ( set ( supported_tls_versions ) ) , key = lambda x : 0 if x == "2.0" else TLSProtocolVersion . index ( x ) + 1 ) print ( "TLS Versions supported by server: {0}" . format ( ", " . join ( supported_tls_versions ) ) ) client_hello . protocol_version = supported_tls_versions [ - 1 ] client_hello . deflate = True try : server_hello = send_client_hello ( host , port , client_hello . build ( ) ) server_hello = ServerHello . parse_server_hello ( server_hello ) except HandshakeFailure : pass print ( "Deflate compression: {0}" . format ( "Yes" if server_hello . deflate else "No" ) ) client_hello . deflate = False supported_cipher_suites = [ ] print ( "Supported Cipher suites in order of priority: " ) while True : client_hello . cipher_suites = cipher_suites_list try : server_hello = send_client_hello ( host , port , client_hello . build ( ) ) server_hello = ServerHello . parse_server_hello ( server_hello ) except HandshakeFailure : break supported_cipher_suites . append ( server_hello . cipher_suite ) cipher_suites_list . remove ( server_hello . cipher_suite ) for i in supported_cipher_suites : print ( i )
A command line tool to enumerate TLS cipher-suites supported by a server.
A command line tool to enumerate TLS cipher - suites supported by a server .
"""
    A command line tool to enumerate TLS cipher-suites supported by a server.

    """
host
port