Skip to content

Instantly share code, notes, and snippets.

@n-johnson
Last active October 26, 2015 13:03
Show Gist options
  • Select an option

  • Save n-johnson/166200b7f0d435244aa9 to your computer and use it in GitHub Desktop.

Select an option

Save n-johnson/166200b7f0d435244aa9 to your computer and use it in GitHub Desktop.
ssl cert parsing
_ssl() {
local adr=$1;
local _d;
_d=$(
echo -n \
| openssl s_client -connect "$adr":443 2>/dev/null \
| openssl x509 -noout -text \
);
echo "Certifificate Subject:"
echo "$_d" | grep 'Subject:';
echo "SNI:"
echo "$_d" \
| grep "DNS" \
| tr ',' '\n' \
| awk -F':' '{print $2}';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment