Last active
October 27, 2017 10:35
-
-
Save cmbuckley/c2419b7f1c8ca6398131ab62934f5804 to your computer and use it in GitHub Desktop.
List the SAN extension domain names contained in an SSL cert on a given domain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
domain=$1 | |
[[ $domain != *":"* ]] && domain="$domain:443" | |
openssl s_client -connect $domain 2>/dev/null </dev/null \ | |
| openssl x509 -noout -text \ | |
| grep -A1 'Subject Alternative Name:' \ | |
| awk 'BEGIN{RS=",";FS=":"}{print $NF}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment