1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-08 07:29:03 +00:00

Fix host sorting in Ndiff. Fixes #591

This commit is contained in:
dmiller
2016-12-05 22:10:20 +00:00
parent a8ff212b84
commit 9f858f6d3e
2 changed files with 8 additions and 3 deletions

View File

@@ -1,5 +1,9 @@
# Nmap Changelog ($Id$); -*-text-*-
o [Ndiff][GH#591] Fix a bug where hosts with the same IP but different
hostnames were shown as changing hostnames between scans. Made sort stable
with regard to hostnames. [Daniel Miller]
o [NSE][GH#533] Removed ssl-google-cert-catalog, since Google shut off that
service at some point. Reported by Brian Morin.

View File

@@ -127,11 +127,12 @@ class Host(object):
def get_id(self):
"""Return an id that is used to determine if hosts are "the same"
across scans."""
hid = None
if len(self.addresses) > 0:
return str(sorted(self.addresses)[0])
hid = "%-40s" % (str(sorted(self.addresses)[0]))
if len(self.hostnames) > 0:
return str(sorted(self.hostnames)[0])
return id(self)
return (hid or " " * 40) + str(sorted(self.hostnames)[0])
return hid or id(self)
def format_name(self):
"""Return a human-readable identifier for this host."""