Skip to content

Commit

Permalink
Fixing openvas parser and including script_id for openvas and nmap (#…
Browse files Browse the repository at this point in the history
…11454)

* fixing openvas parser and including script_id for openvas and nmap

* updating xml openvas parser

* updating to not modify NVT
  • Loading branch information
LeoOMaia authored Jan 23, 2025
1 parent a9ee04b commit 321d580
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dojo/tools/nmap/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def get_findings(self, file, test):
"**Extra Info:** {}\n".format(port_element.find("service").attrib["extrainfo"])
)
description += service_info
script_id = None
if script := port_element.find("script"):
if script_id := script.attrib.get("id"):
description += f"**Script ID:** {script_id}\n"
Expand Down Expand Up @@ -126,6 +127,7 @@ def get_findings(self, file, test):
severity=severity,
mitigation="N/A",
impact="No impact provided",
vuln_id_from_tool=script_id,
)
find.unsaved_endpoints = []
dupes[dupe_key] = find
Expand Down
3 changes: 3 additions & 0 deletions dojo/tools/openvas/xml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get_findings(self, filename, test):
report = root.find("report")
results = report.find("results")
for result in results:
script_id = None
for finding in result:
if finding.tag == "name":
title = finding.text
Expand All @@ -28,6 +29,7 @@ def get_findings(self, filename, test):
description.append(f"**Port**: {finding.text}")
if finding.tag == "nvt":
description.append(f"**NVT**: {finding.text}")
script_id = finding.get("oid") or finding.text
if finding.tag == "severity":
severity = self.convert_cvss_score(finding.text)
description.append(f"**Severity**: {finding.text}")
Expand All @@ -43,6 +45,7 @@ def get_findings(self, filename, test):
severity=severity,
dynamic_finding=True,
static_finding=False,
vuln_id_from_tool=script_id,
)
findings.append(finding)
return findings
Expand Down

0 comments on commit 321d580

Please sign in to comment.