mirror of
https://github.com/nmap/nmap.git
synced 2025-12-10 09:49:05 +00:00
Add the full ntpd version string, for example v4.2.4p4@1.1520-o, to the
port's version attributes if the remote service provides it. Also capture OS info as well as it can provide exact kernel versions in some cases.
This commit is contained in:
@@ -27,7 +27,7 @@ documentation of the protocol.
|
|||||||
-- nmap -sU -p 123 --script ntp-info <target>
|
-- nmap -sU -p 123 --script ntp-info <target>
|
||||||
-- @output
|
-- @output
|
||||||
-- PORT STATE SERVICE VERSION
|
-- PORT STATE SERVICE VERSION
|
||||||
-- 123/udp open ntp NTP v4
|
-- 123/udp open ntp NTP v4.2.4p4@1.1520-o
|
||||||
-- | ntp-info:
|
-- | ntp-info:
|
||||||
-- | receive time stamp: Sat Dec 12 16:22:41 2009
|
-- | receive time stamp: Sat Dec 12 16:22:41 2009
|
||||||
-- | version: ntpd 4.2.4p4@1.1520-o Wed May 13 21:06:31 UTC 2009 (1)
|
-- | version: ntpd 4.2.4p4@1.1520-o Wed May 13 21:06:31 UTC 2009 (1)
|
||||||
@@ -138,6 +138,19 @@ action = function(host, port)
|
|||||||
if(#output > 0) then
|
if(#output > 0) then
|
||||||
stdnse.debug1("Test len: %d", #output)
|
stdnse.debug1("Test len: %d", #output)
|
||||||
nmap.set_port_state(host, port, "open")
|
nmap.set_port_state(host, port, "open")
|
||||||
|
if output['version'] then
|
||||||
|
-- Look for the version string from the official ntpd and format it
|
||||||
|
-- in a manner similar to the output of the standard Nmap version detection
|
||||||
|
local version_num = string.match(output['version'],"^ntpd ([^@]+)")
|
||||||
|
if version_num then
|
||||||
|
port.version.version = "v" .. version_num
|
||||||
|
nmap.set_port_version(host, port, "hardmatched")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if output['system'] then
|
||||||
|
port.version.ostype = output['system']
|
||||||
|
nmap.set_port_version(host, port, "hardmatched")
|
||||||
|
end
|
||||||
if nmap.verbosity() < 1 then
|
if nmap.verbosity() < 1 then
|
||||||
local mt = getmetatable(output)
|
local mt = getmetatable(output)
|
||||||
mt["__tostring"] = function(t)
|
mt["__tostring"] = function(t)
|
||||||
|
|||||||
Reference in New Issue
Block a user