Untitled
unknown
plain_text
a year ago
1.6 kB
5
Indexable
#!/bin/bash
# Usage: ./sslcheck.sh <hostname> [port]
# Default port is 443 if not specified
HOST=$1
PORT=${2:-443}
if [ -z "$HOST" ]; then
echo "Usage: $0 <hostname> [port]"
exit 1
fi
echo "SSL Scan Results for $HOST:$PORT"
echo "==============================="
echo
# Test SSL/TLS Protocols
function check_protocol() {
local PROTOCOL=$1
echo "Testing $PROTOCOL..."
if echo | openssl s_client -connect "$HOST:$PORT" -$PROTOCOL > /dev/null 2>&1; then
echo "$PROTOCOL supported"
else
echo "$PROTOCOL not supported"
fi
}
echo "Checking SSL/TLS Protocols:"
check_protocol ssl2
check_protocol ssl3
check_protocol tls1
check_protocol tls1_1
check_protocol tls1_2
check_protocol tls1_3
echo
# Fetch Certificate Information
echo "Certificate Information:"
openssl s_client -connect "$HOST:$PORT" -servername "$HOST" < /dev/null 2>/dev/null | openssl x509 -noout -dates -subject -issuer
echo
# Fetch Cipher Suites
echo "Available Cipher Suites:"
openssl s_client -connect "$HOST:$PORT" -cipher ALL < /dev/null 2>/dev/null | grep -i "Cipher is"
echo
# Check Certificate Expiration
echo "Checking Certificate Expiry Date:"
openssl s_client -connect "$HOST:$PORT" -servername "$HOST" 2>/dev/null | openssl x509 -noout -enddate
echo
# Output Supported Ciphers by openssl
echo "Supported Cipher List (from OpenSSL):"
openssl ciphers -v
echo
# Fetch Public Key Info
echo "Public Key Information:"
openssl s_client -connect "$HOST:$PORT" -servername "$HOST" < /dev/null 2>/dev/null | openssl x509 -noout -pubkey | openssl pkey -pubin -text -noout
echoEditor is loading...
Leave a Comment