A CLI tool for analyzing HTTP security headers
Project description
Header-analyzer
A Python CLI tool for analyzing HTTP security headers. Scans target URLs, evaluates security posture, and provides a letter grade with detailed breakdown.
Features
- Security Header Analysis – Checks for HSTS, CSP, X-Frame-Options, X-Content-Type-Options, and more
- Security Grading – Letter grade (A+ to F) based on header configuration
- HSTS Preload Detection – Sites on browser preload lists get automatic A+ rating
- Sensitive Header Detection – Flags headers that may leak server/stack details
- Flexible Requests – Custom headers, User-Agent override, timeout, and SSL bypass options
Installation
Via pip (recommended)
pip install git+https://github.com/negoro26/Header-analyzer.git
This installs the header-analyzer command globally (or in your active virtual environment).
Development install (editable)
git clone https://github.com/negoro26/Header-analyzer.git
cd Header-analyzer
# Windows
py -3 -m venv .venv && .\.venv\Scripts\Activate.ps1
# macOS/Linux
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
Usage
header-analyzer <url> [options]
Options
| Flag | Description |
|---|---|
-k, --insecure |
Skip SSL certificate verification |
--timeout <int> |
Request timeout in seconds (default: 10) |
--user-agent <string> |
Override User-Agent header |
-H, --header "Key: Value" |
Add custom request header (repeatable) |
--no-default-headers |
Start with empty header set |
--json |
Output headers as prettified JSON |
Examples
# Basic scan
header-analyzer example.com
# Skip SSL verification with shorter timeout
header-analyzer https://example.com -k --timeout 5
# Custom headers
header-analyzer https://example.com --user-agent "MyScanner/1.0" \
-H "Accept-Language: en-US"
Grading System
Sites are graded based on security header presence and configuration:
| Grade | Score | Description |
|---|---|---|
| A+ | — | Browser Trusted (HSTS preloaded) |
| A+ | 90%+ | Excellent |
| A | 75%+ | Very Good |
| B | 60%+ | Good |
| C | 45%+ | Acceptable |
| D | 30%+ | Poor |
| F | <30% | Critical |
Scoring Breakdown
- HTTPS Baseline: +25 pts
- Strict-Transport-Security: +25 pts
- Content-Security-Policy: +20 pts
- X-Content-Type-Options: +10 pts
- X-Frame-Options: +10 pts
- Referrer-Policy: +5 pts
- Permissions-Policy: +5 pts
- Sensitive headers exposed: -2 pts each (max -10)
Sites in the HSTS Preload List receive automatic A+ since browsers enforce HTTPS at the protocol level.
Sample Output
[+] Target: https://twitter.com
[+] Status Code: 200
============================================================
[+] SECURITY GRADE
============================================================
Grade: A+ (Browser Trusted)
★ This site is in the HSTS Preload List (twitter.com)
★ HSTS is built into all major browsers (Chrome, Firefox, Safari, Edge)
★ Browsers will ALWAYS use HTTPS for this site, even on first visit
★ Header analysis is not needed - browser-level trust is the gold standard
Requirements
- Python 3.8+
requests>=2.28.0(listed inrequirements.txtandpyproject.toml)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file header_analyzer-1.0.0.tar.gz.
File metadata
- Download URL: header_analyzer-1.0.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf7fa514952d339cefa6b7dca5e6d995244973ac3bdf441b527acfc56fd4371e
|
|
| MD5 |
1b432e367dc1b64b51347cfedc3d2fca
|
|
| BLAKE2b-256 |
8645555272feef4462c6881cf6caea2a783916970623585311d07ed770a64746
|
File details
Details for the file header_analyzer-1.0.0-py3-none-any.whl.
File metadata
- Download URL: header_analyzer-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd2d5b9a24f9da1d553999e1f99ce9342335ca8456a4230c37b31061cbccc07d
|
|
| MD5 |
f726ed0f0631561584d3649c5cf148d7
|
|
| BLAKE2b-256 |
eb159a2eb208a132446bd385d03ccfb73007c5d1e6074ede71415502de8261a3
|