Last active
September 27, 2016 14:25
-
-
Save pajtai/c9bcba7d60ab56292bde0ec4794f0566 to your computer and use it in GitHub Desktop.
Test open ssl cyphers for a domain. e.g.: ./test-ssl.sh example.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# source: http://superuser.com/a/224263/41059 | |
# OpenSSL requires the port number. | |
SERVER=$1:443 | |
DELAY=1 | |
echo Obtaining cipher list from $(openssl version). | |
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g') | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' # No Color]]' | |
OK="${GREEN}✔${NC} " | |
FAIL="${RED}✘${NC} " | |
for cipher in ${ciphers[@]} | |
do | |
result=$(echo -n | openssl s_client -cipher "$cipher" -connect $SERVER 2>&1) | |
if [[ "$result" =~ ":error:" ]] ; then | |
error=$(echo -n $result | cut -d':' -f6) | |
echo -e $FAIL $cipher ERROR \($error\) | |
else | |
if [[ "$result" =~ "Cipher is ${cipher}" || "$result" =~ "Cipher :" ]] ; then | |
echo -e $OK $cipher | |
else | |
echo -e "$FAIL $cipher \t\t\t $result" | |
fi | |
fi | |
sleep $DELAY | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment