Home page logo
/

nmap-dev logo Nmap Development mailing list archives

[NSE] Underscore parsing in ntp-info
From: nnposter () users sourceforge net
Date: Mon, 24 Mar 2014 22:14:25 +0000

The following trivial patch corrects a case where the scanned NTP daemon uses underscores in the returned key/value 
pairs.


Output before the patch:

123/udp open  ntp     script-set
| ntp-info: 
|   version: 4
....
|   offset: 
|   frequency: 
|   jitter: 
|_  wander: 


Output after the patch:

123/udp open  ntp     script-set
| ntp-info: 
|   version: 4
....
|   offset: 
|   frequency: 
|   sys_jitter: 
|   clk_jitter: 
|_  clk_wander: 


Cheers,
nnposter



Patch against revision 32784 follows:

--- scripts/ntp-info.nse.orig   2014-03-24 13:10:46.066592900 -0600
+++ scripts/ntp-info.nse        2014-03-24 15:55:55.051565700 -0600
@@ -116,7 +116,7 @@
     -- This parsing is not quite right with respect to quoted strings.
     -- Backslash escapes should be interpreted inside strings and commas should
     -- be allowed inside them.
-    for k, q, v in string.gmatch(data, "%s*(%w+)=(\"?)([^,\"\r\n]*)%2,?") do
+    for k, q, v in string.gmatch(data, "%s*([%w_]+)=(\"?)([^,\"\r\n]*)%2,?") do
       output[k] = v
     end
   end
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]