MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / do_dns_doctor

Function do_dns_doctor

network_diagnostics.py:1085–1121  ·  view source on GitHub ↗

Resolve `name` through every system resolver plus public 1.1.1.1 / 8.8.8.8, reporting per-resolver answers, query latency and the DNSSEC AD flag, whether the resolvers agree (split-DNS / hijack smell), and DoH/DoT reachability.

(name)

Source from the content-addressed store, hash-verified

1083 try:
1084 return int(mac[0:2], 16)
1085 except (ValueError, TypeError):
1086 return None
1087
1088
1089def _is_laa(mac):
1090 """True if the locally-administered (privacy/spoof) bit is set."""
1091 b0 = _mac_first_octet(mac)
1092 return b0 is not None and bool(b0 & 0x02)
1093
1094
1095def _is_universal_prefix(oui):
1096 """True if a 6-hex OUI could be a legitimately-registered (LAA-clear) OUI.
1097 Filters junk out of the vendor table so an LAA/randomization range in a full
1098 manuf file can't be mistaken for a real vendor by the spoof check."""
1099 try:
1100 b0 = int(oui[0:2], 16)
1101 except (ValueError, TypeError, IndexError):
1102 return False
1103 return not (b0 & 0x02) and not (b0 & 0x01)
1104
1105
1106def _load_oui_db():
1107 """Load {6-hex-prefix: vendor} from the arp-scan / nmap OUI DB if present,
1108 merged over the built-in seed. Universal prefixes only; cached."""
1109 global _oui_db_cache
1110 if _oui_db_cache is not None:
1111 return _oui_db_cache
1112 with _oui_db_lock:
1113 if _oui_db_cache is not None:
1114 return _oui_db_cache
1115 db = {}
1116 for oui, vendor in _MAC_VENDOR_SEED.items():
1117 db[oui.replace(':', '')] = vendor
1118 for path in _OUI_DB_PATHS:
1119 try:
1120 with open(path, encoding='utf-8', errors='replace') as f:
1121 for line in f:
1122 line = line.strip()
1123 if not line or line.startswith('#'):
1124 continue

Callers 1

net_dnsFunction · 0.85

Calls 8

_haveFunction · 0.85
_system_resolversFunction · 0.85
_digFunction · 0.85
_tcp_reachableFunction · 0.85
appendMethod · 0.80
addMethod · 0.80
setFunction · 0.50
updateMethod · 0.45

Tested by

no test coverage detected