Created
April 14, 2022 21:32
-
-
Save joswr1ght/ed3f2673907e203baff324d090290116 to your computer and use it in GitHub Desktop.
Read Nessus CSV report, extract records of interest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import csv | |
import sys | |
import os | |
if (len(sys.argv) == 1): | |
sys.stderr.write( | |
f"Usage: {os.path.basename(sys.argv[0])} <nessus-csv-file>\n") | |
sys.exit(1) | |
records = [] | |
with open(sys.argv[1]) as csv_file, \ | |
open('extract.csv', 'w') as out_file: | |
csv_reader = csv.reader(csv_file, delimiter=',') | |
csv_writer = csv.writer(out_file) | |
reccount = 0 | |
for row in csv_reader: | |
if reccount == 0: | |
csv_writer.writerow(row) | |
reccount += 1 | |
continue | |
# Row 7 is the issue Name field, ignore unapplicable or out-of-scope | |
# things | |
if ("PCI" in row[7] or "SWEET32" in row[7] or "Logjam" in row[7] | |
or "CGI Generic" in row[7] or "TLS Version 1.0" in row[7] | |
or "Linux Kernel TCP Sequence Number" in row[7] | |
or "HSTS Missing" in row[7] | |
or "SSRF" in row[7]): | |
continue | |
# Skip informational or uncategorized entries | |
if (row[3] not in ["High", "Medium", "Low"]): | |
continue | |
records.append(row) | |
csv_writer.writerow(row) | |
reccount += 1 | |
print(f"Wrote {reccount} records. Summary:") | |
for rec in records: | |
print(f"{rec[15]} -> [{rec[3]}] {rec[7]}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment