Created
November 5, 2021 00:44
-
-
Save manasmbellani/bb130e8ef453be223d3bc336808c0d19 to your computer and use it in GitHub Desktop.
get_domain_from_ssl_info_on_host.sh - Gets information from SSL cert information on host via openssl s_client
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 | |
USAGE="[-] $0 <hostname>" | |
if [ $# -lt 1 ]; then | |
echo "$USAGE" | |
exit 1 | |
fi | |
hostname="$1" | |
echo | openssl s_client -connect $hostname:443 2>&1 | grep -iE "0 s:.*CN = " | grep -ioE "CN = .*" | cut -d "=" -f2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment