Skip to content

Instantly share code, notes, and snippets.

@psanford
Created February 14, 2013 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psanford/4955124 to your computer and use it in GitHub Desktop.
Save psanford/4955124 to your computer and use it in GitHub Desktop.
Print out supported ciphers for a given host.
#!/bin/bash
# OpenSSL requires the port number.
SERVER=localhost:49164
DELAY=0.1
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
echo Obtaining cipher list from $(openssl version).
for cipher in ${ciphers[@]}
do
echo -n "$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