diff --git a/CHANGELOG b/CHANGELOG index 94f3c7a5d..1fbed2fe6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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. diff --git a/ndiff/ndiff.py b/ndiff/ndiff.py index b5fe3dd7a..abca1dc2c 100755 --- a/ndiff/ndiff.py +++ b/ndiff/ndiff.py @@ -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."""