From 6d1b601ddf070ef1335be1804386fa0f4a2fcbd4 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sat, 16 Aug 2014 15:53:07 +0200 Subject: minor cleanups --- tools/getcertnames | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/getcertnames b/tools/getcertnames index f39fc635..d22f4980 100755 --- a/tools/getcertnames +++ b/tools/getcertnames @@ -1,14 +1,25 @@ #!/usr/bin/env python import sys sys.path.insert(0, "../../") -from netlib import certutils +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 = certutils.get_remote_cert(sys.argv[1], port, None) +cert = get_remote_cert(sys.argv[1], port, sni) print "CN:", cert.cn if cert.altnames: print "SANs:", -- cgit v1.2.3