Created
June 5, 2019 16:21
-
-
Save FrankSpierings/a11ae1f20239c60f7e70f7b737a0bff0 to your computer and use it in GitHub Desktop.
Nessus parse xml host & ports from its SYN scan
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
from lxml import etree | |
filename = '' | |
xml = etree.parse(filename) | |
output = [] | |
for reporthost in xml.xpath('//ReportHost'): | |
name = reporthost.attrib['name'] | |
out = {'name' : name, 'ports': []} | |
for synscanned in reporthost.xpath('ReportItem[@pluginName="Nessus SYN scanner"]'): | |
port = {'proto': synscanned.attrib['protocol'], 'svc': synscanned.attrib['svc_name'], 'nr': synscanned.attrib['port']} | |
out['ports'].append(port) | |
output.append(out) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment