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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user