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

Function _reverse_dns

network_diagnostics.py:821–833  ·  view source on GitHub ↗

Reverse-DNS an IP via getent (honours nsswitch, bounded by _run's timeout). Returns the PTR hostname or None.

(ip)

Source from the content-addressed store, hash-verified

819 interface — the right lens on a multi-homed box."""
820 iface = interface if _valid_iface(interface or '') else None
821 gw = _iface_gateway(iface) if iface else _default_gateway()
822 if not gw:
823 return {'success': True, 'verdict': 'unknown', 'gateway': None,
824 'interface': iface,
825 'reasons': [('no default gateway via %s — nothing to check' % iface)
826 if iface else 'no default gateway on this host — nothing to check'],
827 'impersonators': [], 'neighbor_count': 0}
828
829 gw_mac = _neigh_mac(gw)
830 reasons = []
831 verdict = 'clean'
832 learned = False
833 with _arp_baseline_lock:
834 baseline = _arp_baseline_load()
835 gws = baseline.setdefault('gateways', {})
836 base_mac = gws.get(gw)

Callers 1

do_network_identityFunction · 0.85

Calls 1

_runFunction · 0.85

Tested by

no test coverage detected