(self, domain)
| 12232 | return out |
| 12233 | |
| 12234 | def _certificate_transparency(self, domain): |
| 12235 | out = {} |
| 12236 | if not domain: |
| 12237 | return out |
| 12238 | try: |
| 12239 | r = requests.get(f"https://crt.sh/?q={urllib.parse.quote(domain)}&output=json", timeout=10, headers={"User-Agent": "Mozilla/5.0"}) |
| 12240 | if r.status_code != 200: |
| 12241 | out["CT"] = f"HTTP {r.status_code}" |
| 12242 | return out |
| 12243 | data = self._safe_response_json(r) |
| 12244 | if not isinstance(data, list) or not data: |
| 12245 | out["CT"] = "Nessun risultato" |
| 12246 | return out |
| 12247 | cert_count = len(data) |
| 12248 | entries = [] |
| 12249 | issuers = set() |
| 12250 | names = set() |
| 12251 | timestamps = [] |
| 12252 | for row in data[:200]: |
| 12253 | if not isinstance(row, dict): |
| 12254 | continue |
| 12255 | if row.get("name_value"): |
| 12256 | names.add(str(row.get("name_value")).strip()) |
| 12257 | if row.get("issuer_name"): |
| 12258 | issuers.add(str(row.get("issuer_name")).strip()) |
| 12259 | if row.get("not_before"): |
| 12260 | timestamps.append(str(row.get("not_before")).strip()) |
| 12261 | if timestamps: |
| 12262 | out["CT certificati trovati"] = str(cert_count) |
| 12263 | out["CT primi emittenti"] = ", ".join(sorted(issuers)[:5]) if issuers else "N/D" |
| 12264 | out["CT SAN più frequenti (campione)"] = ", ".join(sorted(list(names))[:10]) if names else "N/D" |
| 12265 | else: |
| 12266 | out["CT certificati trovati"] = str(cert_count) |
| 12267 | return out |
| 12268 | except Exception as e: |
| 12269 | out["CT"] = f"Err: {e}" |
| 12270 | return out |
| 12271 | |
| 12272 | def _domain_dns_history(self, domain): |
| 12273 | key = (self.creds.get("dns_history_api_key") or "").strip() |
no test coverage detected