Skip to content

Instantly share code, notes, and snippets.

@sandeepraju
Last active November 12, 2018 21:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandeepraju/74f846ed37b10bd61f21 to your computer and use it in GitHub Desktop.
Save sandeepraju/74f846ed37b10bd61f21 to your computer and use it in GitHub Desktop.
script to test cipher suite using openssl
#!/usr/bin/env bash
# usage: ./cipher_checker google.com 443
# Cipher checker by indiv
# http://superuser.com/a/224263/204745
# OpenSSL requires the port number.
SERVER=$1:$2
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" =~ "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
@skyvast404
Copy link

Hello, I want make a protocol checker, do you have any good ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment