Skip to content

Instantly share code, notes, and snippets.

@FrankSpierings
Created June 5, 2019 16:21
Show Gist options
  • Save FrankSpierings/a11ae1f20239c60f7e70f7b737a0bff0 to your computer and use it in GitHub Desktop.
Save FrankSpierings/a11ae1f20239c60f7e70f7b737a0bff0 to your computer and use it in GitHub Desktop.
Nessus parse xml host & ports from its SYN scan
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