Skip to content

Commit

Permalink
[enhancement] Added entire CVE blob to json output. (#36)
Browse files Browse the repository at this point in the history
* Fixes to export functions, add finding-cves also to JSON output

* Fixes #35: add entire JSON-CVE-Blob to json output

* added pycache to gitignore

---------

Co-authored-by: Sandro Bauer <sandro.bauer@smart-cybersecurity.de>
  • Loading branch information
Sandr0x00 and Sandr0x00 committed Sep 26, 2023
1 parent be003c9 commit 9ebe743
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/
7 changes: 3 additions & 4 deletions apachetomcatscanner/Reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def report_result(self, computer_ip, computer_port, result, credentials_found):
finding["computer_port"] = computer_port
finding["credentials_found"] = credentials_found

cve_list = self.vulns_db.get_vulnerabilities_of_version_sorted_by_criticity(finding["version"], colors=False, reverse=True)
finding["cves"] = [cve["cve"]["id"] for cve in cve_list]
finding["cves"] = self.vulns_db.get_vulnerabilities_of_version_sorted_by_criticity(finding["version"], colors=False, reverse=True)

if computer_ip not in self.data.keys():
self.data[computer_ip] = {}
Expand Down Expand Up @@ -116,7 +115,7 @@ def export_xlsx(self, path_to_file):
for computername in self.data.keys():
computer = self.data[computername]
for _, finding in computer.items():
cve_str = ', '.join(finding["cves"])
cve_str = ', '.join([cve["cve"]["id"] for cve in finding["cves"]])
credentials_str = ', '.join([f"{cred[1]} ({cred[0]})" for cred in finding["credentials_found"]])

data = [
Expand Down Expand Up @@ -163,7 +162,7 @@ def export_sqlite(self, path_to_file):
for computername in self.data.keys():
computer = self.data[computername]
for _, finding in computer.items():
cve_str = ', '.join(finding["cves"])
cve_str = ', '.join([cve["cve"]["id"] for cve in finding["cves"]])
credentials_str = ', '.join([f"{cred[1]} ({cred[0]})" for cred in finding["credentials_found"]])

cursor.execute("INSERT INTO results VALUES (?, ?, ?, ?, ?, ?)", (
Expand Down

0 comments on commit 9ebe743

Please sign in to comment.