24 lines
818 B
Python
24 lines
818 B
Python
import socket
|
|
import ssl
|
|
|
|
def check_cert(domain, ip="174.106.252.96"):
|
|
print(f"=== Checking SSL for {domain} at {ip}:443 ===")
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = True
|
|
try:
|
|
with socket.create_connection((ip, 443), timeout=5) as sock:
|
|
with ctx.wrap_socket(sock, server_hostname=domain) as ssock:
|
|
cert = ssock.getpeercert()
|
|
print("Cert Subject:", cert.get('subject'))
|
|
print("SAN:", cert.get('subjectAltName'))
|
|
print("Cipher:", ssock.cipher())
|
|
print("ALPN:", ssock.selected_alpn_protocol())
|
|
except Exception as e:
|
|
print("SSL Error:", e)
|
|
|
|
check_cert('pihole1.snarfnet.net')
|
|
check_cert('pihole2.snarfnet.net')
|
|
check_cert('dns1.snarfnet.net')
|
|
check_cert('dns2.snarfnet.net')
|
|
|