Skip to content

Commit

Permalink
Merge pull request #117 from savon-noir/fix/pr98
Browse files Browse the repository at this point in the history
feature/banner_dict
  • Loading branch information
savon-noir committed Dec 1, 2020
2 parents d798a05 + 647773c commit 84599f7
Show file tree
Hide file tree
Showing 3 changed files with 390 additions and 0 deletions.
28 changes: 28 additions & 0 deletions libnmap/objects/service.py
Expand Up @@ -251,6 +251,34 @@ def banner(self):
b += "{0}: {1} ".format(mkey, self._service[mkey])
return b.rstrip()

@property
def banner_dict(self):
"""
Accessor for the service's banner. Only available
if the nmap option -sV or similar was used.
:return: dictionary
"""
notrelevant = [
"name",
"method",
"conf",
"cpelist",
"servicefp",
"tunnel",
]
relevant = ["product", "version", "extrainfo"]
b = {}
skeys = self._service.keys()
if "method" in self._service and self._service["method"] == "probed":
for relk in relevant:
if relk in skeys:
b[relk] = self._service[relk]
for mkey in skeys:
if mkey not in notrelevant and mkey not in relevant:
b[mkey] = self._service[mkey]
return b

@property
def cpelist(self):
"""
Expand Down

0 comments on commit 84599f7

Please sign in to comment.