Skip to content

Instantly share code, notes, and snippets.

@jim80net
Created June 25, 2014 21:54
Show Gist options
  • Save jim80net/d1299de0b3b667ce4a8b to your computer and use it in GitHub Desktop.
Save jim80net/d1299de0b3b667ce4a8b to your computer and use it in GitHub Desktop.
Test SSL handshake against known handshake methods
#!/usr/bin/env bash
# http://superuser.com/questions/109213/is-there-a-tool-that-can-test-what-ssl-tls-cipher-suites-a-particular-website-of
# OpenSSL requires the port number.
SERVER=$1
DELAY=0
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
echo Obtaining cipher list from $(openssl version).
for cipher in ${ciphers[@]}
do
echo -n Testing $cipher...
result=$(echo -n | openssl s_client -cipher "$cipher" -connect $SERVER 2>&1)
if [[ "$result" =~ "Cipher is ${cipher}" ]] ; then
echo YES
else
if [[ "$result" =~ ":error:" ]] ; then
error=$(echo -n $result | cut -d':' -f6)
echo NO \($error\)
else
echo UNKNOWN RESPONSE
echo $result
fi
fi
sleep $DELAY
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment