Add getcertnames, a tool for retrieving the CN and SANs from a remote server.

This commit is contained in:
Aldo Cortesi 2013-01-03 13:54:54 +13:00
parent f8e10bd6ae
commit 082f398b8f
1 changed files with 16 additions and 0 deletions

16
tools/getcertnames Executable file
View File

@ -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