Skip to content

Instantly share code, notes, and snippets.

@jqr
Created May 30, 2015 16:40
Show Gist options
  • Save jqr/75d6217e76101a30805a to your computer and use it in GitHub Desktop.
Save jqr/75d6217e76101a30805a to your computer and use it in GitHub Desktop.
Easy command line SSL certificate fingerprinting
#!#!/bin/bash
if [ $1 ]; then
echo -e "GET / HTTP\1.1\n" | openssl s_client -connect $1:443 2> /dev/null | openssl x509 -noout -fingerprint | cut -f2 -d'=' | head -n 1 2> /dev/null
else
echo "Usage: $0 <host>"
echo "Generates an SSL fingerprint for a host. Useful in comparing certificate changes."
echo
echo "Examples:"
echo " $0 google.com"
echo " $0 amazon.com"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment