From 94deb959c824b655a579c21be5ed162e1885326d Mon Sep 17 00:00:00 2001 From: guessi Date: Wed, 4 Mar 2020 10:32:34 +0800 Subject: [PATCH] Support for displaying DNSNames --- README.md | 40 ++++++++++++++++++++++++++++------------ utils.go | 3 ++- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6e47381..1fe5d1f 100644 --- a/README.md +++ b/README.md @@ -15,23 +15,39 @@ check single target host certificates infomation ${GOPATH}/bin/ssl-certs-checker --hosts "www.google.com" - +----------------+----------------+-------------------------------+-------------------------------+------------+ - | Host | Common Name | Not Before | Not After | Issuer | - +----------------+----------------+-------------------------------+-------------------------------+------------+ - | www.google.com | www.google.com | 2020-02-12 11:47:41 +0000 UTC | 2020-05-06 11:47:41 +0000 UTC | GTS CA 1O1 | - +----------------+----------------+-------------------------------+-------------------------------+------------+ + +----------------+----------------+----------------+-------------------------------+-------------------------------+------------+ + | Host | Common Name | DNS Names | Not Before | Not After | Issuer | + +----------------+----------------+----------------+-------------------------------+-------------------------------+------------+ + | www.google.com | www.google.com | www.google.com | 2020-02-12 11:47:41 +0000 UTC | 2020-05-06 11:47:41 +0000 UTC | GTS CA 1O1 | + +----------------+----------------+----------------+-------------------------------+-------------------------------+------------+ check multiple target hosts' certificates at once ${GOPATH}/bin/ssl-certs-checker --hosts "www.google.com,www.azure.com,www.amazon.com" - +----------------+----------------+-------------------------------+-------------------------------+-----------------------+ - | Host | Common Name | Not Before | Not After | Issuer | - +----------------+----------------+-------------------------------+-------------------------------+-----------------------+ - | www.google.com | www.google.com | 2020-02-12 11:47:41 +0000 UTC | 2020-05-06 11:47:41 +0000 UTC | GTS CA 1O1 | - | www.azure.com | *.azure.com | 2019-12-17 19:51:44 +0000 UTC | 2020-12-17 19:51:44 +0000 UTC | Microsoft IT TLS CA 4 | - | www.amazon.com | www.amazon.com | 2019-09-18 00:00:00 +0000 UTC | 2020-08-23 12:00:00 +0000 UTC | DigiCert Global CA G2 | - +----------------+----------------+-------------------------------+-------------------------------+-----------------------+ + +----------------+----------------+---------------------------------------+-------------------------------+-------------------------------+-----------------------+ + | Host | Common Name | DNS Names | Not Before | Not After | Issuer | + +----------------+----------------+---------------------------------------+-------------------------------+-------------------------------+-----------------------+ + | www.google.com | www.google.com | www.google.com | 2020-02-12 11:47:41 +0000 UTC | 2020-05-06 11:47:41 +0000 UTC | GTS CA 1O1 | + | www.azure.com | *.azure.com | *.azure.com | 2019-12-17 19:51:44 +0000 UTC | 2020-12-17 19:51:44 +0000 UTC | Microsoft IT TLS CA 4 | + | www.amazon.com | www.amazon.com | amazon.com | 2019-09-18 00:00:00 +0000 UTC | 2020-08-23 12:00:00 +0000 UTC | DigiCert Global CA G2 | + | | | amzn.com | | | | + | | | uedata.amazon.com | | | | + | | | us.amazon.com | | | | + | | | www.amazon.com | | | | + | | | www.amzn.com | | | | + | | | corporate.amazon.com | | | | + | | | buybox.amazon.com | | | | + | | | iphone.amazon.com | | | | + | | | yp.amazon.com | | | | + | | | home.amazon.com | | | | + | | | origin-www.amazon.com | | | | + | | | buckeye-retail-website.amazon.com | | | | + | | | huddles.amazon.com | | | | + | | | p-nt-www-amazon-com-kalias.amazon.com | | | | + | | | p-yo-www-amazon-com-kalias.amazon.com | | | | + | | | p-y3-www-amazon-com-kalias.amazon.com | | | | + +----------------+----------------+---------------------------------------+-------------------------------+-------------------------------+-----------------------+ run with docker diff --git a/utils.go b/utils.go index 2a8bb37..6eb953d 100644 --- a/utils.go +++ b/utils.go @@ -44,7 +44,7 @@ func getCells(t table.Writer, h string) { continue } t.AppendRows([]table.Row{ - {h, (*c).Subject.CommonName, (*c).NotBefore, (*c).NotAfter, (*c).Issuer.CommonName}, + {h, (*c).Subject.CommonName, strings.Join((*c).DNSNames, "\n"), (*c).NotBefore, (*c).NotAfter, (*c).Issuer.CommonName}, }) } } @@ -57,6 +57,7 @@ func prettyPrintCertsInfo(h string) { t.AppendHeader(table.Row{ "Host", "Common Name", + "DNS Names", "Not Before", "Not After", "Issuer",