A Python tool for checking missing HTTP security headers for better web security.
Project description
vulheader
A Python tool to check for missing HTTP security headers on websites. It can check for the presence of security headers like Strict-Transport-Security, Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, and Permissions-Policy.
Installation
To install the package, run:
pip install vulheader
Usage
You can use vulheader both as a Python package and as a command-line tool.
As a Python Package
You can use the check() function to check for specific headers or all headers.
Check for a specific header
To check if a specific header is present or missing, use the following code:
import vulheader
url = "https://example.com"
result = vulheader.check(url, "Strict-Transport-Security")
if result == "missing":
print("Strict-Transport-Security: Missing")
else:
print("Strict-Transport-Security: Present")
You can replace "Strict-Transport-Security" with any of the following headers to check for their presence:
Strict-Transport-SecurityContent-Security-PolicyX-Frame-OptionsX-Content-Type-OptionsReferrer-PolicyPermissions-Policy
Check all headers at once
You can also check for all security headers at once:
import vulheader
url = "https://example.com"
header_status = vulheader.check(url)
for header, status in header_status.items():
print(f"{header}: {'Present' if status == 'present' else 'Missing'}")
As a Command-Line Tool
Once installed, you can use vulheader directly from the command line to check the headers of a website.
Check for all headers
To check for all security headers:
vulheader --url https://example.com
Check for a specific header
To check for a specific header, use the -H option followed by the header name:
vulheader --url https://example.com -H "Strict-Transport-Security"
Replace "Strict-Transport-Security" with any of the following headers:
Strict-Transport-SecurityContent-Security-PolicyX-Frame-OptionsX-Content-Type-OptionsReferrer-PolicyPermissions-Policy
Checking all headers:
Strict-Transport-Security: Missing
Content-Security-Policy: Present
X-Frame-Options: Missing
X-Content-Type-Options: Missing
Referrer-Policy: Missing
Permissions-Policy: Missing
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 vulheader-1.0.1.tar.gz.
File metadata
- Download URL: vulheader-1.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a44da58111142d6419b947ec8e987fc03f758b1cda5627af413f9cb60b2613fb
|
|
| MD5 |
7f32fe93a7756b43d122b6e26c1a9b8d
|
|
| BLAKE2b-256 |
d853381f0ccbfa39543facf5362531d30408d0315b3a6d30f2fb6d270f1c2773
|
File details
Details for the file vulheader-1.0.1-py3-none-any.whl.
File metadata
- Download URL: vulheader-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
070d650fa5008a6c86a6d701cab68616d3f48f99fb3e70fc946b408231591ca9
|
|
| MD5 |
c5a8b17d18cb86f010d83641ae3ec142
|
|
| BLAKE2b-256 |
be8e075451b8623740c808e76711014b020a2ca6a9af81e29dec059cab9d2b58
|