]+>([^][<]+)") do
- stdnse.print_debug(1, ("%s: %s=%s "):format(SCRIPT_NAME,name,value:gsub("^%s*(.-)%s*$", "%1")))
+ for name,value in string.gmatch(body,
+ "
| ([^][<]+) | %s*]+>([^][<]+)") do
+ stdnse.print_debug(1, "%s: %s=%s ",
+ SCRIPT_NAME, name, value:gsub("^%s*(.-)%s*$", "%1"))
if nmap.verbosity() > 1 then
result[#result+1] = ("%s: %s"):format(name,value:gsub("^%s*(.-)%s*$", "%1"))
else
@@ -169,31 +173,36 @@ action = function( host, port )
local nodes = { }
local zookeepers = { }
local hbasemasters = { }
- 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",
+ SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
local response = http.get( host, port, uri )
- 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
+ stdnse.print_debug(1, "%s: Status %s",
+ SCRIPT_NAME, response['status-line'] or "No Response")
+ if response['status-line'] and response['status-line']:match("200%s+OK")
+ and response['body'] then
local body = response['body']:gsub("%%","%%%%")
local capacity = {}
- stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
+ stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME, body)
if body:match("Version:%s*([^][,]+)") then
local version = body:match("Version:%s*([^][,]+)")
- stdnse.print_debug(1, ("%s: Version %s"):format(SCRIPT_NAME,version))
+ stdnse.print_debug(1, "%s: Version %s", SCRIPT_NAME, version)
result[#result+1] = ("Version: %s"):format(version)
port.version.version = version
end
if body:match("Compiled:%s*([^][<]+)") then
local compiled = body:match("Compiled:%s*([^][<]+)")
- stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled))
+ stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME, compiled)
result[#result+1] = ("Compiled: %s"):format(compiled)
end
if body:match("ServerID:%s*([^][<]+)") then
local upgrades = body:match("ServerID:%s*([^][<]+)")
- stdnse.print_debug(1, ("%s: ServerID %s"):format(SCRIPT_NAME,upgrades))
+ stdnse.print_debug(1, "%s: ServerID %s", SCRIPT_NAME, upgrades)
result[#result] = ("ServerID: %s"):format(upgrades)
end
- for logical,physical,hostname in string.gmatch(body," |
|---|
| ([%w%.-_:]+) | ([%w%.]+) | ([%w%.]+) | ") do
- stdnse.print_debug(2, ("%s: %s (%s) %s"):format(SCRIPT_NAME,physical,logical,hostname))
+ for logical,physical,hostname in string.gmatch(body,
+ "
| ([%w%.-_:]+) | ([%w%.]+) | ([%w%.]+) | ") do
+ stdnse.print_debug(2, "%s: %s (%s) %s",
+ SCRIPT_NAME, physical, logical, hostname)
if (table_count(nodes, hostname) == 0) then
nodes[#nodes+1] = hostname
add_target(hostname)
diff --git a/scripts/ganglia-info.nse b/scripts/ganglia-info.nse
index 712d475af..bc8d67d0b 100644
--- a/scripts/ganglia-info.nse
+++ b/scripts/ganglia-info.nse
@@ -108,16 +108,16 @@ action = function( host, port )
end
-- Retrieve grid data in XML format over TCP
- stdnse.print_debug(1, ("%s: Connecting to %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
+ stdnse.print_debug(1, "%s: Connecting to %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number)
local status, data = comm.get_banner(host, port, {timeout=timeout*1000,bytes=bytes})
if not status then
- stdnse.print_debug(1, ("%s: Timeout exceeded for %s:%s (Timeout: %ss)."):format(SCRIPT_NAME, host.targetname or host.ip, port.number, timeout))
+ stdnse.print_debug(1, "%s: Timeout exceeded for %s:%s (Timeout: %ss).", SCRIPT_NAME, host.targetname or host.ip, port.number, timeout)
return
end
-- Parse daemon info
if not string.match(data, "Log") then
port.version.name = "hadoop-datanode"
port.version.product = "Apache Hadoop"
nmap.set_port_version(host, port)
local logs = body:match("([^][\"]+)\">Log")
- stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs))
+ stdnse.print_debug(1, "%s: Logs %s", SCRIPT_NAME,logs)
table.insert(result, ("Logs: %s"):format(logs))
end
return stdnse.format_output(true, result)
diff --git a/scripts/hadoop-jobtracker-info.nse b/scripts/hadoop-jobtracker-info.nse
index 9ecec188d..c6570c160 100644
--- a/scripts/hadoop-jobtracker-info.nse
+++ b/scripts/hadoop-jobtracker-info.nse
@@ -62,18 +62,18 @@ end
get_userhistory = function( host, port )
local results = {}
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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
local response = http.get( host, port, uri )
- stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
+ stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response")
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
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", SCRIPT_NAME,body)
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", SCRIPT_NAME,line)
if line:match("job_[%d_]+") then
local user = line:match("([^][<>]+) |
")
local job_time = line:match("([^][<]+)")
- stdnse.print_debug(1, ("%s: User: %s (%s)"):format(SCRIPT_NAME,user,job_time))
+ stdnse.print_debug(1, "%s: User: %s (%s)", SCRIPT_NAME,user,job_time)
table.insert( results, ("User: %s (%s)"):format(user,job_time))
end
end
@@ -83,21 +83,21 @@ end
get_tasktrackers = function( host, port )
local results = {}
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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
local response = http.get( host, port, uri )
- stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
+ stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response")
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", SCRIPT_NAME,response['body'])
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", SCRIPT_NAME,line)
if line:match("href=\"[%w]+://([%w%.:]+)/\">tracker") then
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", SCRIPT_NAME,tasktracker)
table.insert( results, tasktracker)
if target.ALLOW_NEW_TARGETS then
if tasktracker:match("([%w%.]+)") then
local newtarget = tasktracker:match("([%w%.]+)")
- stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget))
+ stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, newtarget)
local status,err = target.add(newtarget)
end
end
@@ -110,42 +110,42 @@ action = function( host, port )
local result = {}
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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
local response = http.get( host, port, uri )
- stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
+ stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response")
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", SCRIPT_NAME,response['body'])
if response['body']:match("State:%s*([^][<]+)") then
local state = response['body']:match("State:%s*([^][<]+)")
- stdnse.print_debug(1, ("%s: State %s"):format(SCRIPT_NAME,state))
+ stdnse.print_debug(1, "%s: State %s", SCRIPT_NAME,state)
table.insert(result, ("State: %s"):format(state))
end
if response['body']:match("Started:%s*([^][<]+)") then
local started = response['body']:match("Started:%s*([^][<]+)")
- stdnse.print_debug(1, ("%s: Started %s"):format(SCRIPT_NAME,started))
+ stdnse.print_debug(1, "%s: Started %s", SCRIPT_NAME,started)
table.insert(result, ("Started: %s"):format(started))
end
if response['body']:match("Version:%s*([^][<]+)") then
local version = response['body']:match("Version:%s*([^][<]+)")
local versionNo = version:match("([^][,]+)")
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)", SCRIPT_NAME,versionNo,versionHash)
table.insert(result, ("Version: %s (%s)"):format(versionNo,versionHash))
port.version.version = versionNo
end
if response['body']:match("Compiled:%s*([^][<]+)") then
local compiled = response['body']:match("Compiled:%s*([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled))
+ stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME,compiled)
table.insert(result, ("Compiled: %s"):format(compiled))
end
if response['body']:match("Identifier:%s*([^][<]+)") then
local identifier = response['body']:match("Identifier:%s*([^][<]+)")
- stdnse.print_debug(1, ("%s: Identifier %s"):format(SCRIPT_NAME,identifier))
+ stdnse.print_debug(1, "%s: Identifier %s", SCRIPT_NAME,identifier)
table.insert(result, ("Identifier: %s"):format(identifier))
end
if response['body']:match("([%w/]+)\">Log<") then
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", SCRIPT_NAME,logfiles)
table.insert(result, ("Log Files: %s"):format(logfiles))
end
local tasktrackers = get_tasktrackers (host, port)
diff --git a/scripts/hadoop-namenode-info.nse b/scripts/hadoop-namenode-info.nse
index f8950f110..7e804883f 100644
--- a/scripts/hadoop-namenode-info.nse
+++ b/scripts/hadoop-namenode-info.nse
@@ -62,20 +62,20 @@ end
get_datanodes = function( host, port, Status )
local result = {}
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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
local response = http.get( host, port, uri )
- stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response" ))
+ stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response" )
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
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", SCRIPT_NAME,body)
for datanodetmp in string.gmatch(body, "[%w%.:-_]+/browseDirectory.jsp") do
local datanode = datanodetmp:gsub("/browseDirectory.jsp","")
- stdnse.print_debug(1, ("%s: Datanode %s"):format(SCRIPT_NAME,datanode))
+ stdnse.print_debug(1, "%s: Datanode %s", SCRIPT_NAME,datanode)
table.insert(result, ("Datanode: %s"):format(datanode))
if target.ALLOW_NEW_TARGETS then
if datanode:match("([%w%.]+)") then
local newtarget = datanode:match("([%w%.]+)")
- stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget))
+ stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, newtarget)
local status,err = target.add(newtarget)
end
end
@@ -88,51 +88,51 @@ action = function( host, port )
local result = {}
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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
local response = http.get( host, port, uri )
- stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
+ stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response")
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
local body = response['body']:gsub("%%","%%%%")
local capacity = {}
- stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
+ stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body)
if body:match("Started:%s* | ([^][<]+)") then
local start = body:match("Started:%s* | ([^][<]+)")
- stdnse.print_debug(1, ("%s: Started %s"):format(SCRIPT_NAME,start))
+ stdnse.print_debug(1, "%s: Started %s", SCRIPT_NAME,start)
table.insert(result, ("Started: %s"):format(start))
end
if body:match("Version:%s* | ([^][<]+)") then
local version = body:match("Version:%s* | ([^][<]+)")
- stdnse.print_debug(1, ("%s: Version %s"):format(SCRIPT_NAME,version))
+ stdnse.print_debug(1, "%s: Version %s", SCRIPT_NAME,version)
table.insert(result, ("Version: %s"):format(version))
port.version.version = version
end
if body:match("Compiled:%s* | ([^][<]+)") then
local compiled = body:match("Compiled:%s* | ([^][<]+)")
- stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled))
+ stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME,compiled)
table.insert(result, ("Compiled: %s"):format(compiled))
end
if body:match("Upgrades:%s* | ([^][<]+)") then
local upgrades = body:match("Upgrades:%s* | ([^][<]+)")
- stdnse.print_debug(1, ("%s: Upgrades %s"):format(SCRIPT_NAME,upgrades))
+ stdnse.print_debug(1, "%s: Upgrades %s", SCRIPT_NAME,upgrades)
table.insert(result, ("Upgrades: %s"):format(upgrades))
end
if body:match("([^][\"]+)\">Browse") then
local filesystem = body:match("([^][\"]+)\">Browse")
- stdnse.print_debug(1, ("%s: Filesystem %s"):format(SCRIPT_NAME,filesystem))
+ stdnse.print_debug(1, "%s: Filesystem %s", SCRIPT_NAME,filesystem)
table.insert(result, ("Filesystem: %s"):format(filesystem))
end
if body:match("([^][\"]+)\">Namenode") then
local logs = body:match("([^][\"]+)\">Namenode")
- stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs))
+ stdnse.print_debug(1, "%s: Logs %s", SCRIPT_NAME,logs)
table.insert(result, ("Logs: %s"):format(logs))
end
for i in string.gmatch(body, "[%d%.]+%s[KMGTP]B") do
table.insert(capacity,i)
end
if #capacity >= 6 then
- 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: Remaining %s"):format(SCRIPT_NAME,capacity[6]))
+ stdnse.print_debug(1, "%s: Total %s", SCRIPT_NAME,capacity[3])
+ stdnse.print_debug(1, "%s: Used DFS (NonDFS) %s (%s)", SCRIPT_NAME,capacity[4],capacity[5])
+ stdnse.print_debug(1, "%s: Remaining %s", SCRIPT_NAME,capacity[6])
table.insert(result,"Storage:")
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]))
diff --git a/scripts/hadoop-secondary-namenode-info.nse b/scripts/hadoop-secondary-namenode-info.nse
index 592a6436d..64e6a249d 100644
--- a/scripts/hadoop-secondary-namenode-info.nse
+++ b/scripts/hadoop-secondary-namenode-info.nse
@@ -59,39 +59,39 @@ action = function( host, port )
local result = {}
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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
local response = http.get( host, port, uri )
- stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Resposne"))
+ stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Resposne")
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
local body = response['body']:gsub("%%","%%%%")
local stats = {}
- stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
+ stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body)
-- Page isn't valid html :(
for i in string.gmatch(body,"\n[%w%s]+:%s+[^][\n]+") do
table.insert(stats,i:match(":%s+([^][\n]+)"))
end
if #stats == 5 then
- stdnse.print_debug(1, ("%s: namenode %s"):format(SCRIPT_NAME,stats[1]))
- stdnse.print_debug(1, ("%s: Start %s"):format(SCRIPT_NAME,stats[2]))
- stdnse.print_debug(1, ("%s: Last Checkpoint %s"):format(SCRIPT_NAME,stats[3]))
- stdnse.print_debug(1, ("%s: Checkpoint Period %s"):format(SCRIPT_NAME,stats[4]))
- stdnse.print_debug(1, ("%s: Checkpoint Size %s"):format(SCRIPT_NAME,stats[5]))
+ stdnse.print_debug(1, "%s: namenode %s", SCRIPT_NAME,stats[1])
+ stdnse.print_debug(1, "%s: Start %s", SCRIPT_NAME,stats[2])
+ stdnse.print_debug(1, "%s: Last Checkpoint %s", SCRIPT_NAME,stats[3])
+ stdnse.print_debug(1, "%s: Checkpoint Period %s", SCRIPT_NAME,stats[4])
+ stdnse.print_debug(1, "%s: Checkpoint Size %s", SCRIPT_NAME,stats[5])
table.insert(result, ("Start: %s"):format(stats[2]))
end
if body:match("Version:%s* | ([^][\n]+)") then
local version = body:match("Version:%s* | ([^][\n]+)")
- stdnse.print_debug(1, ("%s: Version %s"):format(SCRIPT_NAME,version))
+ stdnse.print_debug(1, "%s: Version %s", SCRIPT_NAME,version)
table.insert(result, ("Version: %s"):format(version))
port.version.version = version
end
if body:match("Compiled:%s* | ([^][\n]+)") then
local compiled = body:match("Compiled:%s* | ([^][\n]+)")
- stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled))
+ stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME,compiled)
table.insert(result, ("Compiled: %s"):format(compiled))
end
if body:match("([^][\"]+)\">Logs") then
local logs = body:match("([^][\"]+)\">Logs")
- stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs))
+ stdnse.print_debug(1, "%s: Logs %s", SCRIPT_NAME,logs)
table.insert(result, ("Logs: %s"):format(logs))
end
if #stats == 5 then
@@ -108,7 +108,7 @@ action = function( host, port )
if target.ALLOW_NEW_TARGETS then
if stats[1]:match("([^][/]+)") then
local newtarget = stats[1]:match("([^][/]+)")
- stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget))
+ stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, newtarget)
local status,err = target.add(newtarget)
end
end
diff --git a/scripts/hadoop-tasktracker-info.nse b/scripts/hadoop-tasktracker-info.nse
index a41e36175..4717416a4 100644
--- a/scripts/hadoop-tasktracker-info.nse
+++ b/scripts/hadoop-tasktracker-info.nse
@@ -48,28 +48,28 @@ action = function( host, port )
local result = {}
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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
local response = http.get( host, port, uri )
- stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
+ stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response")
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
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", SCRIPT_NAME,body)
if response['body']:match("Version:%s*([^][<]+)") then
local version = response['body']:match("Version:%s*([^][<]+)")
local versionNo = version:match("([^][,]+)")
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)", SCRIPT_NAME,versionNo,versionHash)
table.insert(result, ("Version: %s (%s)"):format(versionNo,versionHash))
port.version.version = version
end
if response['body']:match("Compiled:%s*([^][<]+)") then
local compiled = response['body']:match("Compiled:%s*([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled))
+ stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME,compiled)
table.insert(result, ("Compiled: %s"):format(compiled))
end
if body:match("([^][\"]+)\">Log") then
local logs = body:match("([^][\"]+)\">Log")
- stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs))
+ stdnse.print_debug(1, "%s: Logs %s", SCRIPT_NAME,logs)
table.insert(result, ("Logs: %s"):format(logs))
end
if #result > 0 then
diff --git a/scripts/hbase-master-info.nse b/scripts/hbase-master-info.nse
index 3b20936df..68bb54eda 100644
--- a/scripts/hbase-master-info.nse
+++ b/scripts/hbase-master-info.nse
@@ -61,65 +61,65 @@ action = function( host, port )
local result = {}
local region_servers = {}
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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
local response = http.get( host, port, uri )
- stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
+ stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response")
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
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", SCRIPT_NAME,body)
if body:match("HBase%s+Version | ([^][<]+)") then
local version = body:match("HBase%s+Version | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s:Hbase Version %s"):format(SCRIPT_NAME,version))
+ stdnse.print_debug(1, "%s:Hbase Version %s", SCRIPT_NAME,version)
table.insert(result, ("Hbase Version: %s"):format(version))
port.version.version = version
end
if body:match("HBase%s+Compiled | ([^][<]+)") then
local compiled = body:match("HBase%s+Compiled | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: Hbase Compiled %s"):format(SCRIPT_NAME,compiled))
+ stdnse.print_debug(1, "%s: Hbase Compiled %s", SCRIPT_NAME,compiled)
table.insert(result, ("Hbase Compiled: %s"):format(compiled))
end
if body:match("Directory | ([^][<]+)") then
local compiled = body:match("Directory | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: HBase RootDirectory %s"):format(SCRIPT_NAME,compiled))
+ stdnse.print_debug(1, "%s: HBase RootDirectory %s", SCRIPT_NAME,compiled)
table.insert(result, ("HBase Root Directory: %s"):format(compiled))
end
if body:match("Hadoop%s+Version | ([^][<]+)") then
local version = body:match("Hadoop%s+Version | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: Hadoop Version %s"):format(SCRIPT_NAME,version))
+ stdnse.print_debug(1, "%s: Hadoop Version %s", SCRIPT_NAME,version)
table.insert(result, ("Hadoop Version: %s"):format(version))
end
if body:match("Hadoop%s+Compiled | ([^][<]+)") then
local compiled = body:match("Hadoop%s+Compiled | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: Hadoop Compiled %s"):format(SCRIPT_NAME,compiled))
+ stdnse.print_debug(1, "%s: Hadoop Compiled %s", SCRIPT_NAME,compiled)
table.insert(result, ("Hadoop Compiled: %s"):format(compiled))
end
if body:match("average | ([^][<]+)") then
local average = body:match("average | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: Average Load %s"):format(SCRIPT_NAME,average))
+ stdnse.print_debug(1, "%s: Average Load %s", SCRIPT_NAME,average)
table.insert(result, ("Average Load: %s"):format(average))
end
if body:match("Quorum | ([^][<]+)") then
local quorum = body:match("Quorum | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: Zookeeper Quorum %s"):format(SCRIPT_NAME,quorum))
+ stdnse.print_debug(1, "%s: Zookeeper Quorum %s", SCRIPT_NAME,quorum)
table.insert(result, ("Zookeeper Quorum: %s"):format(quorum))
if target.ALLOW_NEW_TARGETS then
if quorum:match("([%w%.]+)") then
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", SCRIPT_NAME, newtarget)
local status,err = target.add(newtarget)
end
end
end
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", SCRIPT_NAME,line)
if line:match("maxHeap") then
local region_server= line:match("\">([^][<]+)")
- stdnse.print_debug(1, ("%s: Region Server %s"):format(SCRIPT_NAME,region_server))
+ stdnse.print_debug(1, "%s: Region Server %s", SCRIPT_NAME,region_server)
table.insert(region_servers, region_server)
if target.ALLOW_NEW_TARGETS then
if region_server:match("([%w%.]+)") then
local newtarget = region_server:match("([%w%.]+)")
- stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget))
+ stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, newtarget)
local status,err = target.add(newtarget)
end
end
diff --git a/scripts/hbase-region-info.nse b/scripts/hbase-region-info.nse
index b01de653a..5982e64a9 100644
--- a/scripts/hbase-region-info.nse
+++ b/scripts/hbase-region-info.nse
@@ -56,36 +56,36 @@ action = function( host, port )
-- uri was previously "/regionserver.jsp". See
-- http://seclists.org/nmap-dev/2012/q3/903.
local uri = "/rs-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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
local response = http.get( host, port, uri )
- stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
+ stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response")
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
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", SCRIPT_NAME,body)
if body:match("HBase%s+Version | ([^][<]+)") then
local version = body:match("HBase%s+Version | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s:Hbase Version %s"):format(SCRIPT_NAME,version))
+ stdnse.print_debug(1, "%s:Hbase Version %s", SCRIPT_NAME,version)
table.insert(result, ("Hbase Version: %s"):format(version))
port.version.version = version
end
if body:match("HBase%s+Compiled | ([^][<]+)") then
local compiled = body:match("HBase%s+Compiled | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: Hbase Compiled %s"):format(SCRIPT_NAME,compiled))
+ stdnse.print_debug(1, "%s: Hbase Compiled %s", SCRIPT_NAME,compiled)
table.insert(result, ("Hbase Compiled: %s"):format(compiled))
end
if body:match("Metrics | ([^][<]+)") then
local metrics = body:match("Metrics | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: Metrics %s"):format(SCRIPT_NAME,metrics))
+ stdnse.print_debug(1, "%s: Metrics %s", SCRIPT_NAME,metrics)
table.insert(result, ("Metrics %s"):format(metrics))
end
if body:match("Quorum | ([^][<]+)") then
local quorum = body:match("Quorum | ([^][<]+)"):gsub("%s+", " ")
- stdnse.print_debug(1, ("%s: Zookeeper Quorum %s"):format(SCRIPT_NAME,quorum))
+ stdnse.print_debug(1, "%s: Zookeeper Quorum %s", SCRIPT_NAME,quorum)
table.insert(result, ("Zookeeper Quorum: %s"):format(quorum))
if target.ALLOW_NEW_TARGETS then
if quorum:match("([%w%.]+)") then
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", SCRIPT_NAME, newtarget)
local status,err = target.add(newtarget)
end
end
diff --git a/scripts/http-barracuda-dir-traversal.nse b/scripts/http-barracuda-dir-traversal.nse
index 947bd537d..b9bade6c7 100644
--- a/scripts/http-barracuda-dir-traversal.nse
+++ b/scripts/http-barracuda-dir-traversal.nse
@@ -92,7 +92,7 @@ action = function(host, port)
local config_file = ""
-- Loop through vulnerable files
- stdnse.print_debug(1, ("%s: Connecting to %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
+ stdnse.print_debug(1, "%s: Connecting to %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number)
for _, path in ipairs(paths) do
-- Retrieve file
@@ -128,7 +128,7 @@ action = function(host, port)
-- No config file found
if config_file == "" then
- stdnse.print_debug(1, ("%s: %s:%s is not vulnerable or connection timed out."):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
+ stdnse.print_debug(1, "%s: %s:%s is not vulnerable or connection timed out.", SCRIPT_NAME, host.targetname or host.ip, port.number)
return
end
diff --git a/scripts/http-qnap-nas-info.nse b/scripts/http-qnap-nas-info.nse
index 6ddd0ab6a..1105b6743 100644
--- a/scripts/http-qnap-nas-info.nse
+++ b/scripts/http-qnap-nas-info.nse
@@ -52,7 +52,7 @@ action = function(host, port)
local config_file = ""
-- Retrieve file
- stdnse.print_debug(1, ("%s: Connecting to %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
+ stdnse.print_debug(1, "%s: Connecting to %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number)
local data = http.get(host, port, path)
-- Check if file exists
@@ -63,7 +63,7 @@ action = function(host, port)
if string.match(data.body, '') then
config_file = data.body
else
- stdnse.print_debug(1, ("%s: %s:%s uses an invalid config file."):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
+ stdnse.print_debug(1, "%s: %s:%s uses an invalid config file.", SCRIPT_NAME, host.targetname or host.ip, port.number)
return
end
diff --git a/scripts/ldap-search.nse b/scripts/ldap-search.nse
index 5ab5b3bd1..64cc9b0af 100644
--- a/scripts/ldap-search.nse
+++ b/scripts/ldap-search.nse
@@ -174,7 +174,7 @@ function action(host,port)
local status, errmsg = ldap.bindRequest( socket, bindParam )
if not status then
- stdnse.print_debug( string.format("ldap-search failed to bind: %s", errmsg) )
+ stdnse.print_debug("ldap-search failed to bind: %s", errmsg)
return " \n ERROR: Authentication failed"
end
-- or if ldap-brute found us something
@@ -240,7 +240,7 @@ function action(host,port)
if ( searchResEntries:match("DSID[-]0C090627") and not(username) ) then
return "ERROR: Failed to bind as the anonymous user"
else
- stdnse.print_debug( string.format( "ldap.searchRequest returned: %s", searchResEntries ) )
+ stdnse.print_debug("ldap.searchRequest returned: %s", searchResEntries)
return
end
end
diff --git a/scripts/modbus-discover.nse b/scripts/modbus-discover.nse
index f09424e1c..99a6f8bfb 100644
--- a/scripts/modbus-discover.nse
+++ b/scripts/modbus-discover.nse
@@ -63,7 +63,7 @@ discover_device_id_recursive = function(host, port, sid, start_id)
local more_follows = string.byte(result, 12)
local next_object_id = string.byte(result, 13)
local number_of_objects = string.byte(result, 14)
- stdnse.print_debug(1, ("more = 0x%x, next_id = 0x%x, obj_number = 0x%x"):format(more_follows, next_object_id, number_of_objects))
+ stdnse.print_debug(1, "more = 0x%x, next_id = 0x%x, obj_number = 0x%x", more_follows, next_object_id, number_of_objects)
local offset = 15
for i = start_id, (number_of_objects - 1) do
local object_id = string.byte(result, offset)
@@ -71,7 +71,7 @@ discover_device_id_recursive = function(host, port, sid, start_id)
-- error data format --
if object_len == nil then break end
local object_value = string.sub(result, offset + 2, offset + 1 + object_len)
- stdnse.print_debug(1, ("Object id = 0x%x, value = %s"):format(object_id, object_value))
+ stdnse.print_debug(1, "Object id = 0x%x, value = %s", object_id, object_value)
table.insert(objects_table, object_id + 1, object_value)
offset = offset + 2 + object_len
end
diff --git a/scripts/pgsql-brute.nse b/scripts/pgsql-brute.nse
index 8cfb14b39..93b820754 100644
--- a/scripts/pgsql-brute.nse
+++ b/scripts/pgsql-brute.nse
@@ -105,7 +105,7 @@ action = function( host, port )
for username in usernames do
ssl_enable = not(nossl)
for password in passwords do
- stdnse.print_debug( string.format("Trying %s/%s ...", username, password ) )
+ stdnse.print_debug("Trying %s/%s ...", username, password )
local socket = connectSocket( host, port, ssl_enable )
status, response = pg.sendStartup(socket, username, username)
diff --git a/scripts/qconn-exec.nse b/scripts/qconn-exec.nse
index bda75dfb0..3759ce16d 100644
--- a/scripts/qconn-exec.nse
+++ b/scripts/qconn-exec.nse
@@ -87,17 +87,17 @@ system commands as the 'root' user.
-- Send command as service launcher request
local req = string.format("service launcher\nstart/flags run /bin/sh /bin/sh -c \"%s\"\n", cmd)
- stdnse.print_debug(1, ("%s: Connecting to %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
+ stdnse.print_debug(1, "%s: Connecting to %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number)
local status, data = comm.exchange(host, port, req, {timeout=timeout*1000,bytes=bytes})
if not status then
- stdnse.print_debug(1, ("%s: Timeout exceeded for %s:%s (Timeout: %ss)."):format(SCRIPT_NAME, host.targetname or host.ip, port.number, timeout))
+ stdnse.print_debug(1, "%s: Timeout exceeded for %s:%s (Timeout: %ss).", SCRIPT_NAME, host.targetname or host.ip, port.number, timeout)
return
end
-- Parse response
- stdnse.print_debug(2, ("%s: Received reply:\n%s"):format(SCRIPT_NAME, data))
+ stdnse.print_debug(2, "%s: Received reply:\n%s", SCRIPT_NAME, data)
if not string.match(data, "QCONN") then
- stdnse.print_debug(1, ("%s: %s:%s is not a QNX QCONN daemon."):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
+ stdnse.print_debug(1, "%s: %s:%s is not a QNX QCONN daemon.", SCRIPT_NAME, host.targetname or host.ip, port.number)
return
end
@@ -107,7 +107,7 @@ system commands as the 'root' user.
local report = vulns.Report:new(SCRIPT_NAME, host, port)
return report:make_output(vuln_table)
else
- stdnse.print_debug(1, ("%s: %s:%s QNX QCONN daemon is not vulnerable."):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
+ stdnse.print_debug(1, "%s: %s:%s QNX QCONN daemon is not vulnerable.", SCRIPT_NAME, host.targetname or host.ip, port.number)
return
end
diff --git a/scripts/tftp-enum.nse b/scripts/tftp-enum.nse
index c92359e52..4d5c9c984 100644
--- a/scripts/tftp-enum.nse
+++ b/scripts/tftp-enum.nse
@@ -98,7 +98,7 @@ local create_tftp_file_request = function(filename)
end
local check_file_present = function(host, port, filename)
- stdnse.print_debug(1, ("checking file %s"):format(filename))
+ stdnse.print_debug(1, "checking file %s", filename)
local file_request = create_tftp_file_request(filename)
@@ -109,14 +109,14 @@ local check_file_present = function(host, port, filename)
if (not (status)) then
- stdnse.print_debug(1, ("error %s"):format(lhost))
+ stdnse.print_debug(1, "error %s", lhost)
socket:close()
return REQUEST_ERROR
end
local bind_socket = nmap.new_socket("udp")
- stdnse.print_debug(1, ("local port = %d"):format(lport))
+ stdnse.print_debug(1, "local port = %d", lport)
socket:send(file_request)
socket:close()
@@ -127,7 +127,7 @@ local check_file_present = function(host, port, filename)
stdnse.print_debug(1, "starting listener")
if (not (bindOK)) then
- stdnse.print_debug(1, ("Error in bind %s"):format(error))
+ stdnse.print_debug(1, "Error in bind %s", error)
bind_socket:close()
return REQUEST_ERROR
end
@@ -136,7 +136,7 @@ local check_file_present = function(host, port, filename)
local recvOK, data = bind_socket:receive()
if (not (recvOK)) then
- stdnse.print_debug(1, ("Error in receive %s"):format(data))
+ stdnse.print_debug(1, "Error in receive %s", data)
bind_socket:close()
return REQUEST_ERROR
end
|