Skip to content

A simple Python script that calls SSL Labs API to do SSL testings on servers and create a report in html.

License

Notifications You must be signed in to change notification settings

kyhau/ssllabs-scan

SSL Labs Scan

CI Codecov CodeQL Snyk Checks Secrets Scan Python Version Code style: black GitHub last commit License

A command-line tool that calls the SSL Labs API to perform SSL/TLS testing on hosts and generates comprehensive CSV and HTML reports.

  • API v4 support with registered email (Qualys SSL Labs)
  • API v3 fallback (no email required, deprecated by Qualys)
  • Beautiful HTML reports with customizable templates
  • Batch processing of multiple hosts
  • Docker support for containerized execution

All notable changes to this project will be documented in CHANGELOG.

Supports Python 3.11, 3.12, 3.13

✨ Features

πŸ”§ Development Tools

  • Poetry - Modern dependency management
  • Makefile - Convenient command shortcuts for common tasks
  • pytest - Testing framework with coverage reporting
  • black - Code formatting
  • flake8 - Python code linting
  • yamllint - YAML file linting

πŸ” Security & Code Quality

πŸš€ CI/CD

  • GitHub Actions - Automated testing across Python 3.11-3.13
  • Codecov - Code coverage reporting
  • Stale Issue Management - Automatically closes inactive issues

πŸ“Š Input and Outputs

Input

Sample input: sample/SampleServerList.txt

Outputs

  1. summary.html - Visual report (sample output)
  2. summary.csv - Data export (sample output)
  3. {hostname}.json - Detailed API response (sample output)

Sample HTML Report

Sample HTML Output

Customize Reports

You can modify report templates and styles:


πŸš€ Installation

Using pipx (Recommended)

# Install pipx if needed
pip install pipx

# Install ssllabs-scan
pipx install .

# Run from anywhere
ssllabs-scan --help

Using pip

# Install directly
pip install .

# Run the tool
ssllabs-scan --help

Using Poetry (Development)

# Quick setup
make setup-init

# Or manual setup
make setup-venv
make install-all

# Run with Poetry
poetry run ssllabs-scan --help

πŸ’» Usage

Basic Usage

# Using API v3 (no registration required, being deprecated)
ssllabs-scan sample/SampleServerList.txt

# Using API v4 (recommended, requires registration)
ssllabs-scan sample/SampleServerList.txt --email your@email.com

Docker Usage

# Build image
docker build -t ssllabsscan .

# Run with mounted directory
mkdir out
cp sample/SampleServerList.txt out/
docker run --mount type=bind,source=./out,target=/tmp ssllabsscan \
  -o /tmp/output.html -s /tmp/output.csv /tmp/SampleServerList.txt

Example Output

$ ssllabs-scan sample/SampleServerList.txt
Start analyzing duckduckgo.com...
Status: DNS, StatusMsg(Resolving domain names): waiting 30 secs until next check...
Status: IN_PROGRESS, StatusMsg(None): waiting 30 secs until next check...
Status: IN_PROGRESS, StatusMsg(None): waiting 30 secs until next check...
Start analyzing google.com...
Status: DNS, StatusMsg(Resolving domain names): waiting 30 secs until next check...
Status: IN_PROGRESS, StatusMsg(None): waiting 30 secs until next check...
...
Creating summary.html ...

⚠️ Important Notes

API v4 Registration

⚑ API v4 requires one-time registration with Qualys SSL Labs. See Introduction of API v4.

API v3 was deprecated on December 31st, 2023. All users should migrate to API v4.

Rate Limits

⚑ The SSL Labs API has rate limits. Common status codes:

  • 400 - Invalid parameters
  • 429 - Request rate too high
  • 500 - Internal error
  • 503 - Service unavailable (maintenance)
  • 529 - Service overloaded

See the SSL Labs API Documentation for details.


πŸ“‹ Development Workflow

Common Commands

make setup-init         # First-time setup (configure, lock, install everything)
make help               # Show all available commands
make install-all        # Install all dependencies (main, dev, test)
make test               # Run tests without coverage
make test-with-coverage # Run tests with coverage
make format-python      # Auto-format Python code
make lint-python        # Lint Python code
make lint-yaml          # Lint YAML files
make pre-commit         # Run all quality checks (format, lint, test)
make build              # Build the package
make clean              # Clean build artifacts

Running Tests

# Run tests with coverage
make test-with-coverage

# Run tests only
make test

# Format and lint code
make format-python
make lint-python
make lint-yaml

# Run all quality checks before committing
make pre-commit

Managing Dependencies

# Update dependencies to latest compatible versions
make update-deps

# Regenerate lock file
make lock

πŸ—οΈ Project Structure

ssllabs-scan/
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ ISSUE_TEMPLATE/       # Bug report and feature request templates
β”‚   β”œβ”€β”€ workflows/            # CI/CD workflows
β”‚   β”œβ”€β”€ dependabot.yml        # Dependency updates config
β”‚   └── pull_request_template.md
β”œβ”€β”€ ssllabsscan/              # Main Python package
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ main.py               # CLI entry point
β”‚   β”œβ”€β”€ ssllabs_client.py     # API client
β”‚   β”œβ”€β”€ export_response.py    # Response handling
β”‚   β”œβ”€β”€ report_template.py    # HTML template
β”‚   └── styles.css            # Report styling
β”œβ”€β”€ tests/                    # Unit tests
β”‚   β”œβ”€β”€ test_main.py
β”‚   β”œβ”€β”€ test_ssllabs_client.py
β”‚   β”œβ”€β”€ test_export_response.py
β”‚   └── test_report_template.py
β”œβ”€β”€ sample/                   # Sample inputs and outputs
β”œβ”€β”€ pyproject.toml            # Project metadata and dependencies
β”œβ”€β”€ Makefile                  # Build and test commands
β”œβ”€β”€ Dockerfile                # Container definition
β”œβ”€β”€ CHANGELOG.md              # Version history
β”œβ”€β”€ CODE_OF_CONDUCT.md        # Community guidelines
β”œβ”€β”€ CONTRIBUTING.md           # Contribution guidelines
β”œβ”€β”€ SECURITY.md               # Security policy
└── README.md                 # This file

🀝 Contributing

Contributions are welcome! Please see:


πŸ”’ Security

For security issues, please see SECURITY.md for our security policy and reporting guidelines.

About

A simple Python script that calls SSL Labs API to do SSL testings on servers and create a report in html.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 8