1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 05:01:29 +00:00

Make osclasses a substructure of osmatch.

This commit is contained in:
david
2012-05-05 18:02:41 +00:00
parent 56b7063aa9
commit cac71422e8
7 changed files with 68 additions and 76 deletions

View File

@@ -125,12 +125,21 @@ class TracerouteHostInfo(object):
self.hostname = None
self.ports = []
self.extraports = []
self.osclasses = []
self.osmatches = []
def get_hostname(self):
return self.hostname
def get_best_osmatch(self):
if not self.osmatches:
return None
def osmatch_key(osmatch):
try:
return -float(osmatch["accuracy"])
except ValueError:
return 0
return sorted(self.osmatches, key = osmatch_key)[0]
hostnames = property(lambda self: self.hostname and [self.hostname] or [])
def make_graph_from_hosts(hosts):