From 082f398b8fdb8176c94271470df21f6e8f3faff6 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Thu, 3 Jan 2013 13:54:54 +1300 Subject: [PATCH] Add getcertnames, a tool for retrieving the CN and SANs from a remote server. --- tools/getcertnames | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 tools/getcertnames diff --git a/tools/getcertnames b/tools/getcertnames new file mode 100755 index 000000000..f39fc635e --- /dev/null +++ b/tools/getcertnames @@ -0,0 +1,16 @@ +#!/usr/bin/env python +import sys +sys.path.insert(0, "../../") +from netlib import certutils + +if len(sys.argv) > 2: + port = int(sys.argv[2]) +else: + port = 443 + +cert = certutils.get_remote_cert(sys.argv[1], port, None) +print "CN:", cert.cn +if cert.altnames: + print "SANs:", + for i in cert.altnames: + print "\t", i