fabriziosalmi / websites-monitor Goto Github PK
View Code? Open in Web Editor NEWWebsites monitoring via GitHub Actions (expiration, security, performances, privacy, SEO)
Websites monitoring via GitHub Actions (expiration, security, performances, privacy, SEO)
with open("websites.txt", "r") as f:
websites = f.readlines()
main.py
from datetime import datetime
# Import checks
from checks import (
check_domain_breach, check_domain_expiration, check_ssl_cert, check_dns_blacklist,
check_domainsblacklists_blacklist, check_hsts, check_xss_protection, check_redirect_chains,
check_pagespeed_performances, check_website_load_time, check_rate_limiting, check_cdn,
check_brotli_compression, check_deprecated_libraries, check_clientside_rendering,
check_mixed_content, check_content_type_headers, check_internationalization, check_floc,
check_amp_compatibility, check_robot_txt, check_sitemap, check_favicon, check_alt_tags,
check_open_graph_protocol, check_semantic_markup, check_ad_and_tracking, check_privacy_protected_whois,
check_privacy_exposure
)
# Initialize an error log
error_log = []
def log_error(message):
"""A simple function to log errors for later use."""
error_log.append(message)
print(message) # This will also print the error in the console
# Read websites from external file
with open('websites.txt', 'r') as f:
websites = [line.strip() for line in f.readlines()]
# Initialize Markdown report
report_md = "# Websites Monitor\n"
# Read the project description and usage instructions
with open('project_description.md', 'r') as f:
report_md += f"{f.read()}\n"
with open('usage_instructions.md', 'r') as f:
report_md += f"{f.read()}\n"
# Initialize the table
report_md += "\n## Monitoring Checks\n"
report_md += "| Check Type | " + " | ".join(websites) + " |\n"
report_md += "|------------|" + "---|" * len(websites) + "\n"
# List of check functions and their human-readable names
check_functions = [
("Domain breach", check_domain_breach),
# ... [other checks]
("Privacy Exposure", check_privacy_exposure),
]
# Populate the table with check results
for check_name, check_func in check_functions:
report_md += f"| {check_name} | "
for website in websites:
try:
result = check_func(website)
report_md += f"{result} | "
except Exception as e:
err_msg = f"Error occurred with {check_name} for {website}: {e}"
log_error(err_msg)
report_md += "⚪ | " # Add a default grey indicator for errors
report_md += "\n"
# Timestamp
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
report_md += f"\n---\nLast Updated: {current_time}\n"
# Write the Markdown report to a file
with open("README.md", "w") as f:
f.write(report_md)
# Exit with a non-zero code if errors were encountered
if error_log:
exit(1)
Report export in PDF, XLS, CSV, JSON formats.
..into several files (main, checks)
import requests
def check_server_software(website):
"""
Detect the web server software of the website.
Args:
- website (str): URL of the website to be checked.
Returns:
- str: "🟢" if server software is suppressed or not easily identifiable,
"🔴" if server software is openly exposed,
"⚪" for any errors.
"""
try:
response = requests.get(website)
server_header = response.headers.get("Server")
if server_header:
print(f"Server software identified: {server_header}")
return "🔴"
else:
return "🟢"
except Exception as e:
print(f"Error occurred: {e}")
return "⚪"
print(check_server_software("https://example.com"))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.