Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. from lxml import etree
  2.  
  3. filename = ''
  4.  
  5. xml = etree.parse(filename)
  6.  
  7. output = []
  8. for reporthost in xml.xpath('//ReportHost'):
  9. name = reporthost.attrib['name']
  10. out = {'name' : name, 'ports': []}
  11. for synscanned in reporthost.xpath('ReportItem[@pluginName="Nessus SYN scanner"]'):
  12. port = {'proto': synscanned.attrib['protocol'], 'svc': synscanned.attrib['svc_name'], 'nr': synscanned.attrib['port']}
  13. out['ports'].append(port)
  14. output.append(out)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement