Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing openvas parser and including script_id for openvas and nmap #11454

Open
wants to merge 2 commits into
base: bugfix
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 5 additions & 1 deletion 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 @@ -27,7 +28,8 @@ def get_findings(self, filename, test):
title = title + "_" + finding.text
description.append(f"**Port**: {finding.text}")
if finding.tag == "nvt":
description.append(f"**NVT**: {finding.text}")
script_id = finding.get("oid")
description.append(f"**NVT**: {script_id}")
LeoOMaia marked this conversation as resolved.
Show resolved Hide resolved
if finding.tag == "severity":
severity = self.convert_cvss_score(finding.text)
description.append(f"**Severity**: {finding.text}")
Expand All @@ -38,10 +40,12 @@ def get_findings(self, filename, test):

finding = Finding(
title=str(title),
test=test,
LeoOMaia marked this conversation as resolved.
Show resolved Hide resolved
description="\n".join(description),
severity=severity,
dynamic_finding=True,
static_finding=False,
vuln_id_from_tool=script_id,
)
findings.append(finding)
return findings
Expand Down
Loading