Salta ai contenuti

testssl.sh

testssl.sh is a powerful bash-based SSL/TLS testing utility that performs comprehensive security assessments. It checks for protocol support, cipher vulnerabilities, certificate validity, and known TLS exploits more thoroughly than lighter tools like sslscan.

git clone --depth 1 https://github.com/drwetter/testssl.sh.git
cd testssl.sh
chmod +x testssl.sh
brew install testssl.sh
docker pull drwetter/testssl.sh
docker run --rm drwetter/testssl.sh https://example.com
# Most systems have these. testssl.sh may warn if missing:
apt-get install openssl curl dnsutils socat
# On Alpine/minimal systems: apk add openssl curl bind-tools socat
./testssl.sh https://example.com
./testssl.sh --quick https://example.com
./testssl.sh https://example.com:8443
./testssl.sh example.com:443
testssl.sh -t smtp mail.example.com:587  # STARTTLS
CommandDescription
./testssl.sh https://example.comFull comprehensive scan
./testssl.sh --quick https://example.comFast scan (essential checks only)
./testssl.sh example.com:443Custom port
./testssl.sh -t smtp mail.example.com:587SMTP with STARTTLS
./testssl.sh -t xmpp example.com:5222XMPP STARTTLS
./testssl.sh --protocols https://example.com
./testssl.sh --ssl-v2 https://example.com    # SSLv2 (deprecated)
./testssl.sh --ssl-v3 https://example.com    # SSLv3 (deprecated)
./testssl.sh --tls1 https://example.com      # TLS 1.0
./testssl.sh --tls1-1 https://example.com    # TLS 1.1
./testssl.sh --tls1-2 https://example.com    # TLS 1.2
./testssl.sh --tls1-3 https://example.com    # TLS 1.3
CommandDescription
--protocolsTest all supported protocols
--ssl-v2Test SSLv2 support (should fail)
--ssl-v3Test SSLv3 support (should fail)
--tls1Test TLS 1.0 support (legacy)
--tls1-1Test TLS 1.1 support (legacy)
--tls1-2Test TLS 1.2 support (modern)
--tls1-3Test TLS 1.3 support (latest)
./testssl.sh --ciphers https://example.com
./testssl.sh --ciphers --strength https://example.com
./testssl.sh --weak https://example.com        # Find weak ciphers
./testssl.sh --rc4 https://example.com         # Check for RC4
CommandDescription
--ciphersList all supported ciphers
--ciphers --strengthShow cipher strength ratings
--weakHighlight weak ciphers only
--rc4Test specifically for RC4 support
--nullTest for NULL ciphers
--exportTest for export-grade ciphers
./testssl.sh --sigalgs https://example.com
./testssl.sh --eccbrainpool https://example.com
./testssl.sh --curves https://example.com
CommandDescription
--sigalgsShow signature algorithms
--eccbrainpoolTest ECC Brainpool curves
--curvesList supported elliptic curves
--dsaCheck DSA key support
./testssl.sh --heartbleed https://example.com
CommandDescription
--heartbleedTest OpenSSL Heartbleed vulnerability
./testssl.sh --ccs https://example.com
CommandDescription
--ccsTest CCS Injection vulnerability
./testssl.sh --robot https://example.com
CommandDescription
--robotTest ROBOT decryption vulnerability
./testssl.sh --poodle https://example.com
CommandDescription
--poodleTest POODLE downgrade vulnerability
./testssl.sh --beast https://example.com
CommandDescription
--beastTest BEAST cipher block chaining issue
./testssl.sh --crime https://example.com
CommandDescription
--crimeTest CRIME compression attack
./testssl.sh --breach https://example.com
CommandDescription
--breachTest HTTP compression vulnerability
./testssl.sh --lucky13 https://example.com
CommandDescription
--lucky13Test Lucky13 timing attack
./testssl.sh --freak https://example.com
CommandDescription
--freakTest FREAK export key vulnerability
./testssl.sh --logjam https://example.com
CommandDescription
--logjamTest Logjam DHE downgrade attack
./testssl.sh --drown https://example.com
CommandDescription
--drownTest DROWN SSLv2 attack
./testssl.sh --sweet32 https://example.com
CommandDescription
--sweet32Test 64-bit block cipher vulnerability
./testssl.sh --padding-oracle https://example.com
CommandDescription
--padding-oracleTest padding oracle vulnerability
./testssl.sh --ticketbleed https://example.com
CommandDescription
--ticketbleedTest TLS session ticket vulnerability
./testssl.sh --cert https://example.com
./testssl.sh --cert-validity https://example.com
./testssl.sh --cert-chain https://example.com
CommandDescription
--certDisplay full certificate information
--cert-validityCheck certificate expiration and validity
--cert-chainShow certificate chain (CA hierarchy)
--cert-signalgDisplay signature algorithm
--cert-extensionsShow certificate extensions
./testssl.sh --cert-info https://example.com  # Full analysis
./testssl.sh --self-signed https://example.com
./testssl.sh --verify-hostname https://example.com
CommandDescription
--cert-infoDetailed certificate information
--self-signedCheck if certificate is self-signed
--verify-hostnameVerify hostname matches certificate
--wildcardCheck for wildcard certificate
./testssl.sh --hsts https://example.com
./testssl.sh --headers https://example.com
CommandDescription
--hstsCheck HSTS header
--headersCheck security-related HTTP headers
--hpkpCheck HTTP Public Key Pinning
./testssl.sh -t smtp mail.example.com:587
./testssl.sh -t pop3 mail.example.com:110
./testssl.sh -t imap mail.example.com:143
./testssl.sh -t xmpp example.com:5222
./testssl.sh -t ldap ldap.example.com:389
CommandDescription
-t smtp host:587Test SMTP with STARTTLS
-t pop3 host:110Test POP3 with STARTTLS
-t imap host:143Test IMAP with STARTTLS
-t xmpp host:5222Test XMPP with STARTTLS
-t ldap host:389Test LDAP with STARTTLS
-t ftp host:21Test FTP with STARTTLS
./testssl.sh --json https://example.com > results.json
./testssl.sh --json --outfile results.json https://example.com
CommandDescription
--jsonOutput results in JSON format
--json --outfile file.jsonSave JSON output to file
./testssl.sh --csv https://example.com > results.csv
./testssl.sh --csv --outfile results.csv https://example.com
CommandDescription
--csvOutput results in CSV format
--csv --outfile file.csvSave CSV to file
./testssl.sh --html https://example.com > results.html
./testssl.sh --html --outfile results.html https://example.com
CommandDescription
--htmlGenerate HTML report
--html --outfile file.htmlSave HTML report to file
./testssl.sh --logfile results.log https://example.com
./testssl.sh --append https://example.com  # Append to existing log
CommandDescription
--logfile file.logSave output to log file
--appendAppend to log instead of overwriting
./testssl.sh --file hosts.txt
CommandDescription
--file hosts.txtTest list of hosts (one per line)
while IFS= read -r host; do
  ./testssl.sh --json --outfile "${host//\//_}.json" "https://$host"
