Skip to content

Instantly share code, notes, and snippets.

@darbym
Last active December 13, 2017 19:35
Show Gist options
  • Save darbym/0e57c38d5f5870f629db922c30cae1f1 to your computer and use it in GitHub Desktop.
Save darbym/0e57c38d5f5870f629db922c30cae1f1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
echo "ERROR: Usage: $0 <server_to_check> i.e. example.com"
exit 1
fi
if [ $# -eq 1 ]; then
SERVER=$1
fi
SERVER+=:443
echo "checking $SERVER"
DELAY=1
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" =~ ":error:" ]] ; then
error=$(echo -n $result | cut -d':' -f6)
echo NO \($error\)
else
if [[ "$result" =~ "Cipher is ${cipher}" || "$result" =~ "Cipher :" ]] ; then
echo YES
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