SSLScan
Installation
Seção intitulada “Installation”Debian/Ubuntu
Seção intitulada “Debian/Ubuntu”sudo apt-get install sslscan
RHEL/CentOS
Seção intitulada “RHEL/CentOS”sudo yum install sslscan
brew install sslscan
From Source
Seção intitulada “From Source”git clone https://github.com/rbsec/sslscan.git
cd sslscan
./configure
make
sudo make install
docker pull nmap/nmap:latest
docker run -it nmap/nmap sslscan example.com:443
Basic Scanning
Seção intitulada “Basic Scanning”Simple Host Scan
Seção intitulada “Simple Host Scan”sslscan example.com
sslscan example.com:443
Scan Non-Standard Port
Seção intitulada “Scan Non-Standard Port”sslscan example.com:8443
Verbose Output
Seção intitulada “Verbose Output”sslscan --no-failed example.com
sslscan -v example.com
Quiet Mode
Seção intitulada “Quiet Mode”sslscan -q example.com
Certificate Details
Seção intitulada “Certificate Details”View Certificate Information
Seção intitulada “View Certificate Information”sslscan --show-certificate example.com
Extract Certificate Chain
Seção intitulada “Extract Certificate Chain”sslscan --show-certificate example.com | grep -A 50 "Certificate"
Check Certificate Expiry
Seção intitulada “Check Certificate Expiry”echo | openssl s_client -connect example.com:443 2>/dev/null | openssl x509 -noout -dates
Validate Certificate Chain
Seção intitulada “Validate Certificate Chain”sslscan --show-certificate example.com
Certificate Issuer Details
Seção intitulada “Certificate Issuer Details”openssl s_client -connect example.com:443 </dev/null 2>/dev/null | openssl x509 -text -noout
Cipher Enumeration
Seção intitulada “Cipher Enumeration”List All Supported Ciphers
Seção intitulada “List All Supported Ciphers”sslscan example.com
Identify Weak Ciphers
Seção intitulada “Identify Weak Ciphers”sslscan example.com | grep -i "weak"
Filter by Cipher Strength
Seção intitulada “Filter by Cipher Strength”sslscan example.com | grep -E "256|128|64"
Export Cipher List
Seção intitulada “Export Cipher List”sslscan example.com > ciphers.txt
Test Specific Cipher
Seção intitulada “Test Specific Cipher”openssl s_client -connect example.com:443 -cipher 'DES-CBC3-SHA' 2>/dev/null | head -n 20
Protocol Detection
Seção intitulada “Protocol Detection”Check SSL/TLS Versions
Seção intitulada “Check SSL/TLS Versions”sslscan example.com
Test for SSLv2 (Deprecated)
Seção intitulada “Test for SSLv2 (Deprecated)”sslscan example.com | grep -i "sslv2"
Test for SSLv3 (Deprecated)
Seção intitulada “Test for SSLv3 (Deprecated)”sslscan example.com | grep -i "sslv3"
Test for TLS 1.0/1.1 (Legacy)
Seção intitulada “Test for TLS 1.0/1.1 (Legacy)”sslscan example.com | grep -E "TLSv1\.0|TLSv1\.1"
Test for TLS 1.2+
Seção intitulada “Test for TLS 1.2+”sslscan example.com | grep -E "TLSv1\.[2-3]"
Protocol-Specific Tests
Seção intitulada “Protocol-Specific Tests”openssl s_client -connect example.com:443 -ssl2 # SSLv2
openssl s_client -connect example.com:443 -ssl3 # SSLv3
openssl s_client -connect example.com:443 -tls1 # TLSv1.0
openssl s_client -connect example.com:443 -tls1_1 # TLSv1.1
openssl s_client -connect example.com:443 -tls1_2 # TLSv1.2
openssl s_client -connect example.com:443 -tls1_3 # TLSv1.3
Vulnerability Detection
Seção intitulada “Vulnerability Detection”Check for Heartbleed (CVE-2014-0160)
Seção intitulada “Check for Heartbleed (CVE-2014-0160)”sslscan example.com | grep -i "heartbleed"
Test Heartbleed Directly
Seção intitulada “Test Heartbleed Directly”echo -n "Q" | openssl s_client -connect example.com:443 2>/dev/null | grep -i heartbeat
Check for POODLE (CVE-2014-3566)
Seção intitulada “Check for POODLE (CVE-2014-3566)”sslscan example.com | grep -i "poodle\|sslv3"
Check for BEAST (CVE-2011-3389)
Seção intitulada “Check for BEAST (CVE-2011-3389)”sslscan example.com | grep -E "TLSv1\.0|CBC"
Check for CRIME (CVE-2012-4929)
Seção intitulada “Check for CRIME (CVE-2012-4929)”sslscan example.com | grep -i "compression"
Check for FREAK (CVE-2015-0204)
Seção intitulada “Check for FREAK (CVE-2015-0204)”sslscan example.com | grep -i "weak.*key\|512.*rsa"
Check for RC4 (Weak Cipher)
Seção intitulada “Check for RC4 (Weak Cipher)”sslscan example.com | grep -i "rc4"
Check for DROWN (CVE-2016-0800)
Seção intitulada “Check for DROWN (CVE-2016-0800)”sslscan example.com | grep -i "sslv2"
Full Vulnerability Report
Seção intitulada “Full Vulnerability Report”sslscan --no-failed example.com | grep -iE "vulnerable|weak|sslv2|sslv3|heartbleed|poodle"
STARTTLS Support
Seção intitulada “STARTTLS Support”SMTP (Port 25/587)
Seção intitulada “SMTP (Port 25/587)”sslscan --starttls example.com:25
sslscan --starttls example.com:587
IMAP (Port 143)
Seção intitulada “IMAP (Port 143)”sslscan --starttls example.com:143
POP3 (Port 110)
Seção intitulada “POP3 (Port 110)”sslscan --starttls example.com:110
FTP (Port 21)
Seção intitulada “FTP (Port 21)”sslscan --starttls example.com:21
LDAP (Port 389)
Seção intitulada “LDAP (Port 389)”sslscan --starttls example.com:389
XMPP (Port 5222)
Seção intitulada “XMPP (Port 5222)”sslscan --starttls example.com:5222
Check STARTTLS Availability
Seção intitulada “Check STARTTLS Availability”echo "EHLO example.com" | nc example.com 25 | grep -i "starttls"
Output Formats
Seção intitulada “Output Formats”XML Output
Seção intitulada “XML Output”sslscan --xml=report.xml example.com
Parse XML Report
Seção intitulada “Parse XML Report”cat report.xml | grep -E "protocol|cipher|certificate"
Human-Readable Output
Seção intitulada “Human-Readable Output”sslscan example.com > report.txt
JSON-like Format (via grep)
Seção intitulada “JSON-like Format (via grep)”sslscan example.com | awk '{print $0}' > report.json
Redirect to File
Seção intitulada “Redirect to File”sslscan example.com 2>&1 | tee report.log
Generate and Compare Reports
Seção intitulada “Generate and Compare Reports”sslscan example.com > baseline.txt
sslscan example.com > current.txt
diff baseline.txt current.txt
Batch Scanning
Seção intitulada “Batch Scanning”Scan Multiple Hosts from List
Seção intitulada “Scan Multiple Hosts from List”cat hosts.txt | while read host; do sslscan "$host" >> results.txt; done
Scan Host List with Ports
Seção intitulada “Scan Host List with Ports”while IFS=: read -r host port; do sslscan "$host:$port" >> batch-results.txt; done < hosts.txt
Parallel Batch Scanning
Seção intitulada “Parallel Batch Scanning”cat hosts.txt | xargs -P 5 -I {} sslscan {} > batch-results.txt
Scan Entire CIDR Range (via nmap)
Seção intitulada “Scan Entire CIDR Range (via nmap)”nmap -p 443 10.0.0.0/24 -oG - | awk '/open/{print $2}' | while read ip; do sslscan "$ip"; done
Store Results in Database
Seção intitulada “Store Results in Database”for host in $(cat hosts.txt); do
sslscan --xml="$host.xml" "$host"
echo "Scanned: $host"
done
Track Changes Over Time
Seção intitulada “Track Changes Over Time”timestamp=$(date +%Y%m%d_%H%M%S)
sslscan example.com > "scans/example_$timestamp.txt"
Client Certificate Testing
Seção intitulada “Client Certificate Testing”Scan with Client Certificate
Seção intitulada “Scan with Client Certificate”sslscan --client-cert=cert.pem --client-key=key.pem example.com
Test Mutual TLS (mTLS)
Seção intitulada “Test Mutual TLS (mTLS)”openssl s_client -cert client.pem -key client-key.pem -connect example.com:443
Verify Client Certificate Chain
Seção intitulada “Verify Client Certificate Chain”openssl verify -CAfile ca-chain.pem client.pem
Extract Client Certificate from File
Seção intitulada “Extract Client Certificate from File”openssl x509 -in client.pem -text -noout
OCSP Stapling
Seção intitulada “OCSP Stapling”Check OCSP Stapling Status
Seção intitulada “Check OCSP Stapling Status”echo | openssl s_client -connect example.com:443 -tlsextdebug 2>/dev/null | grep -A 2 "OCSP"
Verify OCSP Response
Seção intitulada “Verify OCSP Response”echo | openssl s_client -connect example.com:443 -status 2>/dev/null | grep "OCSP response"
Detailed OCSP Check
Seção intitulada “Detailed OCSP Check”openssl s_client -connect example.com:443 -tlsextdebug 2>&1 | grep -i "ocsp"
Advanced Options
Seção intitulada “Advanced Options”Disable SNI (Server Name Indication)
Seção intitulada “Disable SNI (Server Name Indication)”sslscan --no-sni example.com
Set Custom Timeout
Seção intitulada “Set Custom Timeout”sslscan --timeout=10 example.com
Specify IP Address
Seção intitulada “Specify IP Address”sslscan --ip=192.168.1.1 example.com
Skip Host Name Verification
Seção intitulada “Skip Host Name Verification”sslscan --no-sni example.com
Test All Named Hosts (SNI)
Seção intitulada “Test All Named Hosts (SNI)”sslscan example.com
sslscan mail.example.com
Comparison: SSLScan vs testssl.sh vs sslyze
Seção intitulada “Comparison: SSLScan vs testssl.sh vs sslyze”| Feature | SSLScan | testssl.sh | sslyze |
|---|---|---|---|
| Language | C/C++ | Bash | Python |
| Speed | Fast | Medium | Fast |
| Protocols | SSL/TLS | SSL/TLS/HTTP/DNS | SSL/TLS |
| Vulnerability Checks | Basic | Comprehensive | Good |
| STARTTLS Support | Yes | Yes | Yes |
| Output Formats | Text, XML | Text, JSON, CSV | Text, JSON |
| Installation | Easy | No deps | Python required |
| Community | Active | Very Active | Active |
| CVE Coverage | Standard | Extensive | Good |
| Best For | Quick scans | Deep audits | Automated checks |
When to Use SSLScan
Seção intitulada “When to Use SSLScan”- Quick SSL/TLS configuration checks
- Simple vulnerability screening
- Batch scanning multiple hosts
- Resource-constrained environments
- CI/CD integration
When to Use testssl.sh
Seção intitulada “When to Use testssl.sh”- Comprehensive security audits
- Deep vulnerability analysis
- Regulatory compliance checks
- Edge case testing
- Maximum CVE coverage
When to Use sslyze
Seção intitulada “When to Use sslyze”- Automated security testing
- Python integration
- API-based scanning
- CI/CD pipelines
- Large-scale assessments
Real-World Examples
Seção intitulada “Real-World Examples”Audit Web Server Configuration
Seção intitulada “Audit Web Server Configuration”sslscan --show-certificate example.com | tee audit.txt
Monitor Certificate Expiry
Seção intitulada “Monitor Certificate Expiry”echo | openssl s_client -connect example.com:443 2>/dev/null | openssl x509 -noout -dates
Identify Non-Compliant Hosts
Seção intitulada “Identify Non-Compliant Hosts”sslscan example.com | grep -E "sslv2|sslv3|TLSv1\.0|weak" && echo "Non-compliant" || echo "Compliant"
Generate Compliance Report
Seção intitulada “Generate Compliance Report”sslscan --no-failed example.com > compliance-report.txt
Test After Configuration Change
Seção intitulada “Test After Configuration Change”sslscan example.com > before.txt
# Update SSL/TLS config
sslscan example.com > after.txt
diff before.txt after.txt
Find All Weak Ciphers in Environment
Seção intitulada “Find All Weak Ciphers in Environment”for host in web1 web2 web3; do
echo "=== $host ===" >> weak-ciphers.txt
sslscan "$host" | grep -i "weak" >> weak-ciphers.txt
done