done < hosts.txt
cat hosts.txt | parallel ./testssl.sh --json --outfile {}.json https://{}
name: SSL/TLS Testing
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Clone testssl.sh
        run: git clone --depth 1 https://github.com/drwetter/testssl.sh.git
      - name: Run testssl
        run: |
          ./testssl.sh/testssl.sh --json \
            --outfile results.json \
            https://example.com
      - name: Upload results
        uses: actions/upload-artifact@v2
        with:
          name: ssl-test-results
          path: results.json
stage('SSL/TLS Security Scan') {
  steps {
    sh '''
      git clone --depth 1 https://github.com/drwetter/testssl.sh.git
      ./testssl.sh/testssl.sh --json \
        --outfile results.json \
        https://example.com
    '''
    archiveArtifacts artifacts: 'results.json'
  }
}
ssl_tls_scan:
  stage: security
  script:
    - git clone --depth 1 https://github.com/drwetter/testssl.sh.git
    - ./testssl.sh/testssl.sh --json --outfile results.json https://example.com
  artifacts:
    paths:
      - results.json
./testssl.sh --fast https://example.com      # Skip slow tests
./testssl.sh --slow https://example.com      # Run additional slow tests
./testssl.sh --nofallback https://example.com  # Skip fallback checks
CommandDescription
--fastFaster scan, skip slower vulnerability tests
--slowInclude additional slow/thorough tests
--nofallbackDisable protocol fallback testing
--servername nameTLS SNI (needed for shared hosting)
./testssl.sh --severity HIGH https://example.com
./testssl.sh --severity CRITICAL https://example.com
CommandDescription
--severity HIGHShow only high/critical findings
--severity CRITICALShow only critical findings
Featuretestssl.shsslscansslyze
Protocol vulnerability checksComprehensiveBasicGood
Cipher analysisDetailedDetailedDetailed
Certificate analysisFullLimitedModerate
SpeedSlowerFastFast
LanguageBashCPython
STARTTLS supportYesYesYes
Output formatsJSON/CSV/HTMLXMLJSON/CSV
Automation friendlyVeryModerateGood
CVE detectionYes (Heartbleed, POODLE, etc.)LimitedModerate
# Quick scan for major issues
./testssl.sh --quick https://example.com

# Detailed compliance audit
./testssl.sh --severity HIGH https://example.com

# Integration with monitoring
./testssl.sh --json --outfile scan.json https://example.com

# Compare against baseline
./testssl.sh --json https://example.com | jq .findings[]

# Check certificate renewal alerts
./testssl.sh --cert-validity https://example.com
#!/bin/bash
host=$1
./testssl.sh --html --outfile "${host}_report.html" "https://$host"
./testssl.sh --json --outfile "${host}_data.json" "https://$host"
echo "Report saved: ${host}_report.html"
#!/bin/bash
for host in $(cat hosts.txt); do
  days_left=$(./testssl.sh --cert-validity "https://$host" | grep -oP '\d+(?= days)')
  if [ "$days_left" -lt 30 ]; then
    echo "ALERT: $host expires in $days_left days"
  fi
done
#!/bin/bash
host=$1
timestamp=$(date +%s)
./testssl.sh --ciphers --strength "https://$host" > "ciphers_${timestamp}.txt"
# Compare with previous runs
diff ciphers_*.txt
FindingSeverityAction
SSLv2/v3 enabledCRITICALDisable immediately
TLS 1.0/1.1 enabledHIGHDisable or plan removal
Weak ciphers (RC4, DES)HIGHRemove from supported ciphers
Self-signed certificateMEDIUMUse CA-signed certificate
Expired certificateCRITICALRenew certificate
Certificate chain issuesMEDIUMComplete chain configuration
Missing HSTS headerMEDIUMAdd HSTS header
Known vulnerabilitiesCRITICALPatch immediately
# Test with SNI for multi-domain hosting
./testssl.sh --servername example.com https://shared-ip.com

# Save baseline for comparison
./testssl.sh --json https://example.com > baseline.json

# Test only without certificate validation (dev environments)
./testssl.sh --noverify https://test.internal:8443

# Enable verbose logging for debugging
./testssl.sh -v https://example.com

# Run specific test only
./testssl.sh --heartbleed https://example.com
./testssl.sh --drown https://example.com