You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resend as the formatting was terrible - this is better but still not great :-(
I am trying to scan for and retrieve the NTP-MONLIST Results.
I end with with a KEYERROR when trying to reference the NTP-MONLIST results.
Please see below my scripts and testing.
Any guidance will be much appreciated!
-John
When I run the nmap command manually I get the results as part of the XML results:
++++++++++++
/usr/bin/nmap -oX - -vvv --stats-every 2s -sU -pU:123 -n -Pn --script=ntp-monlist 127.0.0.1
<script id="ntp-monlist" output="
Target is synchronised with 206.186.121.118
Alternative Target Interfaces:
192.168.64.144
Public Servers (4)
24.87.64.125 67.215.197.149 142.137.247.109 206.186.121.118
Private Clients (1)
127.0.0.1
"/>
++++++++++++
This is my script:
++++++++++++
!/usr/bin/python
from libnmap.process import NmapProcess
from libnmap.parser import NmapParser, NmapParserException
from libnmap.objects import NmapReport, NmapHost, NmapService
Hi
Resend as the formatting was terrible - this is better but still not great :-(
I am trying to scan for and retrieve the NTP-MONLIST Results.
I end with with a KEYERROR when trying to reference the NTP-MONLIST results.
Please see below my scripts and testing.
Any guidance will be much appreciated!
-John
When I run the nmap command manually I get the results as part of the XML results:
<script id="ntp-monlist" output=" Target is synchronised with 206.186.121.118 Alternative Target Interfaces: 192.168.64.144 Public Servers (4) 24.87.64.125 67.215.197.149 142.137.247.109 206.186.121.118 Private Clients (1) 127.0.0.1 "/>++++++++++++
/usr/bin/nmap -oX - -vvv --stats-every 2s -sU -pU:123 -n -Pn --script=ntp-monlist 127.0.0.1
++++++++++++
This is my script:
++++++++++++
!/usr/bin/python
from libnmap.process import NmapProcess
from libnmap.parser import NmapParser, NmapParserException
from libnmap.objects import NmapReport, NmapHost, NmapService
def do_scan(targets, options):
nm = NmapProcess(targets, options, safe_mode=False)
rc = nm.run()
if rc != 0:
print "nmap scan failed: %s" % (nm.stderr)
def print_scan(nmap_report):
print "Starting Nmap {0} ( http://nmap.org ) at {1}".format(
nmap_report._nmaprun['version'],
nmap_report._nmaprun['startstr'])
if name == "main":
global DEBUG
DEBUG = 0
TGTHOST = "127.0.0.1"
TGTPROTO = "udp"
NMAP_PROTO = " -sU -pU:"
TGTPORT = 123
report = do_scan(TGTHOST, NMAP_PROTO + str(TGTPORT) + " -n -Pn --script=ntp-monlist ")
print_scan(report)
++++++++++++++++++++++
This is the output I get when I run this script from the command_line:
[root@localhost python]# ./libnmap_testing.py
Starting Nmap 5.51 ( http://nmap.org ) at Fri May 16 13:10:26 2014
Nmap scan report for 127.0.0.1 (127.0.0.1)
Host is up.
PORT STATE SERVICE
123/udp open ntp
Nmap done at Fri May 16 13:10:26 2014; 1 IP address (1 host up) scanned in 0.08 seconds
++++++++++++++++++++++
nmap_report.commandline: /usr/bin/nmap -oX - -vvv --stats-every 2s -sU -pU:123 -n -Pn --script=ntp-monlist 127.0.0.1
++++++++++++++++++++++
HOST.address: 127.0.0.1
HOST.mac:
HOST.scripts_results:
Traceback (most recent call last):
File "./libnmap_testing.py", line 76, in
print_scan(report)
File "./libnmap_testing.py", line 57, in print_scan
print "HOST.scripts_results: ", (host.scripts_results['ntp-monlist'])
KeyError: 'ntp-monlist'
++++++++++++++++++++++
The text was updated successfully, but these errors were encountered: