(self, target: str)
| 404 | result.error_message = f"sslyze scan failed: {exc}" |
| 405 | result.duration_seconds = time.monotonic() - started |
| 406 | return result |
| 407 | |
| 408 | if not scan_results: |
| 409 | result.status = "error" |
| 410 | result.error_message = "sslyze returned no results" |
| 411 | result.duration_seconds = time.monotonic() - started |
| 412 | return result |
| 413 | |
| 414 | scan = scan_results[0] |
| 415 | findings, artifacts = _parse_sslyze_result(scan, host, port) |
| 416 | result.findings = findings |
| 417 | result.artifacts = artifacts |
| 418 | result.status = "ok" |
| 419 | result.duration_seconds = time.monotonic() - started |
| 420 | return result |
| 421 | |
| 422 | def _run_dns_passive(self, target: str) -> ReconResult: |
| 423 | result = ReconResult(recon_type=ReconType.DNS_PASSIVE, target=target) |
| 424 | started = time.monotonic() |
| 425 | |
| 426 | host, _ = _split_host_port(target, default_port=443) |
| 427 | domain = _registrable_domain(host) |
| 428 | if not domain: |
| 429 | result.status = "error" |
| 430 | result.error_message = f"could not derive registrable domain from {host}" |
| 431 | result.duration_seconds = time.monotonic() - started |
| 432 | return result |
| 433 | |
| 434 | try: |
| 435 | names = _query_crtsh(domain) |
| 436 | except Exception as exc: |
| 437 | result.status = "error" |
| 438 | result.error_message = f"crt.sh query failed: {exc}" |
| 439 | result.duration_seconds = time.monotonic() - started |
| 440 | return result |
| 441 | |
| 442 | try: |
| 443 | import dns.resolver |
| 444 | except ImportError as exc: |
| 445 | result.status = "error" |
| 446 | result.error_message = f"dnspython not installed: {exc}" |
| 447 | result.duration_seconds = time.monotonic() - started |
| 448 | return result |
| 449 | |
| 450 | resolver = dns.resolver.Resolver() |
| 451 | resolver.lifetime = DNS_RESOLVE_TIMEOUT |
| 452 | resolver.timeout = DNS_RESOLVE_TIMEOUT |
| 453 | |
| 454 | subdomains = [] |
| 455 | seen = set() |
| 456 | for name in sorted(names): |
| 457 | if name in seen: |
| 458 | continue |
| 459 | seen.add(name) |
| 460 | entry = {"name": name, "a_records": [], "aaaa_records": [], "alive": False} |
| 461 | entry["a_records"] = _safe_resolve(resolver, name, "A") |
| 462 | entry["aaaa_records"] = _safe_resolve(resolver, name, "AAAA") |
| 463 | if entry["a_records"] or entry["aaaa_records"]: |
nothing calls this directly
no test coverage detected