Created
November 18, 2014 22:41
-
-
Save demofly/6af505ac0680f874d162 to your computer and use it in GitHub Desktop.
A script which allows to get a list of supported ciphers on a given server
This file contains hidden or 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 | |
# OpenSSL requires the port number. | |
SERVER=1.1.1.1:443 | |
DELAY=1 | |
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g') | |
# ========= main ============= | |
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" =~ "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 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment