-
-
Save dwmanning/f38346ebbb15a1a1dac3 to your computer and use it in GitHub Desktop.
Revisions
-
btoews revised this gist
May 17, 2012 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ # file: merger.py # based off: http://cmikavac.net/2011/07/09/merging-multiple-nessus-scans-python-script/ # by: mastahyeti import xml.etree.ElementTree as etree import shutil import os @@ -29,4 +33,4 @@ shutil.rmtree("nss_report") os.mkdir("nss_report") mainTree.write("nss_report/report.nessus", encoding="utf-8", xml_declaration=True) -
btoews created this gist
May 17, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ import xml.etree.ElementTree as etree import shutil import os first = 1 for fileName in os.listdir("."): if ".nessus" in fileName: print(":: Parsing", fileName) if first: mainTree = etree.parse(fileName) report = mainTree.find('Report') report.attrib['name'] = 'Merged Report' first = 0 else: tree = etree.parse(fileName) for host in tree.findall('.//ReportHost'): existing_host = report.find(".//ReportHost[@name='"+host.attrib['name']+"']") if not existing_host: print "adding host: " + host.attrib['name'] report.append(host) else: for item in host.findall('ReportItem'): if not existing_host.find("ReportItem[@port='"+ item.attrib['port'] +"'][@pluginID='"+ item.attrib['pluginID'] +"']"): print "adding finding: " + item.attrib['port'] + ":" + item.attrib['pluginID'] existing_host.append(item) print(":: => done.") if "nss_report" in os.listdir("."): shutil.rmtree("nss_report") os.mkdir("nss_report") mainTree.write("nss_report/report.nessus", encoding="utf-8", xml_declaration=True)