1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 22:21:29 +00:00

Whitespace in hbase-* hadoop-*.

This commit is contained in:
david
2012-01-14 01:03:18 +00:00
parent 86c042302f
commit de0f92ea9a
7 changed files with 181 additions and 181 deletions

View File

@@ -17,7 +17,7 @@ For more information about hadoop, see:
-- @output -- @output
-- PORT STATE SERVICE REASON -- PORT STATE SERVICE REASON
-- 50075/tcp open hadoop-datanode syn-ack -- 50075/tcp open hadoop-datanode syn-ack
-- | hadoop-datanode-info: -- | hadoop-datanode-info:
-- |_ Logs: /logs/ -- |_ Logs: /logs/
--- ---
@@ -38,22 +38,22 @@ end
action = function( host, port ) action = function( host, port )
local result = {} local result = {}
local uri = "/browseDirectory.jsp" local uri = "/browseDirectory.jsp"
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
local response = http.get( host.targetname or host.ip, port.number, uri ) local response = http.get( host.targetname or host.ip, port.number, uri )
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
port.version.name = "hadoop-datanode" port.version.name = "hadoop-datanode"
port.version.product = "Apache Hadoop" port.version.product = "Apache Hadoop"
nmap.set_port_version(host, port, "hardmatched") nmap.set_port_version(host, port, "hardmatched")
local body = response['body']:gsub("%%","%%%%") local body = response['body']:gsub("%%","%%%%")
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
if body:match("([^][\"]+)\">Log") then if body:match("([^][\"]+)\">Log") then
local logs = body:match("([^][\"]+)\">Log") local logs = body:match("([^][\"]+)\">Log")
stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs)) stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs))
table.insert(result, ("Logs: %s"):format(logs)) table.insert(result, ("Logs: %s"):format(logs))
end end
return stdnse.format_output(true, result) return stdnse.format_output(true, result)
end end
end end

View File

@@ -10,7 +10,7 @@ Information gathered:
* Log directory (relative to http://host:port/) * Log directory (relative to http://host:port/)
* Associated TaskTrackers * Associated TaskTrackers
* Optionally also user activity history * Optionally also user activity history
For more information about Hadoop, see: For more information about Hadoop, see:
* http://hadoop.apache.org/ * http://hadoop.apache.org/
* http://en.wikipedia.org/wiki/Apache_Hadoop * http://en.wikipedia.org/wiki/Apache_Hadoop
@@ -20,20 +20,20 @@ For more information about Hadoop, see:
--- ---
-- @usage -- @usage
-- nmap --script hadoop-jobtracker-info [--script-args=hadoop-jobtracker-info.userinfo] -p 50030 host -- nmap --script hadoop-jobtracker-info [--script-args=hadoop-jobtracker-info.userinfo] -p 50030 host
-- --
-- @output -- @output
-- 50030/tcp open hadoop-jobtracker -- 50030/tcp open hadoop-jobtracker
-- | hadoop-jobtracker-info: -- | hadoop-jobtracker-info:
-- | State: RUNNING -- | State: RUNNING
-- | Started: Wed May 11 22:33:44 PDT 2011, bob -- | Started: Wed May 11 22:33:44 PDT 2011, bob
-- | Version: 0.20.2 (f415ef415ef415ef415ef415ef415ef415ef415e) -- | Version: 0.20.2 (f415ef415ef415ef415ef415ef415ef415ef415e)
-- | Compiled: Wed May 11 22:33:44 PDT 2011 by bob from unknown -- | Compiled: Wed May 11 22:33:44 PDT 2011 by bob from unknown
-- | Identifier: 201111031342 -- | Identifier: 201111031342
-- | Log Files: logs/ -- | Log Files: logs/
-- | Tasktrackers: -- | Tasktrackers:
-- | tracker1.example.com:50060 -- | tracker1.example.com:50060
-- | tracker2.example.com:50060 -- | tracker2.example.com:50060
-- | Userhistory: -- | Userhistory:
-- | User: bob (Wed Sep 07 12:14:33 CEST 2011) -- | User: bob (Wed Sep 07 12:14:33 CEST 2011)
-- |_ User: bob (Wed Sep 07 12:14:33 CEST 2011) -- |_ User: bob (Wed Sep 07 12:14:33 CEST 2011)
-- --- -- ---
@@ -55,16 +55,16 @@ portrule = function(host, port)
end end
get_userhistory = function( host, port ) get_userhistory = function( host, port )
local results = {} local results = {}
local uri = "/jobhistory.jsp?pageno=-1&search=" local uri = "/jobhistory.jsp?pageno=-1&search="
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
local response = http.get( host.targetname or host.ip, port.number, uri ) local response = http.get( host.targetname or host.ip, port.number, uri )
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
local body = response['body']:gsub("%%","%%%%") local body = response['body']:gsub("%%","%%%%")
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
for line in string.gmatch(body, "[^\n]+") do for line in string.gmatch(body, "[^\n]+") do
stdnse.print_debug(3, ("%s: Line %s\n"):format(SCRIPT_NAME,line)) stdnse.print_debug(3, ("%s: Line %s\n"):format(SCRIPT_NAME,line))
if line:match("job_[%d_]+") then if line:match("job_[%d_]+") then
local user = line:match("<td>([^][<>]+)</td></tr>") local user = line:match("<td>([^][<>]+)</td></tr>")
local job_time = line:match("</td><td>([^][<]+)") local job_time = line:match("</td><td>([^][<]+)")
@@ -76,18 +76,18 @@ get_userhistory = function( host, port )
return results return results
end end
get_tasktrackers = function( host, port ) get_tasktrackers = function( host, port )
local results = {} local results = {}
local uri = "/machines.jsp?type=active" local uri = "/machines.jsp?type=active"
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
local response = http.get( host.targetname or host.ip, port.number, uri ) local response = http.get( host.targetname or host.ip, port.number, uri )
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,response['body'])) stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,response['body']))
for line in string.gmatch(response['body'], "[^\n]+") do for line in string.gmatch(response['body'], "[^\n]+") do
stdnse.print_debug(3, ("%s: Line %s\n"):format(SCRIPT_NAME,line)) stdnse.print_debug(3, ("%s: Line %s\n"):format(SCRIPT_NAME,line))
if line:match("href=\"[%w]+://([%w%.:]+)/\">tracker") then if line:match("href=\"[%w]+://([%w%.:]+)/\">tracker") then
local tasktracker = line:match("href=\".*//([%w%.:]+)/\">tracker") local tasktracker = line:match("href=\".*//([%w%.:]+)/\">tracker")
stdnse.print_debug(1, ("%s: taskstracker %s"):format(SCRIPT_NAME,tasktracker)) stdnse.print_debug(1, ("%s: taskstracker %s"):format(SCRIPT_NAME,tasktracker))
table.insert( results, tasktracker) table.insert( results, tasktracker)
if target.ALLOW_NEW_TARGETS then if target.ALLOW_NEW_TARGETS then
if tasktracker:match("([%w%.]+)") then if tasktracker:match("([%w%.]+)") then
@@ -95,65 +95,65 @@ get_tasktrackers = function( host, port )
stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget)) stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget))
local status,err = target.add(newtarget) local status,err = target.add(newtarget)
end end
end end
end end
end end
end end
return results return results
end end
action = function( host, port ) action = function( host, port )
local result = {} local result = {}
local uri = "/jobtracker.jsp" local uri = "/jobtracker.jsp"
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
local response = http.get( host.targetname or host.ip, port.number, uri ) local response = http.get( host.targetname or host.ip, port.number, uri )
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,response['body'])) stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,response['body']))
port.version.name = "hadoop-jobtracker" port.version.name = "hadoop-jobtracker"
port.version.product = "Apache Hadoop" port.version.product = "Apache Hadoop"
if response['body']:match("State:</b>%s*([^][<]+)") then if response['body']:match("State:</b>%s*([^][<]+)") then
local state = response['body']:match("State:</b>%s*([^][<]+)") local state = response['body']:match("State:</b>%s*([^][<]+)")
stdnse.print_debug(1, ("%s: State %s"):format(SCRIPT_NAME,state)) stdnse.print_debug(1, ("%s: State %s"):format(SCRIPT_NAME,state))
table.insert(result, ("State: %s"):format(state)) table.insert(result, ("State: %s"):format(state))
end end
if response['body']:match("Started:</b>%s*([^][<]+)") then if response['body']:match("Started:</b>%s*([^][<]+)") then
local started = response['body']:match("Started:</b>%s*([^][<]+)") local started = response['body']:match("Started:</b>%s*([^][<]+)")
stdnse.print_debug(1, ("%s: Started %s"):format(SCRIPT_NAME,started)) stdnse.print_debug(1, ("%s: Started %s"):format(SCRIPT_NAME,started))
table.insert(result, ("Started: %s"):format(started)) table.insert(result, ("Started: %s"):format(started))
end end
if response['body']:match("Version:</b>%s*([^][<]+)") then if response['body']:match("Version:</b>%s*([^][<]+)") then
local version = response['body']:match("Version:</b>%s*([^][<]+)") local version = response['body']:match("Version:</b>%s*([^][<]+)")
local versionNo = version:match("([^][,]+)") local versionNo = version:match("([^][,]+)")
local versionHash = version:match("[^][,]+%s+(%w+)") local versionHash = version:match("[^][,]+%s+(%w+)")
stdnse.print_debug(1, ("%s: Version %s (%s)"):format(SCRIPT_NAME,versionNo,versionHash)) stdnse.print_debug(1, ("%s: Version %s (%s)"):format(SCRIPT_NAME,versionNo,versionHash))
table.insert(result, ("Version: %s (%s)"):format(versionNo,versionHash)) table.insert(result, ("Version: %s (%s)"):format(versionNo,versionHash))
port.version.version = versionNo port.version.version = versionNo
end end
if response['body']:match("Compiled:</b>%s*([^][<]+)") then if response['body']:match("Compiled:</b>%s*([^][<]+)") then
local compiled = response['body']:match("Compiled:</b>%s*([^][<]+)"):gsub("%s+", " ") local compiled = response['body']:match("Compiled:</b>%s*([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled)) stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled))
table.insert(result, ("Compiled: %s"):format(compiled)) table.insert(result, ("Compiled: %s"):format(compiled))
end end
if response['body']:match("Identifier:</b>%s*([^][<]+)") then if response['body']:match("Identifier:</b>%s*([^][<]+)") then
local identifier = response['body']:match("Identifier:</b>%s*([^][<]+)") local identifier = response['body']:match("Identifier:</b>%s*([^][<]+)")
stdnse.print_debug(1, ("%s: Identifier %s"):format(SCRIPT_NAME,identifier)) stdnse.print_debug(1, ("%s: Identifier %s"):format(SCRIPT_NAME,identifier))
table.insert(result, ("Identifier: %s"):format(identifier)) table.insert(result, ("Identifier: %s"):format(identifier))
end end
if response['body']:match("([%w/]+)\">Log<") then if response['body']:match("([%w/]+)\">Log<") then
local logfiles = response['body']:match("([%w/-_:%%]+)\">Log<") local logfiles = response['body']:match("([%w/-_:%%]+)\">Log<")
stdnse.print_debug(1, ("%s: Log Files %s"):format(SCRIPT_NAME,logfiles)) stdnse.print_debug(1, ("%s: Log Files %s"):format(SCRIPT_NAME,logfiles))
table.insert(result, ("Log Files: %s"):format(logfiles)) table.insert(result, ("Log Files: %s"):format(logfiles))
end end
nmap.set_port_version(host, port, "hardmatched") nmap.set_port_version(host, port, "hardmatched")
local tasktrackers = get_tasktrackers (host, port) local tasktrackers = get_tasktrackers (host, port)
table.insert(result, "Tasktrackers: ") table.insert(result, "Tasktrackers: ")
table.insert(result, tasktrackers) table.insert(result, tasktrackers)
if stdnse.get_script_args('hadoop-jobtracker-info.userinfo') then if stdnse.get_script_args('hadoop-jobtracker-info.userinfo') then
local userhistory = get_userhistory (host, port) local userhistory = get_userhistory (host, port)
table.insert(result, "Userhistory: ") table.insert(result, "Userhistory: ")
table.insert(result, userhistory) table.insert(result, userhistory)
end end
return stdnse.format_output(true, result) return stdnse.format_output(true, result)
end end
end end

View File

@@ -9,7 +9,7 @@ Information gathered:
* Filesystem directory (relative to http://host:port/) * Filesystem directory (relative to http://host:port/)
* Log directory (relative to http://host:port/) * Log directory (relative to http://host:port/)
* Associated DataNodes. * Associated DataNodes.
For more information about Hadoop, see: For more information about Hadoop, see:
* http://hadoop.apache.org/ * http://hadoop.apache.org/
* http://en.wikipedia.org/wiki/Apache_Hadoop * http://en.wikipedia.org/wiki/Apache_Hadoop
@@ -23,7 +23,7 @@ For more information about Hadoop, see:
-- @output -- @output
-- PORT STATE SERVICE REASON -- PORT STATE SERVICE REASON
-- 50070/tcp open hadoop-namenode syn-ack -- 50070/tcp open hadoop-namenode syn-ack
-- | hadoop-namenode-info: -- | hadoop-namenode-info:
-- | Started: Wed May 11 22:33:44 PDT 2011 -- | Started: Wed May 11 22:33:44 PDT 2011
-- | Version: 0.20.2-cdh3u1, f415ef415ef415ef415ef415ef415ef415ef415e -- | Version: 0.20.2-cdh3u1, f415ef415ef415ef415ef415ef415ef415ef415e
-- | Compiled: Wed May 11 22:33:44 PDT 2011 by bob from unknown -- | Compiled: Wed May 11 22:33:44 PDT 2011 by bob from unknown
@@ -33,7 +33,7 @@ For more information about Hadoop, see:
-- | Storage: -- | Storage:
-- | Total Used (DFS) Used (Non DFS) Remaining -- | Total Used (DFS) Used (Non DFS) Remaining
-- | 100 TB 85 TB 500 GB 14.5 TB -- | 100 TB 85 TB 500 GB 14.5 TB
-- | Datanodes (Live): -- | Datanodes (Live):
-- | Datanode: datanode1.example.com:50075 -- | Datanode: datanode1.example.com:50075
-- | Datanode: datanode2.example.com:50075 -- | Datanode: datanode2.example.com:50075
--- ---
@@ -59,13 +59,13 @@ get_datanodes = function( host, port, Status )
local uri = "/dfsnodelist.jsp?whatNodes=" .. Status local uri = "/dfsnodelist.jsp?whatNodes=" .. Status
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
local response = http.get( host.targetname or host.ip, port.number, uri ) local response = http.get( host.targetname or host.ip, port.number, uri )
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response" )) stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response" ))
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
local body = response['body']:gsub("%%","%%%%") local body = response['body']:gsub("%%","%%%%")
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
for datanodetmp in string.gmatch(body, "[%w%.:-_]+/browseDirectory.jsp") do for datanodetmp in string.gmatch(body, "[%w%.:-_]+/browseDirectory.jsp") do
local datanode = datanodetmp:gsub("/browseDirectory.jsp","") local datanode = datanodetmp:gsub("/browseDirectory.jsp","")
stdnse.print_debug(1, ("%s: Datanode %s"):format(SCRIPT_NAME,datanode)) stdnse.print_debug(1, ("%s: Datanode %s"):format(SCRIPT_NAME,datanode))
table.insert(result, ("Datanode: %s"):format(datanode)) table.insert(result, ("Datanode: %s"):format(datanode))
if target.ALLOW_NEW_TARGETS then if target.ALLOW_NEW_TARGETS then
if datanode:match("([%w%.]+)") then if datanode:match("([%w%.]+)") then
@@ -76,64 +76,64 @@ get_datanodes = function( host, port, Status )
end end
end end
end end
return result return result
end end
action = function( host, port ) action = function( host, port )
local result = {} local result = {}
local uri = "/dfshealth.jsp" local uri = "/dfshealth.jsp"
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
local response = http.get( host.targetname or host.ip, port.number, uri ) local response = http.get( host.targetname or host.ip, port.number, uri )
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
local body = response['body']:gsub("%%","%%%%") local body = response['body']:gsub("%%","%%%%")
local capacity = {} local capacity = {}
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
port.version.name = "hadoop-namenode" port.version.name = "hadoop-namenode"
port.version.product = "Apache Hadoop" port.version.product = "Apache Hadoop"
if body:match("Started:%s*<td>([^][<]+)") then if body:match("Started:%s*<td>([^][<]+)") then
local start = body:match("Started:%s*<td>([^][<]+)") local start = body:match("Started:%s*<td>([^][<]+)")
stdnse.print_debug(1, ("%s: Started %s"):format(SCRIPT_NAME,start)) stdnse.print_debug(1, ("%s: Started %s"):format(SCRIPT_NAME,start))
table.insert(result, ("Started: %s"):format(start)) table.insert(result, ("Started: %s"):format(start))
end end
if body:match("Version:%s*<td>([^][<]+)") then if body:match("Version:%s*<td>([^][<]+)") then
local version = body:match("Version:%s*<td>([^][<]+)") local version = body:match("Version:%s*<td>([^][<]+)")
stdnse.print_debug(1, ("%s: Version %s"):format(SCRIPT_NAME,version)) stdnse.print_debug(1, ("%s: Version %s"):format(SCRIPT_NAME,version))
table.insert(result, ("Version: %s"):format(version)) table.insert(result, ("Version: %s"):format(version))
port.version.version = version port.version.version = version
end end
if body:match("Compiled:%s*<td>([^][<]+)") then if body:match("Compiled:%s*<td>([^][<]+)") then
local compiled = body:match("Compiled:%s*<td>([^][<]+)") local compiled = body:match("Compiled:%s*<td>([^][<]+)")
stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled)) stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled))
table.insert(result, ("Compiled: %s"):format(compiled)) table.insert(result, ("Compiled: %s"):format(compiled))
end end
if body:match("Upgrades:%s*<td>([^][<]+)") then if body:match("Upgrades:%s*<td>([^][<]+)") then
local upgrades = body:match("Upgrades:%s*<td>([^][<]+)") local upgrades = body:match("Upgrades:%s*<td>([^][<]+)")
stdnse.print_debug(1, ("%s: Upgrades %s"):format(SCRIPT_NAME,upgrades)) stdnse.print_debug(1, ("%s: Upgrades %s"):format(SCRIPT_NAME,upgrades))
table.insert(result, ("Upgrades: %s"):format(upgrades)) table.insert(result, ("Upgrades: %s"):format(upgrades))
end end
if body:match("([^][\"]+)\">Browse") then if body:match("([^][\"]+)\">Browse") then
local filesystem = body:match("([^][\"]+)\">Browse") local filesystem = body:match("([^][\"]+)\">Browse")
stdnse.print_debug(1, ("%s: Filesystem %s"):format(SCRIPT_NAME,filesystem)) stdnse.print_debug(1, ("%s: Filesystem %s"):format(SCRIPT_NAME,filesystem))
table.insert(result, ("Filesystem: %s"):format(filesystem)) table.insert(result, ("Filesystem: %s"):format(filesystem))
end end
if body:match("([^][\"]+)\">Namenode") then if body:match("([^][\"]+)\">Namenode") then
local logs = body:match("([^][\"]+)\">Namenode") local logs = body:match("([^][\"]+)\">Namenode")
stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs)) stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs))
table.insert(result, ("Logs: %s"):format(logs)) table.insert(result, ("Logs: %s"):format(logs))
end end
for i in string.gmatch(body, "[%d%.]+%s[KMGTP]B") do for i in string.gmatch(body, "[%d%.]+%s[KMGTP]B") do
table.insert(capacity,i) table.insert(capacity,i)
end end
stdnse.print_debug(1, ("%s: Total %s"):format(SCRIPT_NAME,capacity[3])) stdnse.print_debug(1, ("%s: Total %s"):format(SCRIPT_NAME,capacity[3]))
stdnse.print_debug(1, ("%s: Used DFS (NonDFS) %s (%s)"):format(SCRIPT_NAME,capacity[4],capacity[5])) stdnse.print_debug(1, ("%s: Used DFS (NonDFS) %s (%s)"):format(SCRIPT_NAME,capacity[4],capacity[5]))
stdnse.print_debug(1, ("%s: Remaining %s"):format(SCRIPT_NAME,capacity[6])) stdnse.print_debug(1, ("%s: Remaining %s"):format(SCRIPT_NAME,capacity[6]))
table.insert(result,"Storage:") table.insert(result,"Storage:")
table.insert(result,"Total\tUsed (DFS)\tUsed (Non DFS)\tRemaining") table.insert(result,"Total\tUsed (DFS)\tUsed (Non DFS)\tRemaining")
table.insert(result, ("%s\t%s\t%s\t%s"):format(capacity[3],capacity[4],capacity[5],capacity[6])) table.insert(result, ("%s\t%s\t%s\t%s"):format(capacity[3],capacity[4],capacity[5],capacity[6]))
nmap.set_port_version(host, port, "hardmatched") nmap.set_port_version(host, port, "hardmatched")
local datanodes_live = get_datanodes(host,port, "LIVE") local datanodes_live = get_datanodes(host,port, "LIVE")
table.insert(result, "Datanodes (Live): ") table.insert(result, "Datanodes (Live): ")
table.insert(result, datanodes_live) table.insert(result, datanodes_live)
local datanodes_dead = get_datanodes(host,port, "DEAD") local datanodes_dead = get_datanodes(host,port, "DEAD")

View File

@@ -5,12 +5,12 @@ Information gathered:
* Date/time the service was started * Date/time the service was started
* Hadoop version * Hadoop version
* Hadoop compile date * Hadoop compile date
* Hostname or IP address and port of the master NameNode server * Hostname or IP address and port of the master NameNode server
* Last time a checkpoint was taken * Last time a checkpoint was taken
* How often checkpoints are taken (in seconds) * How often checkpoints are taken (in seconds)
* Log directory (relative to http://host:port/) * Log directory (relative to http://host:port/)
* File size of current checkpoint * File size of current checkpoint
For more information about Hadoop, see: For more information about Hadoop, see:
* http://hadoop.apache.org/ * http://hadoop.apache.org/
* http://en.wikipedia.org/wiki/Apache_Hadoop * http://en.wikipedia.org/wiki/Apache_Hadoop
@@ -24,7 +24,7 @@ For more information about Hadoop, see:
-- @output -- @output
-- PORT STATE SERVICE REASON -- PORT STATE SERVICE REASON
-- 50090/tcp open unknown syn-ack -- 50090/tcp open unknown syn-ack
-- | hadoop-secondary-namenode-info: -- | hadoop-secondary-namenode-info:
-- | Start: Wed May 11 22:33:44 PDT 2011 -- | Start: Wed May 11 22:33:44 PDT 2011
-- | Version: 0.20.2, f415ef415ef415ef415ef415ef415ef415ef415e -- | Version: 0.20.2, f415ef415ef415ef415ef415ef415ef415ef415e
-- | Compiled: Wed May 11 22:33:44 PDT 2011 by bob from unknown -- | Compiled: Wed May 11 22:33:44 PDT 2011 by bob from unknown
@@ -52,19 +52,19 @@ end
action = function( host, port ) action = function( host, port )
local result = {} local result = {}
local uri = "/status.jsp" local uri = "/status.jsp"
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
local response = http.get( host.targetname or host.ip, port.number, uri ) local response = http.get( host.targetname or host.ip, port.number, uri )
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Resposne")) stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Resposne"))
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
local body = response['body']:gsub("%%","%%%%") local body = response['body']:gsub("%%","%%%%")
local stats = {} local stats = {}
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
port.version.name = "hadoop-secondary-namenode" port.version.name = "hadoop-secondary-namenode"
port.version.product = "Apache Hadoop" port.version.product = "Apache Hadoop"
-- Page isn't valid html :( -- Page isn't valid html :(
for i in string.gmatch(body,"\n[%w%s]+:%s+[^][\n]+") do for i in string.gmatch(body,"\n[%w%s]+:%s+[^][\n]+") do
table.insert(stats,i:match(":%s+([^][\n]+)")) table.insert(stats,i:match(":%s+([^][\n]+)"))
end end
stdnse.print_debug(1, ("%s: namenode %s"):format(SCRIPT_NAME,stats[1])) stdnse.print_debug(1, ("%s: namenode %s"):format(SCRIPT_NAME,stats[1]))
@@ -75,20 +75,20 @@ action = function( host, port )
table.insert(result, ("Start: %s"):format(stats[2])) table.insert(result, ("Start: %s"):format(stats[2]))
if body:match("Version:%s*</td><td>([^][\n]+)") then if body:match("Version:%s*</td><td>([^][\n]+)") then
local version = body:match("Version:%s*</td><td>([^][\n]+)") local version = body:match("Version:%s*</td><td>([^][\n]+)")
stdnse.print_debug(1, ("%s: Version %s"):format(SCRIPT_NAME,version)) stdnse.print_debug(1, ("%s: Version %s"):format(SCRIPT_NAME,version))
table.insert(result, ("Version: %s"):format(version)) table.insert(result, ("Version: %s"):format(version))
port.version.version = version port.version.version = version
end end
if body:match("Compiled:%s*</td><td>([^][\n]+)") then if body:match("Compiled:%s*</td><td>([^][\n]+)") then
local compiled = body:match("Compiled:%s*</td><td>([^][\n]+)") local compiled = body:match("Compiled:%s*</td><td>([^][\n]+)")
stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled)) stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled))
table.insert(result, ("Compiled: %s"):format(compiled)) table.insert(result, ("Compiled: %s"):format(compiled))
end end
if body:match("([^][\"]+)\">Logs") then if body:match("([^][\"]+)\">Logs") then
local logs = body:match("([^][\"]+)\">Logs") local logs = body:match("([^][\"]+)\">Logs")
stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs)) stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs))
table.insert(result, ("Logs: %s"):format(logs)) table.insert(result, ("Logs: %s"):format(logs))
end end
table.insert(result, ("Namenode: %s"):format(stats[1])) table.insert(result, ("Namenode: %s"):format(stats[1]))
table.insert(result, ("Last Checkpoint: %s"):format(stats[3])) table.insert(result, ("Last Checkpoint: %s"):format(stats[3]))
table.insert(result, ("Checkpoint Period: %s"):format(stats[4])) table.insert(result, ("Checkpoint Period: %s"):format(stats[4]))
@@ -100,7 +100,7 @@ action = function( host, port )
local status,err = target.add(newtarget) local status,err = target.add(newtarget)
end end
end end
end end
return stdnse.format_output(true, result) return stdnse.format_output(true, result)
end end

View File

@@ -5,7 +5,7 @@ Information gathered:
* Hadoop version * Hadoop version
* Hadoop Compile date * Hadoop Compile date
* Log directory (relative to http://host:port/) * Log directory (relative to http://host:port/)
For more information about Hadoop, see: For more information about Hadoop, see:
* http://hadoop.apache.org/ * http://hadoop.apache.org/
* http://en.wikipedia.org/wiki/Apache_Hadoop * http://en.wikipedia.org/wiki/Apache_Hadoop
@@ -19,7 +19,7 @@ For more information about Hadoop, see:
-- @output -- @output
-- PORT STATE SERVICE REASON -- PORT STATE SERVICE REASON
-- 50060/tcp open hadoop-tasktracker syn-ack -- 50060/tcp open hadoop-tasktracker syn-ack
-- | hadoop-tasktracker-info: -- | hadoop-tasktracker-info:
-- | Version: 0.20.1 (f415ef415ef415ef415ef415ef415ef415ef415e) -- | Version: 0.20.1 (f415ef415ef415ef415ef415ef415ef415ef415e)
-- | Compiled: Wed May 11 22:33:44 PDT 2011 by bob from unknown -- | Compiled: Wed May 11 22:33:44 PDT 2011 by bob from unknown
-- |_ Logs: /logs/ -- |_ Logs: /logs/
@@ -42,34 +42,34 @@ end
action = function( host, port ) action = function( host, port )
local result = {} local result = {}
local uri = "/tasktracker.jsp" local uri = "/tasktracker.jsp"
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
local response = http.get( host.targetname or host.ip, port.number, uri ) local response = http.get( host.targetname or host.ip, port.number, uri )
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
local body = response['body']:gsub("%%","%%%%") local body = response['body']:gsub("%%","%%%%")
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
port.version.name = "hadoop-tasktracker" port.version.name = "hadoop-tasktracker"
port.version.product = "Apache Hadoop" port.version.product = "Apache Hadoop"
if response['body']:match("Version:</b>%s*([^][<]+)") then if response['body']:match("Version:</b>%s*([^][<]+)") then
local version = response['body']:match("Version:</b>%s*([^][<]+)") local version = response['body']:match("Version:</b>%s*([^][<]+)")
local versionNo = version:match("([^][,]+)") local versionNo = version:match("([^][,]+)")
local versionHash = version:match("[^][,]+%s+(%w+)") local versionHash = version:match("[^][,]+%s+(%w+)")
stdnse.print_debug(1, ("%s: Version %s (%s)"):format(SCRIPT_NAME,versionNo,versionHash)) stdnse.print_debug(1, ("%s: Version %s (%s)"):format(SCRIPT_NAME,versionNo,versionHash))
table.insert(result, ("Version: %s (%s)"):format(versionNo,versionHash)) table.insert(result, ("Version: %s (%s)"):format(versionNo,versionHash))
port.version.version = version port.version.version = version
end end
if response['body']:match("Compiled:</b>%s*([^][<]+)") then if response['body']:match("Compiled:</b>%s*([^][<]+)") then
local compiled = response['body']:match("Compiled:</b>%s*([^][<]+)"):gsub("%s+", " ") local compiled = response['body']:match("Compiled:</b>%s*([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled)) stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled))
table.insert(result, ("Compiled: %s"):format(compiled)) table.insert(result, ("Compiled: %s"):format(compiled))
end end
if body:match("([^][\"]+)\">Log") then if body:match("([^][\"]+)\">Log") then
local logs = body:match("([^][\"]+)\">Log") local logs = body:match("([^][\"]+)\">Log")
stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs)) stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs))
table.insert(result, ("Logs: %s"):format(logs)) table.insert(result, ("Logs: %s"):format(logs))
end end
nmap.set_port_version(host, port, "hardmatched") nmap.set_port_version(host, port, "hardmatched")
return stdnse.format_output(true, result) return stdnse.format_output(true, result)
end end

View File

@@ -10,7 +10,7 @@ Information gathered:
* Average load * Average load
* Zookeeper quorum server * Zookeeper quorum server
* Associated region servers * Associated region servers
For more information about Hbase, see: For more information about Hbase, see:
* http://hbase.apache.org/ * http://hbase.apache.org/
* http://wiki.apache.org/hadoop/Hbase * http://wiki.apache.org/hadoop/Hbase
@@ -22,7 +22,7 @@ For more information about Hbase, see:
-- nmap --script hbase-master-info -p 60010 host -- nmap --script hbase-master-info -p 60010 host
-- --
-- @output -- @output
-- | hbase-master-info: -- | hbase-master-info:
-- | Hbase Version: 0.90.1 -- | Hbase Version: 0.90.1
-- | Hbase Compiled: Wed May 11 22:33:44 PDT 2011, bob -- | Hbase Compiled: Wed May 11 22:33:44 PDT 2011, bob
-- | HBase Root Directory: hdfs://master.example.com:8020/hbase -- | HBase Root Directory: hdfs://master.example.com:8020/hbase
@@ -53,65 +53,65 @@ end
action = function( host, port ) action = function( host, port )
local result = {} local result = {}
local region_servers = {} local region_servers = {}
local uri = "/master.jsp" local uri = "/master.jsp"
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
local response = http.get( host.targetname or host.ip, port.number, uri ) local response = http.get( host.targetname or host.ip, port.number, uri )
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
local body = response['body']:gsub("%%","%%%%") local body = response['body']:gsub("%%","%%%%")
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
port.version.name = "hbase-master" port.version.name = "hbase-master"
port.version.product = "Apache Hadoop Hbase" port.version.product = "Apache Hadoop Hbase"
if body:match("HBase%s+Version</td><td>([^][<]+)") then if body:match("HBase%s+Version</td><td>([^][<]+)") then
local version = body:match("HBase%s+Version</td><td>([^][<]+)"):gsub("%s+", " ") local version = body:match("HBase%s+Version</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s:Hbase Version %s"):format(SCRIPT_NAME,version)) stdnse.print_debug(1, ("%s:Hbase Version %s"):format(SCRIPT_NAME,version))
table.insert(result, ("Hbase Version: %s"):format(version)) table.insert(result, ("Hbase Version: %s"):format(version))
port.version.version = version port.version.version = version
end end
if body:match("HBase%s+Compiled</td><td>([^][<]+)") then if body:match("HBase%s+Compiled</td><td>([^][<]+)") then
local compiled = body:match("HBase%s+Compiled</td><td>([^][<]+)"):gsub("%s+", " ") local compiled = body:match("HBase%s+Compiled</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: Hbase Compiled %s"):format(SCRIPT_NAME,compiled)) stdnse.print_debug(1, ("%s: Hbase Compiled %s"):format(SCRIPT_NAME,compiled))
table.insert(result, ("Hbase Compiled: %s"):format(compiled)) table.insert(result, ("Hbase Compiled: %s"):format(compiled))
end end
if body:match("Directory</td><td>([^][<]+)") then if body:match("Directory</td><td>([^][<]+)") then
local compiled = body:match("Directory</td><td>([^][<]+)"):gsub("%s+", " ") local compiled = body:match("Directory</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: HBase RootDirectory %s"):format(SCRIPT_NAME,compiled)) stdnse.print_debug(1, ("%s: HBase RootDirectory %s"):format(SCRIPT_NAME,compiled))
table.insert(result, ("HBase Root Directory: %s"):format(compiled)) table.insert(result, ("HBase Root Directory: %s"):format(compiled))
end end
if body:match("Hadoop%s+Version</td><td>([^][<]+)") then if body:match("Hadoop%s+Version</td><td>([^][<]+)") then
local version = body:match("Hadoop%s+Version</td><td>([^][<]+)"):gsub("%s+", " ") local version = body:match("Hadoop%s+Version</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: Hadoop Version %s"):format(SCRIPT_NAME,version)) stdnse.print_debug(1, ("%s: Hadoop Version %s"):format(SCRIPT_NAME,version))
table.insert(result, ("Hadoop Version: %s"):format(version)) table.insert(result, ("Hadoop Version: %s"):format(version))
end end
if body:match("Hadoop%s+Compiled</td><td>([^][<]+)") then if body:match("Hadoop%s+Compiled</td><td>([^][<]+)") then
local compiled = body:match("Hadoop%s+Compiled</td><td>([^][<]+)"):gsub("%s+", " ") local compiled = body:match("Hadoop%s+Compiled</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: Hadoop Compiled %s"):format(SCRIPT_NAME,compiled)) stdnse.print_debug(1, ("%s: Hadoop Compiled %s"):format(SCRIPT_NAME,compiled))
table.insert(result, ("Hadoop Compiled: %s"):format(compiled)) table.insert(result, ("Hadoop Compiled: %s"):format(compiled))
end end
if body:match("average</td><td>([^][<]+)") then if body:match("average</td><td>([^][<]+)") then
local average = body:match("average</td><td>([^][<]+)"):gsub("%s+", " ") local average = body:match("average</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: Average Load %s"):format(SCRIPT_NAME,average)) stdnse.print_debug(1, ("%s: Average Load %s"):format(SCRIPT_NAME,average))
table.insert(result, ("Average Load: %s"):format(average)) table.insert(result, ("Average Load: %s"):format(average))
end end
if body:match("Quorum</td><td>([^][<]+)") then if body:match("Quorum</td><td>([^][<]+)") then
local quorum = body:match("Quorum</td><td>([^][<]+)"):gsub("%s+", " ") local quorum = body:match("Quorum</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: Zookeeper Quorum %s"):format(SCRIPT_NAME,quorum)) stdnse.print_debug(1, ("%s: Zookeeper Quorum %s"):format(SCRIPT_NAME,quorum))
table.insert(result, ("Zookeeper Quorum: %s"):format(quorum)) table.insert(result, ("Zookeeper Quorum: %s"):format(quorum))
if target.ALLOW_NEW_TARGETS then if target.ALLOW_NEW_TARGETS then
if quorum:match("([%w%.]+)") then if quorum:match("([%w%.]+)") then
local newtarget = quorum:match("([%w%.]+)") local newtarget = quorum:match("([%w%.]+)")
stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget)) stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget))
local status,err = target.add(newtarget) local status,err = target.add(newtarget)
end end
end end
end end
for line in string.gmatch(body, "[^\n]+") do for line in string.gmatch(body, "[^\n]+") do
stdnse.print_debug(3, ("%s: Line %s\n"):format(SCRIPT_NAME,line)) stdnse.print_debug(3, ("%s: Line %s\n"):format(SCRIPT_NAME,line))
if line:match("maxHeap") then if line:match("maxHeap") then
local region_server= line:match("\">([^][<]+)</a>") local region_server= line:match("\">([^][<]+)</a>")
stdnse.print_debug(1, ("%s: Region Server %s"):format(SCRIPT_NAME,region_server)) stdnse.print_debug(1, ("%s: Region Server %s"):format(SCRIPT_NAME,region_server))
table.insert(region_servers, region_server) table.insert(region_servers, region_server)
if target.ALLOW_NEW_TARGETS then if target.ALLOW_NEW_TARGETS then
if region_server:match("([%w%.]+)") then if region_server:match("([%w%.]+)") then

