Aller au contenu

SSLyze

SSLyze is a powerful Python library and command-line tool for scanning SSL/TLS configurations on remote servers. It performs fast, thorough security assessments, detects vulnerabilities, and outputs results in JSON format for automation and CI/CD integration.

pip install sslyze
git clone https://github.com/nabla-c0d3/sslyze.git
cd sslyze
pip install .
sslyze --version
sslyze example.com
sslyze example.com:443
sslyze example.com google.com cloudflare.com
sslyze --timeout 30 example.com
sslyze --ipv6 example.com
sslyze --certinfo basic example.com
CommandDescription
--certinfo basicDisplay basic certificate details
--certinfo fullDisplay full certificate analysis
sslyze --ciphers example.com

Checks all supported cipher suites and displays strength ratings (A+, A, B, C, D, F).

sslyze --protocols example.com

Detects supported SSL/TLS versions (SSLv2, SSLv3, TLSv1.0, TLSv1.1, TLSv1.2, TLSv1.3).

sslyze --heartbleed example.com

Tests for the OpenSSL Heartbleed vulnerability (CVE-2014-0160).

sslyze --openssl_ccs example.com

Tests for OpenSSL ChangeCipherSpec (CCS) injection vulnerability (CVE-2014-0224).

sslyze --robot example.com

Tests for ROBOT vulnerability affecting RSA encryption (CVE-2017-13099).

sslyze --resumption example.com

Tests for session resumption support (session tickets and session IDs).

sslyze --compression example.com

Checks for TLS compression support (vulnerable to CRIME attack).

sslyze --stapling example.com

Verifies OCSP stapling support for certificate status.

sslyze --reneg example.com

Tests for secure renegotiation and unsafe renegotiation support.

sslyze --ciphers --protocols --heartbleed --robot example.com
sslyze --heartbleed --openssl_ccs --robot --compression example.com
sslyze --certinfo full --ciphers --protocols --heartbleed --openssl_ccs --robot --resumption --compression --stapling --reneg example.com
sslyze --json example.com > results.json
sslyze --json example.com | jq .
sslyze --json example.com > "scan_$(date +%Y%m%d_%H%M%S).json"
sslyze --json example.com | jq '.server_scan_result'

Filter specific vulnerability:

sslyze --json example.com | jq '.server_scan_result.heartbleed'
from sslyze import Scanner, ServerNetworkLocation

scanner = Scanner()
server = ServerNetworkLocation("example.com", 443)
results = scanner.scan(server)
print(results)
from sslyze import Scanner, ServerNetworkLocation
from sslyze.scan_commands import ScanCommand

scanner = Scanner()
server = ServerNetworkLocation("example.com")

# Run specific commands
scan_request = ScanRequest(
    server_location=server,
    scan_commands={
        ScanCommand.CERTIFICATE_INFO,
        ScanCommand.CIPHERS,
        ScanCommand.PROTOCOLS,
        ScanCommand.HEARTBLEED,
    }
)
results = scanner.run_scan_in_processes(scan_request, nb_processes=5)
from sslyze import Scanner, ServerNetworkLocation

scanner = Scanner()
server = ServerNetworkLocation("example.com")
results = scanner.scan(server)

# Check for vulnerabilities
for scan in results.scan_commands_results:
    if scan.vulnerable_to_heartbleed:
        print("VULNERABLE to Heartbleed!")
from sslyze import Scanner, ServerNetworkLocation
import socket

scanner = Scanner(timeout=30)  # 30 second timeout
server = ServerNetworkLocation("example.com")
results = scanner.scan(server)
ssl_scan:
  image: python:3.11
  script:
    - pip install sslyze
    - sslyze --json $CI_SERVER_HOST > results.json
    - |
      if grep -q '"VULNERABLE"' results.json; then
        echo "Vulnerabilities detected!"
        exit 1
      fi
  artifacts:
    paths:
      - results.json
