Skip to content

Instantly share code, notes, and snippets.

@UmbrielSecurity
Created January 13, 2017 15:30
Show Gist options
  • Save UmbrielSecurity/cda85c486a932ecfdb508de240c946d3 to your computer and use it in GitHub Desktop.
Save UmbrielSecurity/cda85c486a932ecfdb508de240c946d3 to your computer and use it in GitHub Desktop.
Enumerate supported SSL ciphers
#!/usr/bin/env bash
# @UmbrielSecurity
# OpenSSL requires the port number.
if [ ! -z $1 ]; then
SERVER=$1
else
echo Usage: ./scan-ciphers.sh HOSTNAME:PORT
exit
fi
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