View File

@@ -6,7 +6,7 @@ Information gathered:
* HBase compile date * HBase compile date
* A bunch of metrics about the state of the region server * A bunch of metrics about the state of the region server
* Zookeeper quorum server * Zookeeper quorum server
For more information about Hbase, see: For more information about Hbase, see:
* http://hbase.apache.org/ * http://hbase.apache.org/
* http://wiki.apache.org/hadoop/Hbase * http://wiki.apache.org/hadoop/Hbase
@@ -19,12 +19,12 @@ For more information about Hbase, see:
-- @output -- @output
-- PORT STATE SERVICE REASON -- PORT STATE SERVICE REASON
-- 60030/tcp open hbase-region syn-ack -- 60030/tcp open hbase-region syn-ack
-- | hbase-region-info: -- | hbase-region-info:
-- | Hbase Version: 0.90.1 -- | Hbase Version: 0.90.1
-- | Hbase Compiled: Wed May 11 22:33:44 PDT 2011, bob -- | Hbase Compiled: Wed May 11 22:33:44 PDT 2011, bob
-- | Metrics requests=0, regions=0, stores=0, storefiles=0, storefileIndexSize=0, memstoreSize=0, -- | Metrics requests=0, regions=0, stores=0, storefiles=0, storefileIndexSize=0, memstoreSize=0,
-- | compactionQueueSize=0, flushQueueSize=0, usedHeap=0, maxHeap=0, blockCacheSize=0, -- | compactionQueueSize=0, flushQueueSize=0, usedHeap=0, maxHeap=0, blockCacheSize=0,
-- | blockCacheFree=0, blockCacheCount=0, blockCacheHitCount=0, blockCacheMissCount=0, -- | blockCacheFree=0, blockCacheCount=0, blockCacheHitCount=0, blockCacheMissCount=0,
-- | blockCacheEvictedCount=0, blockCacheHitRatio=0, blockCacheHitCachingRatio=0 -- | blockCacheEvictedCount=0, blockCacheHitRatio=0, blockCacheHitCachingRatio=0
-- |_ Zookeeper Quorum: zookeeper.example.com:2181 -- |_ Zookeeper Quorum: zookeeper.example.com:2181
--- ---
@@ -47,45 +47,45 @@ end
action = function( host, port ) action = function( host, port )
local result = {} local result = {}
local region_servers = {} local region_servers = {}
local uri = "/regionserver.jsp" local uri = "/regionserver.jsp"
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
local response = http.get( host.targetname or host.ip, port.number, uri ) local response = http.get( host.targetname or host.ip, port.number, uri )
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
local body = response['body']:gsub("%%","%%%%") local body = response['body']:gsub("%%","%%%%")
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
port.version.name = "hbase-region" port.version.name = "hbase-region"
port.version.product = "Apache Hadoop Hbase" port.version.product = "Apache Hadoop Hbase"
if body:match("HBase%s+Version</td><td>([^][<]+)") then if body:match("HBase%s+Version</td><td>([^][<]+)") then
local version = body:match("HBase%s+Version</td><td>([^][<]+)"):gsub("%s+", " ") local version = body:match("HBase%s+Version</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s:Hbase Version %s"):format(SCRIPT_NAME,version)) stdnse.print_debug(1, ("%s:Hbase Version %s"):format(SCRIPT_NAME,version))
table.insert(result, ("Hbase Version: %s"):format(version)) table.insert(result, ("Hbase Version: %s"):format(version))
port.version.version = version port.version.version = version
end end
if body:match("HBase%s+Compiled</td><td>([^][<]+)") then if body:match("HBase%s+Compiled</td><td>([^][<]+)") then
local compiled = body:match("HBase%s+Compiled</td><td>([^][<]+)"):gsub("%s+", " ") local compiled = body:match("HBase%s+Compiled</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: Hbase Compiled %s"):format(SCRIPT_NAME,compiled)) stdnse.print_debug(1, ("%s: Hbase Compiled %s"):format(SCRIPT_NAME,compiled))
table.insert(result, ("Hbase Compiled: %s"):format(compiled)) table.insert(result, ("Hbase Compiled: %s"):format(compiled))
end end
if body:match("Metrics</td><td>([^][<]+)") then if body:match("Metrics</td><td>([^][<]+)") then
local metrics = body:match("Metrics</td><td>([^][<]+)"):gsub("%s+", " ") local metrics = body:match("Metrics</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: Metrics %s"):format(SCRIPT_NAME,metrics)) stdnse.print_debug(1, ("%s: Metrics %s"):format(SCRIPT_NAME,metrics))
table.insert(result, ("Metrics %s"):format(metrics)) table.insert(result, ("Metrics %s"):format(metrics))
end end
if body:match("Quorum</td><td>([^][<]+)") then if body:match("Quorum</td><td>([^][<]+)") then
local quorum = body:match("Quorum</td><td>([^][<]+)"):gsub("%s+", " ") local quorum = body:match("Quorum</td><td>([^][<]+)"):gsub("%s+", " ")
stdnse.print_debug(1, ("%s: Zookeeper Quorum %s"):format(SCRIPT_NAME,quorum)) stdnse.print_debug(1, ("%s: Zookeeper Quorum %s"):format(SCRIPT_NAME,quorum))
table.insert(result, ("Zookeeper Quorum: %s"):format(quorum)) table.insert(result, ("Zookeeper Quorum: %s"):format(quorum))
if target.ALLOW_NEW_TARGETS then if target.ALLOW_NEW_TARGETS then
if quorum:match("([%w%.]+)") then if quorum:match("([%w%.]+)") then
local newtarget = quorum:match("([%w%.]+)") local newtarget = quorum:match("([%w%.]+)")
stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget)) stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget))
local status,err = target.add(newtarget) local status,err = target.add(newtarget)
end end
end end
end end
nmap.set_port_version(host, port, "hardmatched") nmap.set_port_version(host, port, "hardmatched")
return stdnse.format_output(true, result) return stdnse.format_output(true, result)
end end