Last active
November 5, 2024 21:47
-
-
Save karoltheguy/b929e93bc1f214c74fadd1bf7e86ed37 to your computer and use it in GitHub Desktop.
Tenable Nessus KB Extract
This file contains hidden or 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
import openpyxl | |
def extract_kbs_from_excel(excel_file): | |
workbook = openpyxl.load_workbook(excel_file) | |
sheet = workbook.active | |
kbs = set() # Use a set to automatically handle duplicates | |
for row in sheet.iter_rows(min_row=2, values_only=True): # Assuming the first row is the header | |
priority = row[3] # 4th column (index 3) | |
column_8 = row[7] # 8th column (index 7) | |
kb_column = row[10] # 11th column (index 10) | |
if priority != 'Low' and not column_8.startswith('Microsoft Edge (Chromium)') and kb_column: | |
kb_items = kb_column.split() # Split by whitespace | |
for kb in kb_items: | |
if kb.startswith('-KB'): | |
kbs.add(kb.strip().replace('-', '')) | |
return kbs | |
excel_file = r'C:\path\to\your\nessus_report.xlsx' | |
kbs = extract_kbs_from_excel(excel_file) | |
# Write the KBs to a text file | |
with open('extracted_kbs.txt', 'w') as f: | |
for kb in kbs: | |
f.write(f"{kb}\n") | |
print("KBs have been extracted, duplicates removed, and written to extracted_kbs.txt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The script currently disregard Low priority vulnerabilities and also anything starting with Microsoft Edge (Chromium) since at the time of this writing I don't want to update Edge.