Untitled

 avatar
unknown
plain_text
6 months ago
1.6 kB
2
Indexable
#!/bin/bash

# Usage: ./check_tls_ssl.sh <domain or IP> <port>
DOMAIN=$1
PORT=$2

# Check if domain and port are provided
if [ -z "$DOMAIN" ] || [ -z "$PORT" ]; then
    echo "Usage: $0 <domain or IP> <port>"
    exit 1
fi

# List of SSL/TLS versions to check
VERSIONS=("ssl3" "tls1" "tls1_1" "tls1_2" "tls1_3")

echo "Checking supported SSL/TLS versions and cipher suites for $DOMAIN:$PORT"
echo "---------------------------------------------------------------"

# Check SSL/TLS versions
for VERSION in "${VERSIONS[@]}"; do
    echo "Checking $VERSION..."
    openssl s_client -connect "$DOMAIN:$PORT" -$VERSION < /dev/null > /dev/null 2>&1
    if [ $? -eq 0 ]; then
        echo "$VERSION is supported."
    else
        echo "$VERSION is not supported."
    fi
done

echo "---------------------------------------------------------------"

# Check supported cipher suites
echo "Checking supported cipher suites..."

# Get list of all possible ciphers
CIPHERS=$(openssl ciphers 'ALL:COMPLEMENTOFALL' | sed -e 's/:/ /g')

# Show only supported ciphers
SUPPORTED_CIPHERS=()

for CIPHER in $CIPHERS; do
    openssl s_client -cipher "$CIPHER" -connect "$DOMAIN:$PORT" < /dev/null > /dev/null 2>&1
    if [ $? -eq 0 ]; then
        SUPPORTED_CIPHERS+=("$CIPHER")
    fi
done

if [ ${#SUPPORTED_CIPHERS[@]} -gt 0 ]; then
    echo "Supported cipher suites:"
    for CIPHER in "${SUPPORTED_CIPHERS[@]}"; do
        echo "  - $CIPHER"
    done
else
    echo "No supported cipher suites found."
fi

echo "---------------------------------------------------------------"
echo "SSL/TLS version and cipher suite check completed."
Editor is loading...
Leave a Comment