name: SSL/TLS Security Scan
on: [push]
jobs:
  sslyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.11'
      - run: pip install sslyze
      - run: sslyze --json example.com > results.json
      - run: |
          if grep -q '"VULNERABLE"' results.json; then
            echo "SSL/TLS vulnerabilities found!"
            exit 1
          fi
      - uses: actions/upload-artifact@v3
        with:
          name: ssl-scan-results
          path: results.json
pipeline {
    agent any
    stages {
        stage('SSL Scan') {
            steps {
                sh '''
                    python -m pip install sslyze
                    sslyze --json example.com > sslyze_results.json
                '''
            }
        }
        stage('Parse Results') {
            steps {
                sh '''
                    if grep -q '"VULNERABLE"' sslyze_results.json; then
                        echo "SSL/TLS vulnerabilities detected!"
                        exit 1
                    fi
                '''
            }
        }
    }
}
sslyze --protocols --ciphers --certinfo full --heartbleed \
       --openssl_ccs --robot --reneg example.com

Key checks:

  • TLSv1.2 or higher required
  • Strong ciphers (grade A or higher)
  • Secure renegotiation enabled
  • No weak protocols (SSLv2, SSLv3, TLSv1.0, TLSv1.1)
sslyze --certinfo full --protocols --ciphers --compression example.com

Requirements:

  • Valid certificate chain
  • TLSv1.2 minimum
  • No TLS compression
  • Strong encryption algorithms
sslyze --protocols --ciphers --heartbleed --robot example.com

Validates against insecure TLS configuration vulnerabilities.

cat hosts.txt | xargs -I {} sslyze --json {} > {}_results.json
#!/bin/bash
for host in $(cat hosts.txt); do
    echo "Scanning $host..."
    sslyze --json "$host" > "${host}_results.json" 2>&1 || \
        echo "Error scanning $host" >> errors.log
done
cat hosts.txt | parallel sslyze --json {} '>' {}_results.json
FeatureSSLyzeSSLScanTestssl.sh
LanguagePythonC/OpenSSLBash
SpeedVery FastMediumSlower
JSON OutputYesLimitedYes
Python APIYesNoNo
STARTTLS SupportYesYesYes
Custom CiphersYesYesYes
Update FrequencyActiveLess ActiveVery Active
DocumentationGoodGoodExcellent
CI/CD IntegrationExcellentGoodGood
Resource UsageLowMediumMedium
Cross-PlatformYesYesYes

Choose SSLyze for: Fast automated scanning, CI/CD integration, JSON parsing, Python automation.

Choose SSLScan for: Simple CLI scanning, minimal dependencies.

Choose Testssl.sh for: Most comprehensive checks, edge-case coverage, detailed reporting.

sslyze --heartbleed --robot --openssl_ccs example.com
sslyze --json --certinfo full example.com | jq '.' > report.json
sslyze --certinfo basic example.com | grep "Not After"
sslyze --protocols example.com | grep TLSv1.3
sslyze --stapling example.com
sslyze --ciphers example.com | grep -i "grade: [D-F]"
sslyze --openssl_ccs example.com 2>/dev/null
sslyze example.com 2>&1 | logger -t sslyze
sslyze --json example.com | \
    jq --arg date "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
       '{timestamp: $date, results: .}' > scan.json
sslyze --json --certinfo full example.com | \
    jq '.[] | {host: .server, protocols: .protocols, ciphers: .ciphers}' \
    > host_report.json
#!/bin/bash
hosts=("example.com" "api.example.com" "cdn.example.com")
for host in "${hosts[@]}"; do
    sslyze --json "$host" > "/var/log/ssl-scans/${host}_$(date +%Y%m%d).json"
done
sslyze --max_workers 10 example.com
sslyze --no-ipv6 example.com
sslyze --ciphers --protocols example.com

(Skipping unnecessary tests speeds up scanning)

  • Rate Limiting: SSLyze respects server limits; reduce workers if getting timeouts
  • Network Impact: Multiple concurrent scans can strain network; monitor bandwidth
  • Log Sensitive Data: JSON output may contain certificate details; handle securely
  • Updates: Keep SSLyze updated for latest vulnerability signatures
  • Scanning Permissions: Always obtain authorization before scanning external systems