Skip to content

Instantly share code, notes, and snippets.

@2xyo
Forked from degan/gist:70e8059507d173751294
Last active August 29, 2015 14:16
Show Gist options
  • Save 2xyo/d04d9a0d383fbd603dd4 to your computer and use it in GitHub Desktop.
Save 2xyo/d04d9a0d383fbd603dd4 to your computer and use it in GitHub Desktop.
FREAK Attack server test + timeout 3s
#!/usr/bin/env bash
#base script http://serverfault.com/questions/519402/how-to-determine-ssl-cipher-strength
if [ $# -eq 0 ]
then
echo "No domain argument!"
exit 1
fi
# OpenSSL requires the port number.
SERVER=$1:443
DELAY=1
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
TIMEOUT=3
echo Obtaining cipher list from $(openssl version).
for cipher in ${ciphers[@]}
do
if [[ "$cipher" =~ "EXP" ]] ; then
echo -n Testing $cipher...
result=$(echo -n | timeout ${TIMEOUT} openssl s_client -cipher "$cipher" -connect $SERVER 2>&1)
if [[ "$result" =~ "Cipher is ${cipher}" || "$result" =~ "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
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment