Skip to content

Commit

Permalink
advance mobsf to also parse exisiting unittestfile
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-sommer committed Feb 16, 2024
1 parent 72e20ea commit acfbb02
Show file tree
Hide file tree
Showing 2 changed files with 17,685 additions and 5 deletions.
19 changes: 15 additions & 4 deletions dojo/tools/mobsf/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,16 @@ def get_findings(self, filename, test):
}

mobsf_findings.append(mobsf_item)

if type(data) == list:

Check notice on line 323 in dojo/tools/mobsf/parser.py

View workflow job for this annotation

GitHub Actions / flake8-your-pr

dojo/tools/mobsf/parser.py#L323

do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` (E721)
for finding in data:
mobsf_item = {
"category": finding["category"],
"title": finding["name"],
"severity": finding["severity"],
"description": finding["description"] + "\n" + "**apk_exploit_dict:** " + str(finding["apk_exploit_dict"]) + "\n" + "**line_number:** " + str(finding["line_number"]),
"file_path": finding["file_object"]
}
mobsf_findings.append(mobsf_item)
for mobsf_finding in mobsf_findings:
title = mobsf_finding["title"]
sev = self.getCriticalityRating(mobsf_finding["severity"])
Expand Down Expand Up @@ -372,12 +381,14 @@ def getSeverityForPermission(self, status):
# Criticality rating
def getCriticalityRating(self, rating):
criticality = "Info"
if rating == "Good":
if rating.lower() == "good":
criticality = "Info"
if rating == "Warning":
elif rating.lower() == "warning":
criticality = "Low"
elif rating.lower() == "vulnerability":
criticality = "Medium"
else:
criticality = rating.capitalize()
criticality = rating.lower().capitalize()
return criticality

def suite_data(self, suites):
Expand Down
17,671 changes: 17,670 additions & 1 deletion unittests/scans/mobsf/report2.json

Large diffs are not rendered by default.

0 comments on commit acfbb02

Please sign in to comment.