Skip to content

Instantly share code, notes, and snippets.

@savon-noir
Last active August 29, 2015 14:01
Show Gist options
  • Save savon-noir/84c6165e8ce130135e0d to your computer and use it in GitHub Desktop.
Save savon-noir/84c6165e8ce130135e0d to your computer and use it in GitHub Desktop.
from libnmap.parser import NmapParser
p = NmapParser.parse_fromfile("<path to the result of command>.xml")
for host in p.hosts:
for service in host.services:
for script_output in service.scripts_results:
print "Output of {0}: {1}".format(script_output['id'], script_output['output'])
@savon-noir
Copy link
Author

Output of ntp-monlist:
Target is synchronised with {some ip}
Alternative Target Interfaces:
192.168.1.3
Public Servers (1)
{some ip}
Private Clients (1)
127.0.0.1

@xqxq
Copy link

xqxq commented May 20, 2014

I am very new to this and really appreciate your guidance.

I am wondering if you pasted the wrong script as the output shows the script name ntp-monlist and the script posted is ntpmon.py.

Your example is reading the results from a file.

I was trying to get the result directly from NMAP output without writing to a file first, is that possible or do I have to write the results out and then go back and read the file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment