Keeping your website secure starts with understanding how it's exposed. This Python script helps you analyze two major aspects of web security:
With just a few lines of code, you can perform a quick sacn of any website and identify potential weaknesses that hackers might exploit.
Security headers are HTTP response headers that provide browsers with information on how to behave securely when interacting with a site. The script checks for the following headers:
Content-Security-Policy -> Prevents XSS attacks
Strict-Transport-Security -> Enforces HTTPS connections
X-Content-Type-Options -> Blocks MIME type sniffing
X-Frame-Options -> Protects against clickjacking via iframes
X-XSS-Protection -> Enables browser XSS filters
Referer-Policy -> Controls how referrer information is sent
Permissions-Policy -> Restricts access to APIs (e.g., camera, mic)
Below is the complete code:
pip install requests