diff --git a/scripts/acarsd-info.nse b/scripts/acarsd-info.nse
index a69034bd4..0beecd7e0 100644
--- a/scripts/acarsd-info.nse
+++ b/scripts/acarsd-info.nse
@@ -60,16 +60,16 @@ action = function(host, port)
if not bytes then bytes = 512 else tonumber(bytes) end
-- Connect and retrieve acarsd info in XML format over TCP
- stdnse.print_debug(1, "%s: Connecting to %s:%s [Timeout: %ss]", SCRIPT_NAME, host.targetname or host.ip, port.number, timeout)
+ stdnse.debug1("Connecting to %s:%s [Timeout: %ss]", host.targetname or host.ip, port.number, timeout)
local status, data = comm.get_banner(host, port, {timeout=timeout*1000,bytes=bytes})
if not status or not data then
- stdnse.print_debug(1, "%s: Retrieving data from %s:%s failed [Timeout expired]", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("Retrieving data from %s:%s failed [Timeout expired]", host.targetname or host.ip, port.number)
return
end
-- Check if retrieved data is valid acarsd data
if not string.match(data, "acarsd") then
- stdnse.print_debug(1, "%s: %s:%s is not an acarsd Daemon.", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("%s:%s is not an acarsd Daemon.", host.targetname or host.ip, port.number)
return
end
@@ -85,7 +85,7 @@ action = function(host, port)
-- Check for unrestricted access -- Parse daemon info
else
- stdnse.print_debug(1, "%s: Parsing data from %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("Parsing data from %s:%s", host.targetname or host.ip, port.number)
local vars = {
{"Version","Version"},
{"API Version","APIVersion"},
diff --git a/scripts/dns-brute.nse b/scripts/dns-brute.nse
index 4d398302f..f931df08c 100644
--- a/scripts/dns-brute.nse
+++ b/scripts/dns-brute.nse
@@ -203,7 +203,7 @@ action = function(host)
end
end
else
- stdnse.print_debug(1, "%s: Cannot find hostlist file, quitting", SCRIPT_NAME)
+ stdnse.debug1("Cannot find hostlist file, quitting")
return
end
@@ -268,7 +268,7 @@ action = function(host)
end
end
else
- stdnse.print_debug(1, "%s: Cannot find srvlist file, skipping", SCRIPT_NAME)
+ stdnse.debug1("Cannot find srvlist file, skipping")
end
end
diff --git a/scripts/flume-master-info.nse b/scripts/flume-master-info.nse
index 8e1714876..7f7833ada 100644
--- a/scripts/flume-master-info.nse
+++ b/scripts/flume-master-info.nse
@@ -95,7 +95,7 @@ end
function add_target(hostname)
if target.ALLOW_NEW_TARGETS then
- stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, hostname)
+ stdnse.debug1("Added target: %s", hostname)
local status,err = target.add(hostname)
end
end
@@ -185,18 +185,18 @@ action = function( host, port )
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", SCRIPT_NAME, version)
+ stdnse.debug1("Version %s", 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", SCRIPT_NAME, compiled)
+ stdnse.debug1("Compiled %s", 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", SCRIPT_NAME, upgrades)
+ stdnse.debug1("ServerID %s", upgrades)
result[#result] = ("ServerID: %s"):format(upgrades)
end
for logical,physical,hostname in string.gmatch(body,
diff --git a/scripts/ftp-vsftpd-backdoor.nse b/scripts/ftp-vsftpd-backdoor.nse
index b8b457679..6d583ea8a 100644
--- a/scripts/ftp-vsftpd-backdoor.nse
+++ b/scripts/ftp-vsftpd-backdoor.nse
@@ -193,7 +193,7 @@ vsFTPd version 2.3.4 backdoor, this was reported on 2011-07-04.]],
-- check if vsFTPd was backdoored
status, ret = check_backdoor(host, cmd, vsftp_vuln)
if not status then
- stdnse.print_debug(1, "%s: %s", SCRIPT_NAME, ret)
+ stdnse.debug1("%s", ret)
return nil
end
diff --git a/scripts/ftp-vuln-cve2010-4221.nse b/scripts/ftp-vuln-cve2010-4221.nse
index 897d2fc4a..97fde5237 100644
--- a/scripts/ftp-vuln-cve2010-4221.nse
+++ b/scripts/ftp-vuln-cve2010-4221.nse
@@ -196,7 +196,7 @@ execute arbitrary code.]],
local status, err = check_proftpd(ftp_opts)
if not status then
- stdnse.print_debug(1, "%s: %s", SCRIPT_NAME, err)
+ stdnse.debug1("%s", err)
return nil
end
return report:make_output(ftp_opts.vuln)
diff --git a/scripts/ganglia-info.nse b/scripts/ganglia-info.nse
index bc8d67d0b..a29423f08 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", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("Connecting to %s:%s", 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).", SCRIPT_NAME, host.targetname or host.ip, port.number, timeout)
+ stdnse.debug1("Timeout exceeded for %s:%s (Timeout: %ss).", host.targetname or host.ip, port.number, timeout)
return
end
-- Parse daemon info
if not string.match(data, "Log")
- stdnse.print_debug(1, "%s: Logs %s", SCRIPT_NAME,logs)
+ stdnse.debug1("Logs %s",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 c6570c160..93177216a 100644
--- a/scripts/hadoop-jobtracker-info.nse
+++ b/scripts/hadoop-jobtracker-info.nse
@@ -64,7 +64,7 @@ get_userhistory = function( host, port )
local uri = "/jobhistory.jsp?pageno=-1&search="
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", SCRIPT_NAME,response['status-line'] or "No Response")
+ stdnse.debug1("Status %s",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", SCRIPT_NAME,body)
@@ -73,7 +73,7 @@ get_userhistory = function( host, port )
if line:match("job_[%d_]+") then
local user = line:match("
([^][<>]+) | ")
local job_time = line:match("([^][<]+)")
- stdnse.print_debug(1, "%s: User: %s (%s)", SCRIPT_NAME,user,job_time)
+ stdnse.debug1("User: %s (%s)",user,job_time)
table.insert( results, ("User: %s (%s)"):format(user,job_time))
end
end
@@ -85,19 +85,19 @@ get_tasktrackers = function( host, port )
local uri = "/machines.jsp?type=active"
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", SCRIPT_NAME,response['status-line'] or "No Response")
+ stdnse.debug1("Status %s",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", SCRIPT_NAME,response['body'])
for line in string.gmatch(response['body'], "[^\n]+") do
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", SCRIPT_NAME,tasktracker)
+ stdnse.debug1("taskstracker %s",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", SCRIPT_NAME, newtarget)
+ stdnse.debug1("Added target: %s", newtarget)
local status,err = target.add(newtarget)
end
end
@@ -112,40 +112,40 @@ action = function( host, port )
local uri = "/jobtracker.jsp"
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", SCRIPT_NAME,response['status-line'] or "No Response")
+ stdnse.debug1("Status %s",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", 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", SCRIPT_NAME,state)
+ stdnse.debug1("State %s",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", SCRIPT_NAME,started)
+ stdnse.debug1("Started %s",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)", SCRIPT_NAME,versionNo,versionHash)
+ stdnse.debug1("Version %s (%s)",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", SCRIPT_NAME,compiled)
+ stdnse.debug1("Compiled %s",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", SCRIPT_NAME,identifier)
+ stdnse.debug1("Identifier %s",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", SCRIPT_NAME,logfiles)
+ stdnse.debug1("Log Files %s",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 7e804883f..1f182cc0b 100644
--- a/scripts/hadoop-namenode-info.nse
+++ b/scripts/hadoop-namenode-info.nse
@@ -64,18 +64,18 @@ get_datanodes = function( host, port, Status )
local uri = "/dfsnodelist.jsp?whatNodes=" .. Status
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", SCRIPT_NAME,response['status-line'] or "No Response" )
+ stdnse.debug1("Status %s",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", 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", SCRIPT_NAME,datanode)
+ stdnse.debug1("Datanode %s",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", SCRIPT_NAME, newtarget)
+ stdnse.debug1("Added target: %s", newtarget)
local status,err = target.add(newtarget)
end
end
@@ -90,49 +90,49 @@ action = function( host, port )
local uri = "/dfshealth.jsp"
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", SCRIPT_NAME,response['status-line'] or "No Response")
+ stdnse.debug1("Status %s",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", SCRIPT_NAME,body)
if body:match("Started:%s* | ([^][<]+)") then
local start = body:match("Started:%s* | ([^][<]+)")
- stdnse.print_debug(1, "%s: Started %s", SCRIPT_NAME,start)
+ stdnse.debug1("Started %s",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", SCRIPT_NAME,version)
+ stdnse.debug1("Version %s",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", SCRIPT_NAME,compiled)
+ stdnse.debug1("Compiled %s",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", SCRIPT_NAME,upgrades)
+ stdnse.debug1("Upgrades %s",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", SCRIPT_NAME,filesystem)
+ stdnse.debug1("Filesystem %s",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", SCRIPT_NAME,logs)
+ stdnse.debug1("Logs %s",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", 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])
+ stdnse.debug1("Total %s",capacity[3])
+ stdnse.debug1("Used DFS (NonDFS) %s (%s)",capacity[4],capacity[5])
+ stdnse.debug1("Remaining %s",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 64e6a249d..b53a7182c 100644
--- a/scripts/hadoop-secondary-namenode-info.nse
+++ b/scripts/hadoop-secondary-namenode-info.nse
@@ -61,7 +61,7 @@ action = function( host, port )
local uri = "/status.jsp"
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", SCRIPT_NAME,response['status-line'] or "No Resposne")
+ stdnse.debug1("Status %s",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 = {}
@@ -71,27 +71,27 @@ action = function( host, port )
table.insert(stats,i:match(":%s+([^][\n]+)"))
end
if #stats == 5 then
- 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])
+ stdnse.debug1("namenode %s",stats[1])
+ stdnse.debug1("Start %s",stats[2])
+ stdnse.debug1("Last Checkpoint %s",stats[3])
+ stdnse.debug1("Checkpoint Period %s",stats[4])
+ stdnse.debug1("Checkpoint Size %s",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", SCRIPT_NAME,version)
+ stdnse.debug1("Version %s",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", SCRIPT_NAME,compiled)
+ stdnse.debug1("Compiled %s",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", SCRIPT_NAME,logs)
+ stdnse.debug1("Logs %s",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", SCRIPT_NAME, newtarget)
+ stdnse.debug1("Added target: %s", newtarget)
local status,err = target.add(newtarget)
end
end
diff --git a/scripts/hadoop-tasktracker-info.nse b/scripts/hadoop-tasktracker-info.nse
index 4717416a4..404a8b81c 100644
--- a/scripts/hadoop-tasktracker-info.nse
+++ b/scripts/hadoop-tasktracker-info.nse
@@ -50,7 +50,7 @@ action = function( host, port )
local uri = "/tasktracker.jsp"
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", SCRIPT_NAME,response['status-line'] or "No Response")
+ stdnse.debug1("Status %s",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", SCRIPT_NAME,body)
@@ -58,18 +58,18 @@ action = function( host, port )
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)", SCRIPT_NAME,versionNo,versionHash)
+ stdnse.debug1("Version %s (%s)",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", SCRIPT_NAME,compiled)
+ stdnse.debug1("Compiled %s",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", SCRIPT_NAME,logs)
+ stdnse.debug1("Logs %s",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 3f8e69c51..e793143c5 100644
--- a/scripts/hbase-master-info.nse
+++ b/scripts/hbase-master-info.nse
@@ -63,7 +63,7 @@ action = function( host, port )
local uri = "/master.jsp"
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", SCRIPT_NAME,response['status-line'] or "No Response")
+ stdnse.debug1("Status %s",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", SCRIPT_NAME,body)
@@ -75,37 +75,37 @@ action = function( host, port )
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", SCRIPT_NAME,compiled)
+ stdnse.debug1("Hbase Compiled %s",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", SCRIPT_NAME,compiled)
+ stdnse.debug1("HBase RootDirectory %s",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", SCRIPT_NAME,version)
+ stdnse.debug1("Hadoop Version %s",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", SCRIPT_NAME,compiled)
+ stdnse.debug1("Hadoop Compiled %s",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", SCRIPT_NAME,average)
+ stdnse.debug1("Average Load %s",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", SCRIPT_NAME,quorum)
+ stdnse.debug1("Zookeeper Quorum %s",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", SCRIPT_NAME, newtarget)
+ stdnse.debug1("Added target: %s", newtarget)
local status,err = target.add(newtarget)
end
end
@@ -114,12 +114,12 @@ action = function( host, port )
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", SCRIPT_NAME,region_server)
+ stdnse.debug1("Region Server %s",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", SCRIPT_NAME, newtarget)
+ stdnse.debug1("Added target: %s", newtarget)
local status,err = target.add(newtarget)
end
end
diff --git a/scripts/hbase-region-info.nse b/scripts/hbase-region-info.nse
index 5982e64a9..43afa9aac 100644
--- a/scripts/hbase-region-info.nse
+++ b/scripts/hbase-region-info.nse
@@ -58,7 +58,7 @@ action = function( host, port )
local uri = "/rs-status"
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", SCRIPT_NAME,response['status-line'] or "No Response")
+ stdnse.debug1("Status %s",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", SCRIPT_NAME,body)
@@ -70,22 +70,22 @@ action = function( host, port )
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", SCRIPT_NAME,compiled)
+ stdnse.debug1("Hbase Compiled %s",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", SCRIPT_NAME,metrics)
+ stdnse.debug1("Metrics %s",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", SCRIPT_NAME,quorum)
+ stdnse.debug1("Zookeeper Quorum %s",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", SCRIPT_NAME, newtarget)
+ stdnse.debug1("Added target: %s", newtarget)
local status,err = target.add(newtarget)
end
end
diff --git a/scripts/http-adobe-coldfusion-apsa1301.nse b/scripts/http-adobe-coldfusion-apsa1301.nse
index 7278547d7..ee6d448e3 100644
--- a/scripts/http-adobe-coldfusion-apsa1301.nse
+++ b/scripts/http-adobe-coldfusion-apsa1301.nse
@@ -37,7 +37,7 @@ local function get_admin_cookie(host, port, basepath)
stdnse.print_debug(1, "%s:Header 'set-cookie' detected in response.", SCRIPT_NAME)
local _, _, admin_cookie = string.find(req.header['set-cookie'], ";path=/, CFAUTHORIZATION_cfadmin=(.*);path=/")
if admin_cookie:len() > 79 then
- stdnse.print_debug(1, "%s: Extracted cookie:%s", SCRIPT_NAME, admin_cookie)
+ stdnse.debug1("Extracted cookie:%s", admin_cookie)
return admin_cookie
end
end
diff --git a/scripts/http-axis2-dir-traversal.nse b/scripts/http-axis2-dir-traversal.nse
index 8e961c37c..c82654b4f 100644
--- a/scripts/http-axis2-dir-traversal.nse
+++ b/scripts/http-axis2-dir-traversal.nse
@@ -120,7 +120,7 @@ action = function(host, port)
--check this is an axis2 installation
if not(check_installation(host, port, basepath.."listServices")) then
- stdnse.print_debug(1, "%s: This does not look like an Apache Axis2 installation.", SCRIPT_NAME)
+ stdnse.debug1("This does not look like an Apache Axis2 installation.")
return
end
@@ -132,18 +132,18 @@ action = function(host, port)
--generate debug info for services and select first one to be used in the request
if #services > 0 then
for _, servname in pairs(services) do
- stdnse.print_debug(1, "%s: Service found: %s", SCRIPT_NAME, servname)
+ stdnse.debug1("Service found: %s", servname)
end
selected_service = services[1]
else
if nmap.verbosity() >= 2 then
- stdnse.print_debug(1, "%s: There are no services available. We can't exploit this", SCRIPT_NAME)
+ stdnse.debug1("There are no services available. We can't exploit this")
end
return
end
--Use selected service and exploit
- stdnse.print_debug(1, "%s: Querying service: %s", SCRIPT_NAME, selected_service)
+ stdnse.debug1("Querying service: %s", selected_service)
req = http.get(host, port, basepath..selected_service.."?xsd="..rfile)
stdnse.print_debug(2, "%s: Query -> %s", SCRIPT_NAME, basepath..selected_service.."?xsd="..rfile)
@@ -168,7 +168,7 @@ action = function(host, port)
if extract_st then
output[#output+1] = extract_msg
else
- stdnse.print_debug(1, "%s: Credentials not found in configuration file", SCRIPT_NAME)
+ stdnse.debug1("Credentials not found in configuration file")
end
end
@@ -182,7 +182,7 @@ action = function(host, port)
end
end
else
- stdnse.print_debug(1, "%s: Request did not return status 200. File might not be found or unreadable", SCRIPT_NAME)
+ stdnse.debug1("Request did not return status 200. File might not be found or unreadable")
return
end
diff --git a/scripts/http-barracuda-dir-traversal.nse b/scripts/http-barracuda-dir-traversal.nse
index b9bade6c7..48fb11103 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", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("Connecting to %s:%s", host.targetname or host.ip, port.number)
for _, path in ipairs(paths) do
-- Retrieve file
@@ -100,11 +100,11 @@ action = function(host, port)
if data and data.status then
-- Check if file exists
- stdnse.print_debug(1, "%s: HTTP %s: %s", SCRIPT_NAME, data.status, tostring(path))
+ stdnse.debug1("HTTP %s: %s", data.status, tostring(path))
if tostring(data.status):match("200") then
-- Attempt config file retrieval with LFI exploit
- stdnse.print_debug(1, "%s: Exploiting: %s", SCRIPT_NAME, tostring(path .. payload))
+ stdnse.debug1("Exploiting: %s", tostring(path .. payload))
data = http.get(host, port, tostring(path .. payload))
if data and data.status and tostring(data.status):match("200") and data.body and data.body ~= "" then
@@ -115,25 +115,25 @@ action = function(host, port)
end
else
- stdnse.print_debug(1, "%s: Failed to retrieve file: %s", SCRIPT_NAME, tostring(path .. payload))
+ stdnse.debug1("Failed to retrieve file: %s", tostring(path .. payload))
end
end
else
- stdnse.print_debug(1, "%s: Failed to retrieve file: %s", SCRIPT_NAME, tostring(path))
+ stdnse.debug1("Failed to retrieve file: %s", tostring(path))
end
end
-- No config file found
if config_file == "" then
- stdnse.print_debug(1, "%s: %s:%s is not vulnerable or connection timed out.", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("%s:%s is not vulnerable or connection timed out.", host.targetname or host.ip, port.number)
return
end
-- Extract system info from config file in MySQL dump format
- stdnse.print_debug(1, "%s: Exploit success! Extracting system info from MySQL database dump", SCRIPT_NAME)
+ stdnse.debug1("Exploit success! Extracting system info from MySQL database dump")
-- Count users
if string.match(config_file, "'user_default_email_address',") then
diff --git a/scripts/http-cakephp-version.nse b/scripts/http-cakephp-version.nse
index 1963c0aa2..4f5f27497 100644
--- a/scripts/http-cakephp-version.nse
+++ b/scripts/http-cakephp-version.nse
@@ -62,7 +62,7 @@ action = function(host, port)
-- Identify servers that answer 200 to invalid HTTP requests and exit as these would invalidate the tests
local _, http_status, _ = http.identify_404(host,port)
if ( http_status == 200 ) then
- stdnse.print_debug(1, "%s: Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", SCRIPT_NAME, host.ip, port.number)
+ stdnse.debug1("Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", host.ip, port.number)
return false
end
diff --git a/scripts/http-coldfusion-subzero.nse b/scripts/http-coldfusion-subzero.nse
index c61c9006e..2c6237e63 100644
--- a/scripts/http-coldfusion-subzero.nse
+++ b/scripts/http-coldfusion-subzero.nse
@@ -75,7 +75,7 @@ local function get_installation_path(host, port, basepath)
local _, _, path = string.find(req.header['set-cookie'],
"path=/, ANALYZER_DIRECTORY=(.-);path=/")
if path then
- stdnse.print_debug(1, "%s: Extracted path:%s", SCRIPT_NAME, path)
+ stdnse.debug1("Extracted path:%s", path)
return path
end
end
diff --git a/scripts/http-devframework.nse b/scripts/http-devframework.nse
index 4f3544d7d..5f3c41b70 100644
--- a/scripts/http-devframework.nse
+++ b/scripts/http-devframework.nse
@@ -59,12 +59,12 @@ local function loadFingerprints(filename, cat)
filename = nmap.fetchfile('nselib/data/' .. filename) or filename
-- Load the file
- stdnse.print_debug(1, "%s: Loading fingerprints: %s", SCRIPT_NAME, filename)
+ stdnse.debug1("Loading fingerprints: %s", filename)
local env = setmetatable({fingerprints = {}}, {__index = _G});
file = loadfile(filename, "t", env)
if( not(file) ) then
- stdnse.print_debug(1, "%s: Couldn't load the file: %s", SCRIPT_NAME, filename)
+ stdnse.debug1("Couldn't load the file: %s", filename)
return
end
diff --git a/scripts/http-drupal-enum-users.nse b/scripts/http-drupal-enum-users.nse
index 61a117c8e..58b39c5c2 100644
--- a/scripts/http-drupal-enum-users.nse
+++ b/scripts/http-drupal-enum-users.nse
@@ -60,7 +60,7 @@ action = function(host, port)
-- send requests
local pipeline_responses = http.pipeline_go(host, port, allrequests)
if not pipeline_responses then
- stdnse.print_debug(1, "%s: No answers from pipelined requests", SCRIPT_NAME)
+ stdnse.debug1("No answers from pipelined requests")
return nil
end
diff --git a/scripts/http-google-malware.nse b/scripts/http-google-malware.nse
index 23f24d0df..d0c2bcc39 100644
--- a/scripts/http-google-malware.nse
+++ b/scripts/http-google-malware.nse
@@ -72,7 +72,7 @@ action = function(host, port)
SCRIPT_NAME, SCRIPT_NAME)
end
- stdnse.print_debug(1, "%s: Checking host %s", SCRIPT_NAME, target_url)
+ stdnse.debug1("Checking host %s", target_url)
local qry = build_qry(apikey, target_url)
local req = http.get_url(qry)
stdnse.print_debug(2, "%s", qry)
diff --git a/scripts/http-huawei-hg5xx-vuln.nse b/scripts/http-huawei-hg5xx-vuln.nse
index 196753dac..bd7c9d0a7 100644
--- a/scripts/http-huawei-hg5xx-vuln.nse
+++ b/scripts/http-huawei-hg5xx-vuln.nse
@@ -83,7 +83,7 @@ including PPPoE credentials, firmware version, model, gateway, dns servers and a
-- Identify servers that answer 200 to invalid HTTP requests and exit as these would invalidate the tests
local _, http_status, _ = http.identify_404(host,port)
if ( http_status == 200 ) then
- stdnse.print_debug(1, "%s: Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", SCRIPT_NAME, host.ip, port.number)
+ stdnse.debug1("Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", host.ip, port.number)
return false
end
diff --git a/scripts/http-litespeed-sourcecode-download.nse b/scripts/http-litespeed-sourcecode-download.nse
index 63f7ab049..acc6f3516 100644
--- a/scripts/http-litespeed-sourcecode-download.nse
+++ b/scripts/http-litespeed-sourcecode-download.nse
@@ -44,7 +44,7 @@ action = function(host, port)
local output = {}
local rfile = stdnse.get_script_args("http-litespeed-sourcecode-download.uri") or "/index.php"
- stdnse.print_debug(1, "%s: Trying to download the source code of %s", SCRIPT_NAME, rfile)
+ stdnse.debug1("Trying to download the source code of %s", rfile)
--we append a null byte followed by ".txt" to retrieve the source code
local req = http.get(host, port, rfile.."\00.txt")
diff --git a/scripts/http-malware-host.nse b/scripts/http-malware-host.nse
index 5018ef22c..42655066f 100644
--- a/scripts/http-malware-host.nse
+++ b/scripts/http-malware-host.nse
@@ -51,7 +51,7 @@ action = function(host, port)
-- Identify servers that answer 200 to invalid HTTP requests and exit as these would invalidate the test
if ( result_404 == 200 ) then
- stdnse.print_debug(1, "%s: Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", SCRIPT_NAME, host.ip, port.number)
+ stdnse.debug1("Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", host.ip, port.number)
return false
end
diff --git a/scripts/http-passwd.nse b/scripts/http-passwd.nse
index 51cf867cd..c5a481e11 100644
--- a/scripts/http-passwd.nse
+++ b/scripts/http-passwd.nse
@@ -179,7 +179,7 @@ action = function(host, port)
local page_var = response.body:match ("[%?%&](%a-)=%a-%.%a")
if page_var then
local query_base = root .. "?" .. page_var .. "="
- stdnse.print_debug(1, "%s: testing with query %s.", SCRIPT_NAME, query_base .. "...")
+ stdnse.debug1("testing with query %s.", query_base .. "...")
for _, dir in ipairs(dirs) do
-- Add an encoded null byte at the end to bypass some checks; see
diff --git a/scripts/http-phpmyadmin-dir-traversal.nse b/scripts/http-phpmyadmin-dir-traversal.nse
index 17b48b210..b53996b9c 100644
--- a/scripts/http-phpmyadmin-dir-traversal.nse
+++ b/scripts/http-phpmyadmin-dir-traversal.nse
@@ -99,8 +99,8 @@ action = function(host, port)
local rfile = stdnse.get_script_args("http-phpmyadmin-dir-traversal.file") or DEFAULT_FILE
local evil_postdata = EXPLOIT_QUERY:format(rfile)
local filewrite = stdnse.get_script_args(SCRIPT_NAME..".outfile")
- stdnse.print_debug(1, "%s: HTTP POST %s%s", SCRIPT_NAME, stdnse.get_hostname(host), evil_uri)
- stdnse.print_debug(1, "%s: POST DATA %s", SCRIPT_NAME, evil_postdata)
+ stdnse.debug1("HTTP POST %s%s", stdnse.get_hostname(host), evil_uri)
+ stdnse.debug1("POST DATA %s", evil_postdata)
local vuln = {
title = 'phpMyAdmin grab_globals.lib.php subform Parameter Traversal Local File Inclusion',
@@ -121,7 +121,7 @@ action = function(host, port)
local response = http.post(host, port, evil_uri,
{header = {["Content-Type"] = "application/x-www-form-urlencoded"}}, nil, evil_postdata)
if response.body and response.status==200 then
- stdnse.print_debug(1, "%s: response : %s", SCRIPT_NAME, response.body)
+ stdnse.debug1("response : %s", response.body)
vuln.state = vulns.STATE.EXPLOIT
vuln.extra_info = rfile.." :\n"..response.body
if filewrite then
@@ -135,7 +135,7 @@ action = function(host, port)
elseif response.status==500 then
vuln.state = vulns.STATE.LIKELY_VULN
stdnse.print_debug(1, "%s:[Error] File not found:%s", SCRIPT_NAME, rfile)
- stdnse.print_debug(1, "%s: response : %s", SCRIPT_NAME, response.body)
+ stdnse.debug1("response : %s", response.body)
vuln.extra_info = string.format("%s not found.\n", rfile)
end
return vuln_report:make_output(vuln)
diff --git a/scripts/http-qnap-nas-info.nse b/scripts/http-qnap-nas-info.nse
index 1105b6743..aba345d3e 100644
--- a/scripts/http-qnap-nas-info.nse
+++ b/scripts/http-qnap-nas-info.nse
@@ -52,28 +52,28 @@ action = function(host, port)
local config_file = ""
-- Retrieve file
- stdnse.print_debug(1, "%s: Connecting to %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("Connecting to %s:%s", host.targetname or host.ip, port.number)
local data = http.get(host, port, path)
-- Check if file exists
if data and data.status and data.status == 200 and data.body and data.body ~= "" then
-- Check if the config file is valid
- stdnse.print_debug(1, "%s: HTTP %s: %s", SCRIPT_NAME, data.status, path)
+ stdnse.debug1("HTTP %s: %s", data.status, path)
if string.match(data.body, '') then
config_file = data.body
else
- stdnse.print_debug(1, "%s: %s:%s uses an invalid config file.", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("%s:%s uses an invalid config file.", host.targetname or host.ip, port.number)
return
end
else
- stdnse.print_debug(1, "%s: Failed to retrieve file: %s", SCRIPT_NAME, path)
+ stdnse.debug1("Failed to retrieve file: %s", path)
return
end
-- Extract system info from config file
- stdnse.print_debug(1, "%s: Extracting system info from %s", SCRIPT_NAME, path)
+ stdnse.debug1("Extracting system info from %s", path)
local vars = {
-- System details --
diff --git a/scripts/http-sql-injection.nse b/scripts/http-sql-injection.nse
index 83f831fed..faae33afe 100644
--- a/scripts/http-sql-injection.nse
+++ b/scripts/http-sql-injection.nse
@@ -270,7 +270,7 @@ action = function(host, port)
-- try to inject
local results_queries = {}
if #injectable > 0 then
- stdnse.print_debug(1, "%s: Testing %d suspicious URLs", SCRIPT_NAME, #injectable)
+ stdnse.debug1("Testing %d suspicious URLs", #injectable)
local injectableQs = build_injection_vector(injectable)
local responses = inject(host, port, injectableQs)
results_queries = check_responses(injectableQs, responses)
diff --git a/scripts/http-vuln-cve2010-0738.nse b/scripts/http-vuln-cve2010-0738.nse
index 12c7d86e9..8f491e554 100644
--- a/scripts/http-vuln-cve2010-0738.nse
+++ b/scripts/http-vuln-cve2010-0738.nse
@@ -48,7 +48,7 @@ action = function(host, port)
-- Identify servers that answer 200 to invalid HTTP requests and exit as these would invalidate the tests
local _, http_status, _ = http.identify_404(host,port)
if ( http_status == 200 ) then
- stdnse.print_debug(1, "%s: Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", SCRIPT_NAME, host.ip, port.number)
+ stdnse.debug1("Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", host.ip, port.number)
return false
end
diff --git a/scripts/http-vuln-wnr1000-creds.nse b/scripts/http-vuln-wnr1000-creds.nse
index 128ee8401..fe51a4de3 100644
--- a/scripts/http-vuln-wnr1000-creds.nse
+++ b/scripts/http-vuln-wnr1000-creds.nse
@@ -71,7 +71,7 @@ action = function(host, port)
local id_netgear = string.match(escape(detection_session.body), ('(id=%d+)'))
if id_netgear == nil then
- stdnse.print_debug(1, "%s: Unable to obtain the id", SCRIPT_NAME)
+ stdnse.debug1("Unable to obtain the id")
return
else
-- send the payload to get username and password
@@ -83,7 +83,7 @@ action = function(host, port)
stdnse.print_debug(1, "%s: username : " .. escape(netgear_username), SCRIPT_NAME)
stdnse.print_debug(1, "%s: password : " .. escape(netgear_password), SCRIPT_NAME)
else
- stdnse.print_debug(1, "%s: We haven't been able to get username/password", SCRIPT_NAME)
+ stdnse.debug1("We haven't been able to get username/password")
end
end
end
diff --git a/scripts/http-wordpress-enum.nse b/scripts/http-wordpress-enum.nse
index 0cfe9b153..b096624d7 100644
--- a/scripts/http-wordpress-enum.nse
+++ b/scripts/http-wordpress-enum.nse
@@ -54,7 +54,7 @@ local function get_wp_user(host, port, path, id)
stdnse.print_debug(2, "%s: Trying to get username with id %s", SCRIPT_NAME, id)
local req = http.get(host, port, path.."?author="..id, { no_cache = true})
if req.status then
- stdnse.print_debug(1, "%s: User id #%s returned status %s", SCRIPT_NAME, id, req.status)
+ stdnse.debug1("User id #%s returned status %s", id, req.status)
if req.status == 301 then
local _, _, user = string.find(req.header.location, 'https?://.*/.*/(.*)/')
return user
@@ -124,7 +124,7 @@ action = function(host, port)
for i=1, tonumber(limit) do
local user = get_wp_user(host, port, basepath, i)
if user then
- stdnse.print_debug(1, "%s: Username found -> %s", SCRIPT_NAME, user)
+ stdnse.debug1("Username found -> %s", user)
output[#output+1] = string.format("Username found: %s", user)
users[#users+1] = user
end
diff --git a/scripts/imap-capabilities.nse b/scripts/imap-capabilities.nse
index a950e594d..1c65a4639 100644
--- a/scripts/imap-capabilities.nse
+++ b/scripts/imap-capabilities.nse
@@ -43,7 +43,7 @@ action = function(host, port)
end
return stdnse.strjoin(" ", capstrings)
elseif type(capa) == "string" then
- stdnse.print_debug(1, "%s: '%s' for %s", SCRIPT_NAME, capa, host.ip)
+ stdnse.debug1("'%s' for %s", capa, host.ip)
return
else
return "server doesn't support CAPABILITIES"
diff --git a/scripts/jdwp-exec.nse b/scripts/jdwp-exec.nse
index cce58eccb..99f34db23 100644
--- a/scripts/jdwp-exec.nse
+++ b/scripts/jdwp-exec.nse
@@ -60,14 +60,14 @@ action = function(host, port)
local injectedClass
status,injectedClass = jdwp.injectClass(socket,class_bytes)
if not status then
- stdnse.print_debug(1, "%s: Failed to inject class", SCRIPT_NAME)
+ stdnse.debug1("Failed to inject class")
return stdnse.format_output(false, "Failed to inject class")
end
-- find injected class method
local runMethodID = jdwp.findMethod(socket,injectedClass.id,"run",false)
if runMethodID == nil then
- stdnse.print_debug(1, "%s: Couldn't find run method", SCRIPT_NAME)
+ stdnse.debug1("Couldn't find run method")
return stdnse.format_output(false, "Couldn't find run method.")
end
-- set run() method argument
@@ -78,7 +78,7 @@ action = function(host, port)
local cmdID
status,cmdID = jdwp.createString(socket,0,cmd)
if not status then
- stdnse.print_debug(1, "%s: Couldn't create string", SCRIPT_NAME)
+ stdnse.debug1("Couldn't create string")
return stdnse.format_output(false, cmdID)
end
local runArgs = bin.pack(">CL",0x4c,cmdID) -- 0x4c is object type tag
@@ -86,7 +86,7 @@ action = function(host, port)
local result
status, result = jdwp.invokeObjectMethod(socket,0,injectedClass.instance,injectedClass.thread,injectedClass.id,runMethodID,1,runArgs)
if not status then
- stdnse.print_debug(1, "%s: Couldn't invoke run method", SCRIPT_NAME)
+ stdnse.debug1("Couldn't invoke run method")
return stdnse.format_output(false, result)
end
-- get the result string
diff --git a/scripts/jdwp-info.nse b/scripts/jdwp-info.nse
index 30f07cbb8..0778542b1 100644
--- a/scripts/jdwp-info.nse
+++ b/scripts/jdwp-info.nse
@@ -67,14 +67,14 @@ action = function(host, port)
local injectedClass
status,injectedClass = jdwp.injectClass(socket,class_bytes)
if not status then
- stdnse.print_debug(1, "%s: Failed to inject class", SCRIPT_NAME)
+ stdnse.debug1("Failed to inject class")
return stdnse.format_output(false, "Failed to inject class")
end
-- find injected class method
local runMethodID = jdwp.findMethod(socket,injectedClass.id,"run",false)
if runMethodID == nil then
- stdnse.print_debug(1, "%s: Couldn't find run method", SCRIPT_NAME)
+ stdnse.debug1("Couldn't find run method")
return stdnse.format_output(false, "Couldn't find run method.")
end
@@ -82,7 +82,7 @@ action = function(host, port)
local result
status, result = jdwp.invokeObjectMethod(socket,0,injectedClass.instance,injectedClass.thread,injectedClass.id,runMethodID,0,nil)
if not status then
- stdnse.print_debug(1, "%s: Couldn't invoke run method", SCRIPT_NAME)
+ stdnse.debug1("Couldn't invoke run method")
return stdnse.format_output(false, result)
end
-- get the result string
diff --git a/scripts/jdwp-inject.nse b/scripts/jdwp-inject.nse
index 4287cb8a0..2bb8f2bdb 100644
--- a/scripts/jdwp-inject.nse
+++ b/scripts/jdwp-inject.nse
@@ -58,14 +58,14 @@ action = function(host, port)
local injectedClass
status,injectedClass = jdwp.injectClass(socket,class_bytes)
if not status then
- stdnse.print_debug(1, "%s: Failed to inject class", SCRIPT_NAME)
+ stdnse.debug1("Failed to inject class")
return stdnse.format_output(false, "Failed to inject class")
end
-- find injected class method
local runMethodID = jdwp.findMethod(socket,injectedClass.id,"run",false)
if runMethodID == nil then
- stdnse.print_debug(1, "%s: Couldn't find run method", SCRIPT_NAME)
+ stdnse.debug1("Couldn't find run method")
return stdnse.format_output(false, "Couldn't find run method.")
end
@@ -73,7 +73,7 @@ action = function(host, port)
local result
status, result = jdwp.invokeObjectMethod(socket,0,injectedClass.instance,injectedClass.thread,injectedClass.id,runMethodID,0,nil)
if not status then
- stdnse.print_debug(1, "%s: Couldn't invoke run method", SCRIPT_NAME)
+ stdnse.debug1("Couldn't invoke run method")
return stdnse.format_output(false, result)
end
-- get the result string
diff --git a/scripts/membase-http-info.nse b/scripts/membase-http-info.nse
index 6c631a7c4..7cd11adf4 100644
--- a/scripts/membase-http-info.nse
+++ b/scripts/membase-http-info.nse
@@ -124,7 +124,7 @@ action = function(host, port)
-- Identify servers that answer 200 to invalid HTTP requests and exit as these would invalidate the tests
local _, http_status, _ = http.identify_404(host,port)
if ( http_status == 200 ) then
- stdnse.print_debug(1, "%s: Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", SCRIPT_NAME, host.ip, port.number)
+ stdnse.debug1("Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", host.ip, port.number)
return false
end
diff --git a/scripts/mysql-vuln-cve2012-2122.nse b/scripts/mysql-vuln-cve2012-2122.nse
index aed1338b4..f2853864e 100644
--- a/scripts/mysql-vuln-cve2012-2122.nse
+++ b/scripts/mysql-vuln-cve2012-2122.nse
@@ -130,7 +130,7 @@ basically account password protection is as good as nonexistent.
-- Chance of succeeding is 1/256. Let's try 1,500 to be safe.
--
for i=1,iterations do
- stdnse.print_debug(1, "%s: Connection attempt #%d", SCRIPT_NAME, i)
+ stdnse.debug1("Connection attempt #%d", i)
try( socket:connect(host, port) )
response = try( mysql.receiveGreeting(socket) )
status, response = mysql.loginRequest(socket, {authversion = "post41", charset = response.charset}, mysql_user, mysql_pwd, response.salt)
diff --git a/scripts/pcanywhere-brute.nse b/scripts/pcanywhere-brute.nse
index 21345328e..1f3a33956 100644
--- a/scripts/pcanywhere-brute.nse
+++ b/scripts/pcanywhere-brute.nse
@@ -95,7 +95,7 @@ Driver = {
end
if not status or string.find(response,"Please press ") == nil then
--probably not pcanywhere
- stdnse.print_debug(1, "%s: not pcAnywhere", SCRIPT_NAME)
+ stdnse.debug1("not pcAnywhere")
return false, brute.Error:new( "Probably not pcAnywhere." )
end
retry = false
@@ -108,7 +108,7 @@ Driver = {
status, err = self.socket:send(bin.pack("H","6f620102000000")) -- auth capabilities II
status, response = self.socket:receive_bytes(0)
if not status or (string.find(response,"Enter user name") == nil and string.find(response,"Enter login name") == nil) then
- stdnse.print_debug(1, "%s: handshake failed", SCRIPT_NAME)
+ stdnse.debug1("handshake failed")
return false, brute.Error:new( "Handshake failed." )
end
return true
@@ -124,14 +124,14 @@ Driver = {
status, err = self.socket:send(bin.pack("C",0x06) .. bin.pack("C",string.len(user)) .. encrypt(user) ) -- send username
status, response = self.socket:receive_bytes(0)
if not status or string.find(response,"Enter password") == nil then
- stdnse.print_debug(1, "%s: Sending username failed", SCRIPT_NAME)
+ stdnse.debug1("Sending username failed")
return false, brute.Error:new( "Sending username failed." )
end
-- send password
status, err = self.socket:send(bin.pack("C",0x06) .. bin.pack("C",string.len(pass)) .. encrypt(pass) ) -- send password
status, response = self.socket:receive_bytes(0)
if not status or string.find(response,"Login unsuccessful") or string.find(response,"Invalid login.")then
- stdnse.print_debug(1, "%s: Incorrect username or password", SCRIPT_NAME)
+ stdnse.debug1("Incorrect username or password")
return false, brute.Error:new( "Incorrect username or password." )
end
diff --git a/scripts/pop3-capabilities.nse b/scripts/pop3-capabilities.nse
index 4b6ba5ff9..fa50f8b45 100644
--- a/scripts/pop3-capabilities.nse
+++ b/scripts/pop3-capabilities.nse
@@ -40,7 +40,7 @@ action = function(host, port)
end
return stdnse.strjoin(" ", capstrings)
elseif type(err) == "string" then
- stdnse.print_debug(1, "%s: '%s' for %s", SCRIPT_NAME, err, host.ip)
+ stdnse.debug1("'%s' for %s", err, host.ip)
return
else
return "server doesn't support CAPA"
diff --git a/scripts/qconn-exec.nse b/scripts/qconn-exec.nse
index 3759ce16d..5d00a86cf 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", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("Connecting to %s:%s", 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).", SCRIPT_NAME, host.targetname or host.ip, port.number, timeout)
+ stdnse.debug1("Timeout exceeded for %s:%s (Timeout: %ss).", host.targetname or host.ip, port.number, timeout)
return
end
-- Parse response
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.", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("%s:%s is not a QNX QCONN daemon.", 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.", SCRIPT_NAME, host.targetname or host.ip, port.number)
+ stdnse.debug1("%s:%s QNX QCONN daemon is not vulnerable.", host.targetname or host.ip, port.number)
return
end
diff --git a/scripts/rdp-vuln-ms12-020.nse b/scripts/rdp-vuln-ms12-020.nse
index 6143414da..6a4a4f4c5 100644
--- a/scripts/rdp-vuln-ms12-020.nse
+++ b/scripts/rdp-vuln-ms12-020.nse
@@ -186,7 +186,7 @@ action = function(host, port)
status, response = socket:receive_bytes(0)
if response ~= bin.pack("H","0300000b06d00000123400") then
--probably not rdp at all
- stdnse.print_debug(1, "%s: not RDP", SCRIPT_NAME)
+ stdnse.debug1("not RDP")
return nil
end
status, err = socket:send(connectInitial)
diff --git a/scripts/riak-http-info.nse b/scripts/riak-http-info.nse
index 032a4c6e7..f0c296c61 100644
--- a/scripts/riak-http-info.nse
+++ b/scripts/riak-http-info.nse
@@ -116,7 +116,7 @@ action = function(host, port)
-- Identify servers that answer 200 to invalid HTTP requests and exit as these would invalidate the tests
local _, http_status, _ = http.identify_404(host,port)
if ( http_status == 200 ) then
- stdnse.print_debug(1, "%s: Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", SCRIPT_NAME, host.ip, port.number)
+ stdnse.debug1("Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", host.ip, port.number)
return false
end
diff --git a/scripts/smb-psexec.nse b/scripts/smb-psexec.nse
index 38eb77f74..3bf294879 100644
--- a/scripts/smb-psexec.nse
+++ b/scripts/smb-psexec.nse
@@ -650,10 +650,10 @@ local function locate_file(filename, extension)
if(filename_full == nil) then
local f, err = io.open(filename, "rb")
if f == nil then
- stdnse.print_debug(1, "%s: Error opening %s: %s", SCRIPT_NAME, filename, err)
+ stdnse.debug1("Error opening %s: %s", filename, err)
f, err = io.open(filename .. "." .. extension, "rb")
if f == nil then
- stdnse.print_debug(1, "%s: Error opening %s.%s: %s", SCRIPT_NAME, filename, extension, err)
+ stdnse.debug1("Error opening %s.%s: %s", filename, extension, err)
return nil -- unnecessary, but explicit
else
f:close()
diff --git a/scripts/smtp-vuln-cve2010-4344.nse b/scripts/smtp-vuln-cve2010-4344.nse
index ff8ea4611..77d1283eb 100644
--- a/scripts/smtp-vuln-cve2010-4344.nse
+++ b/scripts/smtp-vuln-cve2010-4344.nse
@@ -461,7 +461,7 @@ action = function(host, port)
end
local status, output = check_exim(smtp_opts)
if not status then
- stdnse.print_debug(1, "%s: %s", SCRIPT_NAME, output)
+ stdnse.debug1("%s", output)
return nil
end
return stdnse.format_output(status, output)
diff --git a/scripts/smtp-vuln-cve2011-1720.nse b/scripts/smtp-vuln-cve2011-1720.nse
index 0e66859ad..d595c43b3 100644
--- a/scripts/smtp-vuln-cve2011-1720.nse
+++ b/scripts/smtp-vuln-cve2011-1720.nse
@@ -280,7 +280,7 @@ than PLAIN and LOGIN.]],
local report = vulns.Report:new(SCRIPT_NAME, host, port)
local status, err = check_smtpd(smtp_opts)
if not status then
- stdnse.print_debug(1, "%s: %s", SCRIPT_NAME, err)
+ stdnse.debug1("%s", err)
return nil
end
return report:make_output(smtp_opts.vuln)
diff --git a/scripts/smtp-vuln-cve2011-1764.nse b/scripts/smtp-vuln-cve2011-1764.nse
index 0662b51be..3a3a44f62 100644
--- a/scripts/smtp-vuln-cve2011-1764.nse
+++ b/scripts/smtp-vuln-cve2011-1764.nse
@@ -232,7 +232,7 @@ arbitrary code with the privileges of the Exim daemon.]],
local report = vulns.Report:new(SCRIPT_NAME, host, port)
local status, err = check_exim(smtp_opts)
if not status then
- stdnse.print_debug(1, "%s: %s", SCRIPT_NAME, err)
+ stdnse.debug1("%s", err)
return nil
end
return report:make_output(smtp_opts.vuln)
|