(self, domain)
| 12011 | return None |
| 12012 | |
| 12013 | def _domain_headers_and_tls(self, domain): |
| 12014 | out = {} |
| 12015 | homepage = f"https://{domain}" |
| 12016 | try: |
| 12017 | r = requests.get(homepage, timeout=10, headers={"User-Agent": "Mozilla/5.0"}, allow_redirects=True) |
| 12018 | out["HTTP Status"] = str(r.status_code) |
| 12019 | out["Final URL"] = r.url |
| 12020 | headers = r.headers or {} |
| 12021 | if headers: |
| 12022 | header_map = { |
| 12023 | "server": "Server", |
| 12024 | "x-powered-by": "X-Powered-By", |
| 12025 | "x-frame-options": "X-Frame-Options", |
| 12026 | "x-content-type-options": "X-Content-Type-Options", |
| 12027 | "referrer-policy": "Referrer-Policy", |
| 12028 | "strict-transport-security": "HSTS", |
| 12029 | "content-security-policy": "CSP", |
| 12030 | "permissions-policy": "Permissions-Policy", |
| 12031 | "cross-origin-opener-policy": "COOP", |
| 12032 | "cross-origin-resource-policy": "CORP", |
| 12033 | "cross-origin-embedder-policy": "COEP" |
| 12034 | } |
| 12035 | present = [] |
| 12036 | missing = [] |
| 12037 | for k, label in header_map.items(): |
| 12038 | v = headers.get(k) or headers.get(k.title()) |
| 12039 | if v: |
| 12040 | out[label] = str(v) |
| 12041 | present.append(label) |
| 12042 | else: |
| 12043 | missing.append(label) |
| 12044 | out["Security Headers Presenti"] = ", ".join(present) if present else "Nessuno" |
| 12045 | out["Security Headers Mancanti"] = ", ".join(missing[:9]) if missing else "Completo" |
| 12046 | except Exception as e: |
| 12047 | out["HTTP Status"] = f"Err: {e}" |
| 12048 | return out, "" |
| 12049 | |
| 12050 | return out, r.text |
| 12051 | |
| 12052 | def _domain_rdap_lookup(self, domain): |
| 12053 | out = {"RDAP": "N/D"} |
no outgoing calls
no test coverage detected