Nmap Development mailing list archives

[NSE] ntp-info probing logic?


From: nnposter () users sourceforge net
Date: Mon, 24 Mar 2014 22:42:25 +0000

The current version of ntp-info.nse has the following flow:

1. Send NTPv4 request for date/time
2. Exit if it failed
3. Save results
4. Send NTPv2 request for readlist
5. Save results (if any)
6. Return all saved results

I am wondering if anybody has any insight into the reason behind
the early bailout in step 2.

I am seeing systems where the first probe in step 1 fails but
the second probe in step 4 does not. In case there is no good
reason to keep the current logic then I am proposing the patch
below, effectively removing step 2.


Cheers,
nnposter



Patch against revision 32784 follows:

--- scripts/ntp-info.nse.orig   2014-03-24 15:55:55.051565700 -0600
+++ scripts/ntp-info.nse        2014-03-24 16:27:21.245565700 -0600
@@ -87,10 +87,7 @@
                             0x00, 0x00, 0x00, 0x00)
 
   status, buftres = comm.exchange(host, port, treq, {proto=port.protocol, timeout=TIMEOUT})
-  if not status then
-    -- Don't try the second probe if this one didn't work.
-    return nil
-  else
+  if status then
     local _, sec, frac, tstamp
 
     _, sec, frac = bin.unpack(">II", buftres, 33)
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: