Skip to content

Commit

Permalink
🐛 fix nessus severity
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-sommer committed Feb 14, 2024
1 parent bdd191c commit d551596
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dojo/tools/tenable/xml_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ def get_text_severity(self, severity_id):
severity = "Info"
return severity

def get_cvss_severity(self, cvss_score):
"""Convert data of the report into severity"""
severity = "Info"
if float(cvss_score) >= 9.0:
severity = "Critical"
elif float(cvss_score) >= 7.0:
severity = "High"
elif float(cvss_score) >= 5.0:
severity = "Medium"
elif float(cvss_score) > 0.0:
severity = "Low"
else:
severity = "Info"
return severity

def safely_get_element_text(self, element):
if element is None:
return None
Expand Down Expand Up @@ -203,6 +218,11 @@ def get_findings(self, filename: str, test: Test) -> list:
if cvssv3_score_element_text is not None:
cvssv3_score = cvssv3_score_element_text

cvss = self.safely_get_element_text(item.find("cvss3_base_score"))
if cvss != None:

Check notice on line 222 in dojo/tools/tenable/xml_format.py

View workflow job for this annotation

GitHub Actions / flake8-your-pr

dojo/tools/tenable/xml_format.py#L222

comparison to None should be 'if cond is not None:' (E711)
print(cvss)
severity = self.get_cvss_severity(cvss)

# Determine the current entry has already been parsed in
# this report
dupe_key = severity + title
Expand Down

0 comments on commit d551596

Please sign in to comment.