fix: handle ping output with hostname when DNS resolves scan target
When the Docker container's DNS can resolve a target IP to a hostname, ping formats the reply line as "from hostname (ip):" instead of the plain "from ip:" format. The proxy-ARP source-IP guard only checked for the plain format, causing those hosts to be incorrectly reported as unreachable despite a valid ICMP response. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -71,7 +71,8 @@ def _ping(ip: str) -> bool:
|
||||
# Guard against proxy-ARP / gateway false positives: verify the ICMP
|
||||
# reply actually came from the target IP and not an intermediate node.
|
||||
stdout = r.stdout.decode(errors="ignore")
|
||||
return f"from {ip}:" in stdout or f"from {ip} " in stdout
|
||||
# Also handles "from hostname (ip):" format when DNS resolves the target
|
||||
return f"from {ip}:" in stdout or f"from {ip} " in stdout or f"({ip}):" in stdout
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user