Created
February 1, 2012 15:05
-
-
Save emory/1717437 to your computer and use it in GitHub Desktop.
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.2 | |
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') | |
first = 0 | |
else: | |
tree = etree.parse(fileName) | |
for element in tree.findall('.//ReportHost'): | |
report.append(element) | |
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment