Exemplo n.º 1
0
def has_esni(hostname):
    esni = ESNICheck(hostname)
    (tls13, tls13_output) = esni.has_tls13()
    (dns, error, dns_output) = esni.has_dns()
    (host_ip, is_host_cf) = esni.is_cloudflare()

    result = dict()

    result["tls13"] = {}
    result["tls13"]["enabled"] = True if tls13 else False
    result["tls13"]["output"] = tls13_output

    result["dns"] = {}
    result["dns"]["enabled"] = True if dns else False
    result["dns"]["output"] = dns_output
    result["dns"]["error"] = error

    result["hostname"] = hostname
    result["has_esni"] = esni.has_esni()
    result["host_ip"] = host_ip
    result["is_host_cf"] = is_host_cf
    return result
Exemplo n.º 2
0
def test_has_tls13():
    check = ESNICheck("127.0.0.1")
    assert (False, "Unable to connect to port 443") == check.has_tls13()
    ssl_check = ESNICheck(" ")
    assert (False, "Hostname lookup failed") == ssl_check.has_tls13()