1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
#!/usr/bin/env python import sys sys.path.insert(0, "../../") from netlib import tcp def get_remote_cert(host, port, sni): c = tcp.TCPClient((host, port)) c.connect() c.convert_to_ssl(sni=sni) return c.cert if len(sys.argv) > 2: port = int(sys.argv[2]) else: port = 443 if len(sys.argv) > 3: sni = sys.argv[3] else: sni = None cert = get_remote_cert(sys.argv[1], port, sni) print("CN:", cert.cn) if cert.altnames: print("SANs:") for i in cert.altnames: print("\t", i) it' href='ssh://git@git.panaceas.org/git/openwrt/tpl-mr3040-bis/trunk-36060' title='openwrt/tpl-mr3040-bis/trunk-36060 Git repository'/>