Skip to content

Instantly share code, notes, and snippets.

@MiPnamic
Created February 9, 2022 14:42
Show Gist options
  • Save MiPnamic/961f1f02f470fcfd34a6b0eb253871fc to your computer and use it in GitHub Desktop.
Save MiPnamic/961f1f02f470fcfd34a6b0eb253871fc to your computer and use it in GitHub Desktop.
Test a given URL with all available Cipher using OpenSSL
#!/usr/bin/env bash
# Test all ciphers against given URL
# Script by Indiv https://superuser.com/users/21867/indiv - https://superuser.com/a/224263
# OpenSSL requires the port number.
SERVER=$1
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