diff --git a/scripts/asn-query.nse b/scripts/asn-query.nse index 9a3e1949a..2df53385e 100644 --- a/scripts/asn-query.nse +++ b/scripts/asn-query.nse @@ -212,7 +212,7 @@ function ip_to_asn( query ) local status, decoded_response = dns.query( query, options) if not status then - stdnse.print_debug( "%s Error from dns.query(): %s", SCRIPT_NAME, decoded_response ) + stdnse.debug1("Error from dns.query(): %s", decoded_response ) end return status, decoded_response diff --git a/scripts/cvs-brute.nse b/scripts/cvs-brute.nse index 6757ef5d0..28d304848 100644 --- a/scripts/cvs-brute.nse +++ b/scripts/cvs-brute.nse @@ -63,7 +63,7 @@ Driver = -- This error seems to indicate that the user does not exist if ( err:match("E PAM start error%: Critical error %- immediate abort\0$") ) then - stdnse.print_debug(2, "%s: The user %s does not exist", SCRIPT_NAME, username) + stdnse.debug2("The user %s does not exist", username) local err = brute.Error:new("Account invalid") err:setInvalidAccount(username) return false, err diff --git a/scripts/flume-master-info.nse b/scripts/flume-master-info.nse index 7f7833ada..a9672e2db 100644 --- a/scripts/flume-master-info.nse +++ b/scripts/flume-master-info.nse @@ -182,7 +182,7 @@ action = function( host, port ) and response['body'] then local body = response['body']:gsub("%%","%%%%") local capacity = {} - stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME, body) + stdnse.debug2("Body %s\n", body) if body:match("Version:%s*([^][,]+)") then local version = body:match("Version:%s*([^][,]+)") stdnse.debug1("Version %s", version) diff --git a/scripts/hadoop-datanode-info.nse b/scripts/hadoop-datanode-info.nse index 1dda27e04..57ae1e125 100644 --- a/scripts/hadoop-datanode-info.nse +++ b/scripts/hadoop-datanode-info.nse @@ -44,12 +44,12 @@ action = function( host, port ) local result = {} local uri = "/browseDirectory.jsp" - stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) + stdnse.debug1("HTTP GET %s:%s%s", host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) 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) + stdnse.debug2("Body %s\n",body) if body:match("([^][\"]+)\">Log") then port.version.name = "hadoop-datanode" port.version.product = "Apache Hadoop" diff --git a/scripts/hadoop-jobtracker-info.nse b/scripts/hadoop-jobtracker-info.nse index 93177216a..6f52018b2 100644 --- a/scripts/hadoop-jobtracker-info.nse +++ b/scripts/hadoop-jobtracker-info.nse @@ -62,14 +62,14 @@ 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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) + stdnse.debug1("HTTP GET %s:%s%s", host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) 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) + stdnse.debug2("Body %s\n",body) for line in string.gmatch(body, "[^\n]+") do - stdnse.print_debug(3, "%s: Line %s\n", SCRIPT_NAME,line) + stdnse.debug3("Line %s\n",line) if line:match("job_[%d_]+") then local user = line:match("([^][<>]+)") local job_time = line:match("([^][<]+)") @@ -83,13 +83,13 @@ end get_tasktrackers = function( host, port ) local results = {} 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) + stdnse.debug1("HTTP GET %s:%s%s", host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) 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']) + stdnse.debug2("Body %s\n",response['body']) for line in string.gmatch(response['body'], "[^\n]+") do - stdnse.print_debug(3, "%s: Line %s\n", SCRIPT_NAME,line) + stdnse.debug3("Line %s\n",line) if line:match("href=\"[%w]+://([%w%.:]+)/\">tracker") then local tasktracker = line:match("href=\".*//([%w%.:]+)/\">tracker") stdnse.debug1("taskstracker %s",tasktracker) @@ -110,11 +110,11 @@ action = function( host, port ) local result = {} local uri = "/jobtracker.jsp" - stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) + stdnse.debug1("HTTP GET %s:%s%s", host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) 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']) + stdnse.debug2("Body %s\n",response['body']) if response['body']:match("State:%s*([^][<]+)") then local state = response['body']:match("State:%s*([^][<]+)") stdnse.debug1("State %s",state) diff --git a/scripts/hadoop-namenode-info.nse b/scripts/hadoop-namenode-info.nse index 1f182cc0b..1e1d37815 100644 --- a/scripts/hadoop-namenode-info.nse +++ b/scripts/hadoop-namenode-info.nse @@ -62,12 +62,12 @@ 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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) + stdnse.debug1("HTTP GET %s:%s%s", host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) 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) + stdnse.debug2("Body %s\n",body) for datanodetmp in string.gmatch(body, "[%w%.:-_]+/browseDirectory.jsp") do local datanode = datanodetmp:gsub("/browseDirectory.jsp","") stdnse.debug1("Datanode %s",datanode) @@ -88,13 +88,13 @@ action = function( host, port ) local result = {} local uri = "/dfshealth.jsp" - stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) + stdnse.debug1("HTTP GET %s:%s%s", host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) 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) + stdnse.debug2("Body %s\n",body) if body:match("Started:%s*([^][<]+)") then local start = body:match("Started:%s*([^][<]+)") stdnse.debug1("Started %s",start) diff --git a/scripts/hadoop-secondary-namenode-info.nse b/scripts/hadoop-secondary-namenode-info.nse index b53a7182c..6df528665 100644 --- a/scripts/hadoop-secondary-namenode-info.nse +++ b/scripts/hadoop-secondary-namenode-info.nse @@ -59,13 +59,13 @@ action = function( host, port ) local result = {} local uri = "/status.jsp" - stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) + stdnse.debug1("HTTP GET %s:%s%s", host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) 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 = {} - stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body) + stdnse.debug2("Body %s\n",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]+)")) diff --git a/scripts/hadoop-tasktracker-info.nse b/scripts/hadoop-tasktracker-info.nse index 404a8b81c..2f1de0615 100644 --- a/scripts/hadoop-tasktracker-info.nse +++ b/scripts/hadoop-tasktracker-info.nse @@ -48,12 +48,12 @@ action = function( host, port ) local result = {} local uri = "/tasktracker.jsp" - stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) + stdnse.debug1("HTTP GET %s:%s%s", host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) 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) + stdnse.debug2("Body %s\n",body) if response['body']:match("Version:%s*([^][<]+)") then local version = response['body']:match("Version:%s*([^][<]+)") local versionNo = version:match("([^][,]+)") diff --git a/scripts/hbase-master-info.nse b/scripts/hbase-master-info.nse index e793143c5..a14cd6f8e 100644 --- a/scripts/hbase-master-info.nse +++ b/scripts/hbase-master-info.nse @@ -61,15 +61,15 @@ action = function( host, port ) local result = {} local region_servers = {} local uri = "/master.jsp" - stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) + stdnse.debug1("HTTP GET %s:%s%s", host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) 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) + stdnse.debug2("Body %s\n",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", SCRIPT_NAME,version) + stdnse.debug1("Hbase Version %s",version) table.insert(result, ("Hbase Version: %s"):format(version)) port.version.version = version end @@ -111,7 +111,7 @@ action = function( host, port ) end end for line in string.gmatch(body, "[^\n]+") do - stdnse.print_debug(3, "%s: Line %s\n", SCRIPT_NAME,line) + stdnse.debug3("Line %s\n",line) if line:match("maxHeap") then local region_server= line:match("\">([^][<]+)") stdnse.debug1("Region Server %s",region_server) diff --git a/scripts/hbase-region-info.nse b/scripts/hbase-region-info.nse index 43afa9aac..d4156528d 100644 --- a/scripts/hbase-region-info.nse +++ b/scripts/hbase-region-info.nse @@ -56,15 +56,15 @@ 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", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) + stdnse.debug1("HTTP GET %s:%s%s", host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) 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) + stdnse.debug2("Body %s\n",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", SCRIPT_NAME,version) + stdnse.debug1("Hbase Version %s",version) table.insert(result, ("Hbase Version: %s"):format(version)) port.version.version = version end diff --git a/scripts/http-adobe-coldfusion-apsa1301.nse b/scripts/http-adobe-coldfusion-apsa1301.nse index ee6d448e3..cec2857d1 100644 --- a/scripts/http-adobe-coldfusion-apsa1301.nse +++ b/scripts/http-adobe-coldfusion-apsa1301.nse @@ -34,7 +34,7 @@ local MAGIC_URI = "administrator.cfc?method=login&adminpassword=&rdsPasswordAllo local function get_admin_cookie(host, port, basepath) local req = http.get(host, port, basepath..MAGIC_URI) if req.header['set-cookie'] then - stdnse.print_debug(1, "%s:Header 'set-cookie' detected in response.", SCRIPT_NAME) + stdnse.debug1("Header 'set-cookie' detected in response.") local _, _, admin_cookie = string.find(req.header['set-cookie'], ";path=/, CFAUTHORIZATION_cfadmin=(.*);path=/") if admin_cookie:len() > 79 then stdnse.debug1("Extracted cookie:%s", admin_cookie) diff --git a/scripts/http-awstatstotals-exec.nse b/scripts/http-awstatstotals-exec.nse index 7724a596b..5dfd7aa0a 100644 --- a/scripts/http-awstatstotals-exec.nse +++ b/scripts/http-awstatstotals-exec.nse @@ -94,7 +94,7 @@ action = function(host, port) --check for awstats signature local awstats_check = check_installation(host, port, uri) if not(awstats_check) then - stdnse.print_debug(1, "%s:This does not look like Awstats Totals. Quitting.", SCRIPT_NAME) + stdnse.debug1("This does not look like Awstats Totals. Quitting.") return end diff --git a/scripts/http-axis2-dir-traversal.nse b/scripts/http-axis2-dir-traversal.nse index c82654b4f..0c0ae638b 100644 --- a/scripts/http-axis2-dir-traversal.nse +++ b/scripts/http-axis2-dir-traversal.nse @@ -145,14 +145,14 @@ action = function(host, port) --Use selected service and exploit 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) + stdnse.debug2("Query -> %s", basepath..selected_service.."?xsd="..rfile) --response came back if req.status and req.status == 200 then --if body is empty something wrong could have happened... if string.len(req.body) <= 0 then if nmap.verbosity() >= 2 then - stdnse.print_debug(1, "%s:Response was empty. The file does not exists or the web server does not have sufficient permissions", SCRIPT_NAME) + stdnse.debug1("Response was empty. The file does not exists or the web server does not have sufficient permissions") end return end diff --git a/scripts/http-coldfusion-subzero.nse b/scripts/http-coldfusion-subzero.nse index 2c6237e63..ca542ae5c 100644 --- a/scripts/http-coldfusion-subzero.nse +++ b/scripts/http-coldfusion-subzero.nse @@ -71,7 +71,7 @@ local CREDENTIALS_PAYLOADS = { local function get_installation_path(host, port, basepath) local req = http.get(host, port, basepath..PATH_PAYLOAD) if req.header['set-cookie'] then - stdnse.print_debug(1, "%s:Header 'set-cookie' detected in response.", SCRIPT_NAME) + stdnse.debug1("Header 'set-cookie' detected in response.") local _, _, path = string.find(req.header['set-cookie'], "path=/, ANALYZER_DIRECTORY=(.-);path=/") if path then @@ -91,16 +91,16 @@ local function get_version(host, port, basepath) if img_req.status == 200 then local md5chk = stdnse.tohex(openssl.md5(img_req.body)) if md5chk == "a4c81b7a6289b2fc9b36848fa0cae83c" then - stdnse.print_debug(1, "%s:CF version 10 detected.", SCRIPT_NAME) + stdnse.debug1("CF version 10 detected.") version = 10 elseif md5chk == "596b3fc4f1a0b818979db1cf94a82220" then - stdnse.print_debug(1, "%s:CF version 9 detected.", SCRIPT_NAME) + stdnse.debug1("CF version 9 detected.") version = 9 elseif md5chk == "" then - stdnse.print_debug(1, "%s:CF version 8 detected.", SCRIPT_NAME) + stdnse.debug1("CF version 8 detected.") version = 8 else - stdnse.print_debug(1, "%s:Could not determine version.", SCRIPT_NAME) + stdnse.debug1("Could not determine version.") version = nil end end diff --git a/scripts/http-huawei-hg5xx-vuln.nse b/scripts/http-huawei-hg5xx-vuln.nse index bd7c9d0a7..08ce274d5 100644 --- a/scripts/http-huawei-hg5xx-vuln.nse +++ b/scripts/http-huawei-hg5xx-vuln.nse @@ -109,7 +109,7 @@ including PPPoE credentials, firmware version, model, gateway, dns servers and a if pppoe_user then vuln.state = vulns.STATE.EXPLOIT else - stdnse.print_debug(1, "%s:Username string was not found in this page. Exiting.", SCRIPT_NAME) + stdnse.debug1("Username string was not found in this page. Exiting.") return vuln_report:make_output(vuln) end diff --git a/scripts/http-icloud-findmyiphone.nse b/scripts/http-icloud-findmyiphone.nse index df2086b45..239d65421 100644 --- a/scripts/http-icloud-findmyiphone.nse +++ b/scripts/http-icloud-findmyiphone.nse @@ -57,7 +57,7 @@ action = function() local status, response = mobileme:getLocation() if ( not(status) ) then - stdnse.print_debug(2, "%s: %s", SCRIPT_NAME, response) + stdnse.debug2("%s", response) return fail("Failed to retrieve location information") end diff --git a/scripts/http-iis-short-name-brute.nse b/scripts/http-iis-short-name-brute.nse index c31bc3592..c58fad9f5 100644 --- a/scripts/http-iis-short-name-brute.nse +++ b/scripts/http-iis-short-name-brute.nse @@ -114,7 +114,7 @@ local function findName(host, port, path, number) errors = errors+1 end if errors>10 then - stdnse.print_debug(1, "%s:False positive detected. Exiting.", SCRIPT_NAME) + stdnse.debug1("False positive detected. Exiting.") errors_max=true else stdnse.print_debug(1, "Added folder: %s", path .. "~" .. number) diff --git a/scripts/http-litespeed-sourcecode-download.nse b/scripts/http-litespeed-sourcecode-download.nse index acc6f3516..e9e841cc6 100644 --- a/scripts/http-litespeed-sourcecode-download.nse +++ b/scripts/http-litespeed-sourcecode-download.nse @@ -56,7 +56,7 @@ action = function(host, port) elseif req.status == 404 and nmap.verbosity() >= 2 then output[#output+1] = string.format("Page: %s was not found. Try with an existing file.", rfile) end - stdnse.print_debug(2, "%s:Request status:%s body:%s", SCRIPT_NAME, req.status, req.body) + stdnse.debug2("Request status:%s body:%s", req.status, req.body) else output[#output+1] = "\nLitespeed Web Server Source Code Disclosure (CVE-2010-2333)" output[#output+1] = string.format("%s source code:", rfile) diff --git a/scripts/http-majordomo2-dir-traversal.nse b/scripts/http-majordomo2-dir-traversal.nse index a0f043ff7..aca6f64ee 100644 --- a/scripts/http-majordomo2-dir-traversal.nse +++ b/scripts/http-majordomo2-dir-traversal.nse @@ -76,7 +76,7 @@ action = function(host, port) response = http.get(host, port, evil_uri) if response.body and response.status==200 then if response.body:match("unknowntopic") then - stdnse.print_debug(1, "%s:[Error] The server is not vulnerable, '%s' was not found or the web server has insufficient permissions to read it", SCRIPT_NAME, rfile) + stdnse.debug1("[Error] The server is not vulnerable, '%s' was not found or the web server has insufficient permissions to read it", rfile) return end local _ diff --git a/scripts/http-method-tamper.nse b/scripts/http-method-tamper.nse index 96c3af1f1..6677b3e62 100644 --- a/scripts/http-method-tamper.nse +++ b/scripts/http-method-tamper.nse @@ -73,7 +73,7 @@ portrule = shortport.http -- First, it tries with HEAD, POST and then with a random string. -- local function probe_http_verbs(host, port, uri) - stdnse.print_debug(2, "%s:Tampering HTTP verbs %s", SCRIPT_NAME, uri) + stdnse.debug2("Tampering HTTP verbs %s", uri) local head_req = http.head(host, port, uri) if head_req and head_req.status ~= 401 then return true, "HEAD" @@ -134,11 +134,11 @@ vulnerabilities via HTTP verb tampering. This is often found in web servers that end end if r.response.status == 401 then - stdnse.print_debug(2, "%s:%s is protected! Let's try some verb tampering...", SCRIPT_NAME, tostring(r.url)) + stdnse.debug2("%s is protected! Let's try some verb tampering...", tostring(r.url)) local parsed = url.parse(tostring(r.url)) local probe_status, probe_type = probe_http_verbs(host, port, parsed.path) if probe_status then - stdnse.print_debug(1, "%s:Vulnerable URI %s", SCRIPT_NAME, uri) + stdnse.debug1("Vulnerable URI %s", uri) table.insert(vuln_uris, parsed.path..string.format(" [%s]", probe_type)) end end @@ -157,7 +157,7 @@ vulnerabilities via HTTP verb tampering. This is often found in web servers that if path_req.status == 401 then local probe_status, probe_type = probe_http_verbs(host, port, path) if probe_status then - stdnse.print_debug(1, "%s:Vulnerable URI %s", SCRIPT_NAME, path) + stdnse.debug1("Vulnerable URI %s", path) table.insert(vuln_uris, path..string.format(" [%s]", probe_type)) end end diff --git a/scripts/http-phpmyadmin-dir-traversal.nse b/scripts/http-phpmyadmin-dir-traversal.nse index b53996b9c..d5df7ab88 100644 --- a/scripts/http-phpmyadmin-dir-traversal.nse +++ b/scripts/http-phpmyadmin-dir-traversal.nse @@ -134,7 +134,7 @@ action = function(host, port) end 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.debug1("[Error] File not found:%s", rfile) stdnse.debug1("response : %s", response.body) vuln.extra_info = string.format("%s not found.\n", rfile) end diff --git a/scripts/http-phpself-xss.nse b/scripts/http-phpself-xss.nse index 94aa9e462..c9d68b4e8 100644 --- a/scripts/http-phpself-xss.nse +++ b/scripts/http-phpself-xss.nse @@ -83,7 +83,7 @@ local function launch_probe(host, port, uri) return false end - stdnse.print_debug(1, "%s:HTTP GET %s%s", SCRIPT_NAME, uri, PHP_SELF_PROBE) + stdnse.debug1("HTTP GET %s%s", uri, PHP_SELF_PROBE) probe_response = http.get(host, port, uri .. PHP_SELF_PROBE) --save probe in list to avoid repeating it diff --git a/scripts/http-robtex-shared-ns.nse b/scripts/http-robtex-shared-ns.nse index 065c8acb5..e639ae77a 100644 --- a/scripts/http-robtex-shared-ns.nse +++ b/scripts/http-robtex-shared-ns.nse @@ -90,7 +90,7 @@ action = function(host) return end local url = base_url:format(server) - stdnse.print_debug(2, "%s: Querying URL: %s", SCRIPT_NAME, url) + stdnse.debug2("Querying URL: %s", url) data = fetch_robtex_data(url) domains = parse_robtex_response(data) diff --git a/scripts/http-sql-injection.nse b/scripts/http-sql-injection.nse index faae33afe..583f25810 100644 --- a/scripts/http-sql-injection.nse +++ b/scripts/http-sql-injection.nse @@ -78,7 +78,7 @@ local function check_injection_response(response) if errorstrings then for _,e in ipairs(errorstrings) do if string.find(body, e) then - stdnse.print_debug(2, "%s: error string matched: %s", SCRIPT_NAME, e) + stdnse.debug2("error string matched: %s", e) return true end end @@ -192,7 +192,7 @@ local function check_form(form, host, port, path) for _,field in ipairs(form["fields"]) do if sqli_field(field["type"]) then - stdnse.print_debug(2, "%s: checking field %s", SCRIPT_NAME, field["name"]) + stdnse.debug2("checking field %s", field["name"]) postdata[field["name"]] = "' OR sqlspider" response = sending_function(postdata) if response and response.body and response.status==200 then diff --git a/scripts/http-tplink-dir-traversal.nse b/scripts/http-tplink-dir-traversal.nse index c990211ed..77940a1ec 100644 --- a/scripts/http-tplink-dir-traversal.nse +++ b/scripts/http-tplink-dir-traversal.nse @@ -91,10 +91,10 @@ end --- local function check_vuln(host, port) local evil_uri = TRAVERSAL_QRY..DEFAULT_REMOTE_FILE - stdnse.print_debug(1, "%s:HTTP GET %s", SCRIPT_NAME, evil_uri) + stdnse.debug1("HTTP GET %s", evil_uri) local response = http.get(host, port, evil_uri) if response.body and response.status==200 and response.body:match("root:") then - stdnse.print_debug(1, "%s:Pattern 'root:' found.", SCRIPT_NAME, response.body) + stdnse.debug1("Pattern 'root:' found.", response.body) return true end return false @@ -134,7 +134,7 @@ Possibly vulnerable (Based on the same firmware): WR743ND,WR842ND,WA-901ND,WR941 if response.body and response.status==200 then stdnse.print_debug(2, "%s", response.body) if response.body:match("Error") then - stdnse.print_debug(1, "%s:[Error] File not found:%s", SCRIPT_NAME, rfile) + stdnse.debug1("[Error] File not found:%s", rfile) vuln.extra_info = string.format("%s not found.\n", rfile) return vuln_report:make_output(vuln) end diff --git a/scripts/http-userdir-enum.nse b/scripts/http-userdir-enum.nse index 20718150c..82cc216b7 100644 --- a/scripts/http-userdir-enum.nse +++ b/scripts/http-userdir-enum.nse @@ -136,7 +136,7 @@ function init() stdnse.get_script_args('userdir.users') local read, usernames = datafiles.parse_file(customlist or "nselib/data/usernames.lst", {}) if not read then - stdnse.print_debug(1, "%s %s", SCRIPT_NAME, + stdnse.debug1("%s", usernames or "Unknown Error reading usernames list.") nmap.registry.userdir = {} return nil @@ -144,7 +144,7 @@ function init() -- random dummy username to catch false positives (not necessary) -- if #usernames > 0 then table.insert(usernames, 1, randomstring()) end nmap.registry.userdir = usernames - stdnse.print_debug(1, "%s Testing %d usernames.", SCRIPT_NAME, #usernames) + stdnse.debug1("Testing %d usernames.", #usernames) return nil end diff --git a/scripts/http-vuln-cve2011-3368.nse b/scripts/http-vuln-cve2011-3368.nse index 8a41338a0..128ec4e9f 100644 --- a/scripts/http-vuln-cve2011-3368.nse +++ b/scripts/http-vuln-cve2011-3368.nse @@ -84,7 +84,7 @@ servers to remote users who send carefully crafted requests.]], local bypass_request = http.pipeline_go(host,port, all) if ( not(bypass_request) ) then - stdnse.print_debug(1, "%s : got no answers from pipelined queries", SCRIPT_NAME) + stdnse.debug1("got no answers from pipelined queries") return "\n ERROR: Got no answers from pipelined queries" end @@ -112,7 +112,7 @@ servers to remote users who send carefully crafted requests.]], end for i=1, #bypass_request, 1 do - stdnse.print_debug(1, "%s : test %d returned a %d", SCRIPT_NAME,i,bypass_request[i].status) + stdnse.debug1("test %d returned a %d",i,bypass_request[i].status) -- here a 400 should be the evidence for a patched server. if ( bypass_request[i].status == 200 and vuln.state ~= vulns.STATE.VULN ) then diff --git a/scripts/http-vuln-cve2013-0156.nse b/scripts/http-vuln-cve2013-0156.nse index 274ba3fd2..c90bed5da 100644 --- a/scripts/http-vuln-cve2013-0156.nse +++ b/scripts/http-vuln-cve2013-0156.nse @@ -78,10 +78,10 @@ local function detect(host, port, uri) local req_ok = http.post(host, port, uri, opts, nil, PAYLOAD_OK) local req_time = http.post(host, port, uri, opts, nil, PAYLOAD_TIME) - stdnse.print_debug(2, "%s:First request returned status %d. Second request returned status %d", SCRIPT_NAME, req_ok.status, req_time.status) + stdnse.debug2("First request returned status %d. Second request returned status %d", req_ok.status, req_time.status) if req_ok.status == 200 and req_time.status == 200 then local req_malformed = http.post(host, port, uri, opts, nil, PAYLOAD_MALFORMED) - stdnse.print_debug(2, "%s:Malformed request returned status %d", SCRIPT_NAME, req_malformed.status) + stdnse.debug2("Malformed request returned status %d", req_malformed.status) if req_malformed.status == 500 then return true end @@ -111,7 +111,7 @@ The attackers don't need to be authenticated to exploit these vulnerabilities. } if detect(host,port,uri) then - stdnse.print_debug(1, "%s:Received status 500 as expected in vulnerable installations. Marking as vulnerable...", SCRIPT_NAME) + stdnse.debug1("Received status 500 as expected in vulnerable installations. Marking as vulnerable...") vuln_table.state = vulns.STATE.VULN local report = vulns.Report:new(SCRIPT_NAME, host, port) return report:make_output(vuln_table) diff --git a/scripts/http-waf-detect.nse b/scripts/http-waf-detect.nse index c5bf576ca..799f62d31 100644 --- a/scripts/http-waf-detect.nse +++ b/scripts/http-waf-detect.nse @@ -70,7 +70,7 @@ action = function(host, port) local use_body = stdnse.get_script_args(SCRIPT_NAME..".detectBodyChanges") or false --get original response from a "good" request - stdnse.print_debug(2, "%s: Requesting URI %s", SCRIPT_NAME, path) + stdnse.debug2("Requesting URI %s", path) orig_req = http.get(host, port, path) orig_req.body = http.clean_404(orig_req.body) if orig_req.status and orig_req.body then diff --git a/scripts/http-wordpress-enum.nse b/scripts/http-wordpress-enum.nse index b096624d7..87e682b9e 100644 --- a/scripts/http-wordpress-enum.nse +++ b/scripts/http-wordpress-enum.nse @@ -51,7 +51,7 @@ portrule = shortport.http -- @return false if not found otherwise it returns the username --- local function get_wp_user(host, port, path, id) - stdnse.print_debug(2, "%s: Trying to get username with id %s", SCRIPT_NAME, id) + stdnse.debug2("Trying to get username with id %s", id) local req = http.get(host, port, path.."?author="..id, { no_cache = true}) if req.status then stdnse.debug1("User id #%s returned status %s", id, req.status) @@ -77,7 +77,7 @@ end --@return True if WP was found -- local function check_wp(host, port, path) - stdnse.print_debug(2, "%s:Checking %swp-login.php ", SCRIPT_NAME, path) + stdnse.debug2("Checking %swp-login.php ", path) local req = http.get(host, port, path.."wp-login.php", {no_cache=true}) if req.status and req.status == 200 then return true diff --git a/scripts/http-wordpress-plugins.nse b/scripts/http-wordpress-plugins.nse index 316d82683..7cac0ee2c 100644 --- a/scripts/http-wordpress-plugins.nse +++ b/scripts/http-wordpress-plugins.nse @@ -91,7 +91,7 @@ action = function(host, port) plugins_search = tonumber(plugins_search_arg) end - stdnse.print_debug(1, "%s plugins search range: %s", SCRIPT_NAME, plugins_search or "unlimited") + stdnse.debug1("plugins search range: %s", plugins_search or "unlimited") -- search the website root for evidences of a Wordpress path @@ -102,9 +102,9 @@ action = function(host, port) wp_autoroot = string.match(target_index.body, "http://[%w%-%.]-/([%w%-%./]-)wp%-content") if wp_autoroot then wp_autoroot = "/" .. wp_autoroot - stdnse.print_debug(1, "%s WP root directory: %s", SCRIPT_NAME, wp_autoroot) + stdnse.debug1("WP root directory: %s", wp_autoroot) else - stdnse.print_debug(1, "%s WP root directory: wp_autoroot was unable to find a WP content dir (root page returns %d).", SCRIPT_NAME, target_index.status) + stdnse.debug1("WP root directory: wp_autoroot was unable to find a WP content dir (root page returns %d).", target_index.status) end end end @@ -147,7 +147,7 @@ action = function(host, port) -- release hell... local pipeline_returns = http.pipeline_go(host, port, all) if not pipeline_returns then - stdnse.print_debug(1, "%s : got no answers from pipelined queries", SCRIPT_NAME) + stdnse.debug1("got no answers from pipelined queries") end for i, data in pairs(pipeline_returns) do diff --git a/scripts/ip-forwarding.nse b/scripts/ip-forwarding.nse index 61cdb8dc5..eae68d82a 100644 --- a/scripts/ip-forwarding.nse +++ b/scripts/ip-forwarding.nse @@ -39,7 +39,7 @@ local arg_target = stdnse.get_script_args(SCRIPT_NAME .. ".target") hostrule = function(host) if ( not(host.mac_addr) ) then - stdnse.print_debug( "%s: Failed to determine hosts remote MAC address", SCRIPT_NAME ) + stdnse.debug1("Failed to determine hosts remote MAC address" ) end return (arg_target ~= nil and host.mac_addr ~= nil) end diff --git a/scripts/ip-geolocation-geobytes.nse b/scripts/ip-geolocation-geobytes.nse index f4b13229a..fbf6628dd 100644 --- a/scripts/ip-geolocation-geobytes.nse +++ b/scripts/ip-geolocation-geobytes.nse @@ -41,7 +41,7 @@ categories = {"discovery","external","safe"} hostrule = function(host) local is_private, err = ipOps.isPrivate( host.ip ) if is_private == nil then - stdnse.print_debug( "%s Error in Hostrule: %s.", SCRIPT_NAME, err ) + stdnse.debug1("Error in Hostrule: %s.", err ) return false end return not is_private diff --git a/scripts/ip-geolocation-geoplugin.nse b/scripts/ip-geolocation-geoplugin.nse index aa9d151ca..576309f38 100644 --- a/scripts/ip-geolocation-geoplugin.nse +++ b/scripts/ip-geolocation-geoplugin.nse @@ -29,7 +29,7 @@ categories = {"discovery","external","safe"} hostrule = function(host) local is_private, err = ipOps.isPrivate( host.ip ) if is_private == nil then - stdnse.print_debug( "%s Error in Hostrule: %s.", SCRIPT_NAME, err ) + stdnse.debug1("Error in Hostrule: %s.", err ) return false end return not is_private diff --git a/scripts/ip-geolocation-ipinfodb.nse b/scripts/ip-geolocation-ipinfodb.nse index d2ceac36b..2037afeea 100644 --- a/scripts/ip-geolocation-ipinfodb.nse +++ b/scripts/ip-geolocation-ipinfodb.nse @@ -36,7 +36,7 @@ categories = {"discovery","external","safe"} hostrule = function(host) local is_private, err = ipOps.isPrivate( host.ip ) if is_private == nil then - stdnse.print_debug( "%s not running: Error in Hostrule: %s.", SCRIPT_NAME, err ) + stdnse.debug1("not running: Error in Hostrule: %s.", err ) return false elseif is_private then stdnse.debug1("not running: Private IP address of target: %s", host.ip) diff --git a/scripts/ip-geolocation-maxmind.nse b/scripts/ip-geolocation-maxmind.nse index fa57f1d52..75b135d2d 100644 --- a/scripts/ip-geolocation-maxmind.nse +++ b/scripts/ip-geolocation-maxmind.nse @@ -35,7 +35,7 @@ categories = {"discovery","external","safe"} hostrule = function(host) local is_private, err = ipOps.isPrivate( host.ip ) if is_private == nil then - stdnse.print_debug( "%s Error in Hostrule: %s.", SCRIPT_NAME, err ) + stdnse.debug1("Error in Hostrule: %s.", err ) return false end return not is_private diff --git a/scripts/membase-brute.nse b/scripts/membase-brute.nse index ee6af1554..4a4c58238 100644 --- a/scripts/membase-brute.nse +++ b/scripts/membase-brute.nse @@ -79,7 +79,7 @@ local function getMechs(host, port) local status, response = helper:getSASLMechList() if ( not(status) ) then - stdnse.print_debug(2, "%s: Received unexpected response: %s", SCRIPT_NAME, response) + stdnse.debug2("Received unexpected response: %s", response) return false, "Received unexpected response" end diff --git a/scripts/mikrotik-routeros-brute.nse b/scripts/mikrotik-routeros-brute.nse index eba210aec..c208e97b4 100644 --- a/scripts/mikrotik-routeros-brute.nse +++ b/scripts/mikrotik-routeros-brute.nse @@ -59,19 +59,19 @@ Driver = try = nmap.new_try(function() return false end) try(self.s:send(data)) data = try(self.s:receive_bytes(50)) - stdnse.print_debug(1, "%s:Response #1:%s", SCRIPT_NAME, data) + stdnse.debug1("Response #1:%s", data) local _, _, ret = string.find(data, '!done%%=ret=(.+)') --If we find the challenge value we continue the connection process if ret then - stdnse.print_debug(1, "%s:Challenge value found:%s", SCRIPT_NAME, ret) + stdnse.debug1("Challenge value found:%s", ret) local md5str = bin.pack("xAA", password, bin.pack("H", ret)) --appends pwd and challenge local chksum = stdnse.tohex(openssl.md5(md5str)) local user_l = username:len()+6 --we add six because of the string "=name=" local login_pkt = bin.pack("cAcAcAx", 0x6, "/login", user_l, "=name="..username, 0x2c, "=response=00"..chksum) try(self.s:send(login_pkt)) data = try(self.s:receive_bytes(50)) - stdnse.print_debug(1, "%s:Response #2:%s", SCRIPT_NAME, data) + stdnse.debug1("Response #2:%s", data) if data then if string.find(data, "message=cannot") == nil then local c = creds.Credentials:new(SCRIPT_NAME, self.host, self.port ) diff --git a/scripts/ms-sql-brute.nse b/scripts/ms-sql-brute.nse index 45c92695d..234b2d164 100644 --- a/scripts/ms-sql-brute.nse +++ b/scripts/ms-sql-brute.nse @@ -142,7 +142,7 @@ local function test_credentials( instance, helper, username, password ) local status, result = helper:ConnectEx( instance ) local loginErrorCode if( status ) then - stdnse.print_debug( 2, "%s: Attempting login to %s as %s/%s", SCRIPT_NAME, instance:GetName(), username, password ) + stdnse.debug2("Attempting login to %s as %s/%s", instance:GetName(), username, password ) status, result, loginErrorCode = helper:Login( username, password, database, instance.host.ip ) end helper:Disconnect() @@ -160,7 +160,7 @@ local function test_credentials( instance, helper, username, password ) if ( loginErrorCode == mssql.LoginErrorType.PasswordExpired ) then passwordIsGood = true elseif ( loginErrorCode == mssql.LoginErrorType.PasswordMustChange ) then passwordIsGood = true elseif ( loginErrorCode == mssql.LoginErrorType.AccountLockedOut ) then - stdnse.print_debug( 1, "%s: Account %s locked out on %s", SCRIPT_NAME, username, instance:GetName() ) + stdnse.debug1("Account %s locked out on %s", username, instance:GetName() ) table.insert( instance.ms_sql_brute.warnings, string.format( "%s: Account is locked out.", username ) ) if ( not stdnse.get_script_args( "ms-sql-brute.ignore-lockout" ) ) then stopInstance = true @@ -226,14 +226,14 @@ local function process_instance( instance ) local helper = mssql.Helper:new() if ( not instance:HasNetworkProtocols() ) then - stdnse.print_debug( 1, "%s: %s has no network protocols enabled.", SCRIPT_NAME, instance:GetName() ) + stdnse.debug1("%s has no network protocols enabled.", instance:GetName() ) table.insert( instance.ms_sql_brute.errors, "No network protocols enabled." ) stopInstance = true end status, usernames = unpwdb.usernames() if ( not(status) ) then - stdnse.print_debug( 1, "%s: Failed to load usernames list.", SCRIPT_NAME ) + stdnse.debug1("Failed to load usernames list." ) table.insert( instance.ms_sql_brute.errors, "Failed to load usernames list." ) stopInstance = true end @@ -241,7 +241,7 @@ local function process_instance( instance ) if ( status ) then status, passwords = unpwdb.passwords() if ( not(status) ) then - stdnse.print_debug( 1, "%s: Failed to load passwords list.", SCRIPT_NAME ) + stdnse.debug1("Failed to load passwords list." ) table.insert( instance.ms_sql_brute.errors, "Failed to load passwords list." ) stopInstance = true end diff --git a/scripts/ms-sql-empty-password.nse b/scripts/ms-sql-empty-password.nse index 4c3417a0b..ee68403a2 100644 --- a/scripts/ms-sql-empty-password.nse +++ b/scripts/ms-sql-empty-password.nse @@ -67,7 +67,7 @@ local function test_credentials( instance, helper, username, password ) local status, result = helper:ConnectEx( instance ) local loginErrorCode if( status ) then - stdnse.print_debug( 2, "%s: Attempting login to %s", SCRIPT_NAME, instance:GetName() ) + stdnse.debug2("Attempting login to %s", instance:GetName() ) status, result, loginErrorCode = helper:Login( username, password, database, instance.host.ip ) end helper:Disconnect() @@ -80,7 +80,7 @@ local function test_credentials( instance, helper, username, password ) if ( loginErrorCode == mssql.LoginErrorType.PasswordExpired ) then passwordIsGood = true end if ( loginErrorCode == mssql.LoginErrorType.PasswordMustChange ) then passwordIsGood = true end if ( loginErrorCode == mssql.LoginErrorType.AccountLockedOut ) then - stdnse.print_debug( 1, "%s: Account %s locked out on %s", SCRIPT_NAME, username, instance:GetName() ) + stdnse.debug1("Account %s locked out on %s", username, instance:GetName() ) table.insert( instance.ms_sql_empty, string.format("'sa' account is locked out.", result ) ) end if ( mssql.LoginErrorMessage[ loginErrorCode ] == nil ) then @@ -135,7 +135,7 @@ local function process_instance( instance ) instance.ms_sql_empty = instance.ms_sql_empty or {} if not instance:HasNetworkProtocols() then - stdnse.print_debug( 1, "%s: %s has no network protocols enabled.", SCRIPT_NAME, instance:GetName() ) + stdnse.debug1("%s has no network protocols enabled.", instance:GetName() ) table.insert( instance.ms_sql_empty, "No network protocols enabled." ) end diff --git a/scripts/ms-sql-info.nse b/scripts/ms-sql-info.nse index 080feb85d..63c4c2823 100644 --- a/scripts/ms-sql-info.nse +++ b/scripts/ms-sql-info.nse @@ -201,21 +201,21 @@ local function process_instance( instance ) foundVersion, ssnetlibVersion = mssql.Helper.GetInstanceVersion( instance ) if ( foundVersion ) then instance.version = ssnetlibVersion - stdnse.print_debug( 1, "%s: Retrieved SSNetLib version for %s.", SCRIPT_NAME, instance:GetName() ) + stdnse.debug1("Retrieved SSNetLib version for %s.", instance:GetName() ) else - stdnse.print_debug( 1, "%s: Could not retrieve SSNetLib version for %s.", SCRIPT_NAME, instance:GetName() ) + stdnse.debug1("Could not retrieve SSNetLib version for %s.", instance:GetName() ) end end -- If we didn't get a version from SSNetLib, give the user some detail as to why if ( not foundVersion ) then if ( not instance:HasNetworkProtocols() ) then - stdnse.print_debug( 1, "%s: %s has no network protocols enabled.", SCRIPT_NAME, instance:GetName() ) + stdnse.debug1("%s has no network protocols enabled.", instance:GetName() ) end if ( instance.version ) then - stdnse.print_debug( 1, "%s: Using version number from SSRP response for %s.", SCRIPT_NAME, instance:GetName() ) + stdnse.debug1("Using version number from SSRP response for %s.", instance:GetName() ) else - stdnse.print_debug( 1, "%s: Version info could not be retrieved for %s.", SCRIPT_NAME, instance:GetName() ) + stdnse.debug1("Version info could not be retrieved for %s.", instance:GetName() ) end end diff --git a/scripts/oracle-brute-stealth.nse b/scripts/oracle-brute-stealth.nse index d3dd079aa..98c8bab57 100644 --- a/scripts/oracle-brute-stealth.nse +++ b/scripts/oracle-brute-stealth.nse @@ -91,11 +91,11 @@ Driver = local status, data repeat if ( tries < MAX_RETRIES ) then - stdnse.print_debug(2, "%s: Attempting to re-connect (attempt %d of %d)", SCRIPT_NAME, MAX_RETRIES - tries, MAX_RETRIES) + stdnse.debug2("Attempting to re-connect (attempt %d of %d)", MAX_RETRIES - tries, MAX_RETRIES) end status, data = self.helper:Connect() if ( not(status) ) then - stdnse.print_debug(2, "%s: ERROR: An Oracle %s error occurred", SCRIPT_NAME, data) + stdnse.debug2("ERROR: An Oracle %s error occurred", data) self.helper:Close() else break diff --git a/scripts/oracle-brute.nse b/scripts/oracle-brute.nse index e6d67979c..9cae2550b 100644 --- a/scripts/oracle-brute.nse +++ b/scripts/oracle-brute.nse @@ -107,11 +107,11 @@ Driver = local status, data repeat if ( tries < MAX_RETRIES ) then - stdnse.print_debug(2, "%s: Attempting to re-connect (attempt %d of %d)", SCRIPT_NAME, MAX_RETRIES - tries, MAX_RETRIES) + stdnse.debug2("Attempting to re-connect (attempt %d of %d)", MAX_RETRIES - tries, MAX_RETRIES) end status, data = self.helper:Connect() if ( not(status) ) then - stdnse.print_debug(2, "%s: ERROR: An Oracle %s error occurred", SCRIPT_NAME, data) + stdnse.debug2("ERROR: An Oracle %s error occurred", data) self.helper:Close() else break diff --git a/scripts/qconn-exec.nse b/scripts/qconn-exec.nse index 5d00a86cf..7d632bc1e 100644 --- a/scripts/qconn-exec.nse +++ b/scripts/qconn-exec.nse @@ -95,7 +95,7 @@ system commands as the 'root' user. end -- Parse response - stdnse.print_debug(2, "%s: Received reply:\n%s", SCRIPT_NAME, data) + stdnse.debug2("Received reply:\n%s", data) if not string.match(data, "QCONN") then stdnse.debug1("%s:%s is not a QNX QCONN daemon.", host.targetname or host.ip, port.number) return diff --git a/scripts/rpc-grind.nse b/scripts/rpc-grind.nse index d1841b2bd..beedf3241 100644 --- a/scripts/rpc-grind.nse +++ b/scripts/rpc-grind.nse @@ -212,7 +212,7 @@ local rpcGrinder = function(host, port, iterator, result) -- Otherwise, an Accept state other than Program unavailable is not normal behaviour. elseif response.accept_state ~= rpc.Portmap.AcceptState.PROG_UNAVAIL then - stdnse.print_debug("%s: returned %s accept state for %s program number.",SCRIPT_NAME, response.accept_state, number) + stdnse.debug1("returned %s accept state for %s program number.", response.accept_state, number) end end end diff --git a/scripts/ssh-hostkey.nse b/scripts/ssh-hostkey.nse index bf9911f14..6f3d8c9a6 100644 --- a/scripts/ssh-hostkey.nse +++ b/scripts/ssh-hostkey.nse @@ -174,7 +174,7 @@ local function check_keys(host, keys, f) for _,name in ipairs(possible_host_names) do local hash = base64.enc(openssl.hmac("SHA1", salt, name)) if parts_hostname[4] == hash then - stdnse.print_debug(2, "%s: found a hash that matches: %s for hostname: %s", SCRIPT_NAME, hash, name) + stdnse.debug2("found a hash that matches: %s for hostname: %s", hash, name) foundhostname = true table.insert(keys_from_file, {name=name, key=("%s %s"):format(parts[2], parts[3]), lnumber=lnumber}) end diff --git a/scripts/whois-domain.nse b/scripts/whois-domain.nse index d1de4e92a..807791de6 100644 --- a/scripts/whois-domain.nse +++ b/scripts/whois-domain.nse @@ -91,7 +91,7 @@ local table = require "table" hostrule = function( host ) local is_private, err = ipOps.isPrivate( host.ip ) if is_private == nil then - stdnse.print_debug( "%s Error in Hostrule: %s.", SCRIPT_NAME, err ) + stdnse.debug1("Error in Hostrule: %s.", err ) return false end diff --git a/scripts/whois-ip.nse b/scripts/whois-ip.nse index 7ff58a2fc..4dedfb56e 100644 --- a/scripts/whois-ip.nse +++ b/scripts/whois-ip.nse @@ -101,7 +101,7 @@ hostrule = function( host ) local is_private, err = ipOps.isPrivate( host.ip ) if is_private == nil then - stdnse.print_debug( "%s Error in Hostrule: %s.", SCRIPT_NAME, err ) + stdnse.debug1("Error in Hostrule: %s.", err ) return false end @@ -196,7 +196,7 @@ action = function( host ) status, retval = pcall( get_next_action, tracking, host.ip ) if not status then - stdnse.print_debug( "%s %s pcall caught an exception in get_next_action: %s.", SCRIPT_NAME, host.ip, retval ) + stdnse.debug1("%s pcall caught an exception in get_next_action: %s.", host.ip, retval ) else tracking = retval end if tracking.this_db then @@ -207,13 +207,13 @@ action = function( host ) -- analyse data status, retval = pcall( analyse_response, tracking, host.ip, response, data ) if not status then - stdnse.print_debug( "%s %s pcall caught an exception in analyse_response: %s.", SCRIPT_NAME, host.ip, retval ) + stdnse.debug1("%s pcall caught an exception in analyse_response: %s.", host.ip, retval ) else data = retval end -- get next action status, retval = pcall( get_next_action, tracking, host.ip ) if not status then - stdnse.print_debug( "%s %s pcall caught an exception in get_next_action: %s.", SCRIPT_NAME, host.ip, retval ) + stdnse.debug1("%s pcall caught an exception in get_next_action: %s.", host.ip, retval ) if not tracking.last_db then tracking.last_db, tracking.this_db = tracking.this_db or tracking.next_db, nil end else tracking = retval end end @@ -346,7 +346,7 @@ function check_response_cache( ip ) -- record found in cache return true, nil else - stdnse.print_debug( 1, "%s %s Error in check_response_cache: Empty Cache Entry was found.", SCRIPT_NAME, ip ) + stdnse.debug1("%s Error in check_response_cache: Empty Cache Entry was found.", ip ) end return false, nil @@ -467,7 +467,7 @@ function get_db_from_assignments( ip ) end if not nmap.registry.whois.local_assignments_data or not nmap.registry.whois.local_assignments_data[af] then - stdnse.print_debug( 1, "%s Error in get_db_from_assignments: Missing assignments data in registry.", SCRIPT_NAME ) + stdnse.debug1("Error in get_db_from_assignments: Missing assignments data in registry." ) return nil end @@ -517,7 +517,7 @@ function do_query(db, ip) local socket = nmap.new_socket() local catch = function() - stdnse.print_debug( "%s %s Connection to %s failed or was aborted! No Output for this Target.", SCRIPT_NAME, ip, db ) + stdnse.debug1("%s Connection to %s failed or was aborted! No Output for this Target.", ip, db ) nmap.registry.whois.mutex[db] "done" socket:close() end @@ -540,7 +540,7 @@ function do_query(db, ip) socket:close() - stdnse.print_debug(3, "%s %s Ended Query at %s.", SCRIPT_NAME, ip, db) + stdnse.debug3("%s Ended Query at %s.", ip, db) if #result == 0 then return nil @@ -593,13 +593,13 @@ function analyse_response( tracking, ip, response, data ) if type( meta ) == "table" and type( meta.fieldreq ) == "table" and type( meta.fieldreq.ob_exist ) == "string" then have_objects = response:match( meta.fieldreq.ob_exist ) else - stdnse.print_debug( 2, "%s %s Could not check for objects, problem with meta data.", SCRIPT_NAME, ip ) + stdnse.debug2("%s Could not check for objects, problem with meta data.", ip ) have_objects = false end -- if we do not recognize objects check for an known error/non-object message if not have_objects then - stdnse.print_debug( 4, "%s %s %s has not responded with the expected objects.", SCRIPT_NAME, ip, this_db ) + stdnse.debug4("%s %s has not responded with the expected objects.", ip, this_db ) local tmp, msg -- may have found our record saying something similar to "No Record Found" for _, pattern in ipairs( nmap.registry.whois.m_none ) do @@ -607,7 +607,7 @@ function analyse_response( tracking, ip, response, data ) local pattern_u = pattern:gsub( "$addr", ip:upper() ) msg = response:match( pattern_l ) or response:match( pattern_u ) if msg then - stdnse.print_debug( 4, "%s %s %s responded with a message which is assumed to be authoritative (but may not be).", SCRIPT_NAME, ip, this_db ) + stdnse.debug4("%s %s responded with a message which is assumed to be authoritative (but may not be).", ip, this_db ) break end end @@ -616,7 +616,7 @@ function analyse_response( tracking, ip, response, data ) for _, pattern in ipairs( nmap.registry.whois.m_err ) do msg = response:match( pattern ) if msg then - stdnse.print_debug( 4, "%s %s %s responded with an ERROR message.", SCRIPT_NAME, ip, this_db ) + stdnse.debug4("%s %s responded with an ERROR message.", ip, this_db ) break end end @@ -635,7 +635,7 @@ function analyse_response( tracking, ip, response, data ) for setname, set in pairs( nmap.registry.whois.fields_meta ) do if set ~= nmap.registry.whois.whoisdb[this_db].fieldreq and response:match(set.ob_exist) then foreign_obj = setname - stdnse.print_debug( 4, "%s %s %s seems to have responded using the set of objects named: %s.", SCRIPT_NAME, ip, this_db, foreign_obj ) + stdnse.debug4("%s %s seems to have responded using the set of objects named: %s.", ip, this_db, foreign_obj ) break end end @@ -644,7 +644,7 @@ function analyse_response( tracking, ip, response, data ) meta = nmap.registry.whois.whoisdb.ripe meta.redirects = nil have_objects = true - stdnse.print_debug( 4, "%s %s %s will use the display properties of ripe.", SCRIPT_NAME, ip, this_db ) + stdnse.debug4("%s %s will use the display properties of ripe.", ip, this_db ) elseif foreign_obj then -- find a display to match the objects. for some_db, db_props in pairs( nmap.registry.whois.whoisdb ) do @@ -653,7 +653,7 @@ function analyse_response( tracking, ip, response, data ) meta = nmap.registry.whois.whoisdb[some_db] meta.redirects = nil have_objects = true - stdnse.print_debug( 4, "%s %s %s will use the display properties of %s.", SCRIPT_NAME, ip, this_db, some_db ) + stdnse.debug4("%s %s will use the display properties of %s.", ip, this_db, some_db ) break end end @@ -662,7 +662,7 @@ function analyse_response( tracking, ip, response, data ) -- extract fields from the entire response for record/redirect discovery if have_objects then - stdnse.print_debug( 4, "%s %s Parsing Query response from %s.", SCRIPT_NAME, ip, this_db ) + stdnse.debug4("%s Parsing Query response from %s.", ip, this_db ) data[this_db] = extract_objects_from_response( response, this_db, ip, meta ) end @@ -670,7 +670,7 @@ function analyse_response( tracking, ip, response, data ) -- do record/redirect discovery, cache found redirect if not nmap.registry.whois.nofollow and have_objects and meta.redirects then - stdnse.print_debug( 4, "%s %s Testing response for redirection.", SCRIPT_NAME, ip ) + stdnse.debug4("%s Testing response for redirection.", ip ) found, nextdb, data.iana = redirection_rules( this_db, ip, data, meta ) end @@ -678,7 +678,7 @@ function analyse_response( tracking, ip, response, data ) -- modify the data table depending on whether we're redirecting or quitting if have_objects then - stdnse.print_debug( 5, "%s %s Extracting Fields from response.", SCRIPT_NAME, ip ) + stdnse.debug5("%s Extracting Fields from response.", ip ) -- optionally constrain response to a more focused area -- discarding previous extraction @@ -690,7 +690,7 @@ function analyse_response( tracking, ip, response, data ) end if offset > 1 and meta.unordered then -- fetch an object immediately in front of inetnum - stdnse.print_debug( 5, "%s %s %s Searching for an object group immediately before this range.", SCRIPT_NAME, ip, this_db ) + stdnse.debug5("%s %s Searching for an object group immediately before this range.", ip, this_db ) -- split objects from the record, up to offset. Last object should be the one we want. local obj_sel = stdnse.strsplit( "\r?\n\r?\n", response:sub( 1, offset ) ) response_chunk = "\n" .. obj_sel[#obj_sel] .. "\n" @@ -722,10 +722,10 @@ function analyse_response( tracking, ip, response, data ) end -- DEBUG - stdnse.print_debug( 6, "%s %s %s Fields captured :", SCRIPT_NAME, ip, this_db ) + stdnse.debug6("%s %s Fields captured :", ip, this_db ) for ob, t in pairs( data[this_db] ) do for fieldname, fieldvalue in pairs( t ) do - stdnse.print_debug( 6, "%s %s %s %s.%s %s.", SCRIPT_NAME, ip, this_db, ob, fieldname, fieldvalue ) + stdnse.debug6("%s %s %s.%s %s.", ip, this_db, ob, fieldname, fieldvalue ) end end @@ -820,15 +820,15 @@ function extract_objects_from_response( response_string, db, ip, meta, specific_ -- we either receive a table for one object or for all objects if type( specific_object ) == "string" and meta.fieldreq[specific_object] then objects_to_extract[specific_object] = meta.fieldreq[specific_object] - stdnse.print_debug( 5, "%s %s Extracting a single object: %s.", SCRIPT_NAME, ip, specific_object ) + stdnse.debug5("%s Extracting a single object: %s.", ip, specific_object ) else - stdnse.print_debug( 5, "%s %s Extracting all objects.", SCRIPT_NAME, ip ) + stdnse.debug5("%s Extracting all objects.", ip ) objects_to_extract = meta.fieldreq end for object_name, object in pairs( objects_to_extract ) do if object_name and object_name ~= "ob_exist" then - stdnse.print_debug(5, "%s %s Seeking object group: %s.", SCRIPT_NAME, ip, object_name) + stdnse.debug5("%s Seeking object group: %s.", ip, object_name) extracted_objects[object_name] = {} extracted_objects[object_name].for_compare = {} -- this will allow us to compare two tables -- get a substr of response_string that corresponds to a single object @@ -837,7 +837,7 @@ function extract_objects_from_response( response_string, db, ip, meta, specific_ -- if we could not find the end, make the end EOF ob_end = ob_end or -1 if ob_start and ob_end then - stdnse.print_debug(5, "%s %s Capturing: %s with indices %s and %s.", SCRIPT_NAME, ip, object_name, ob_start, ob_end ) + stdnse.debug5("%s Capturing: %s with indices %s and %s.", ip, object_name, ob_start, ob_end ) local obj_string = response_string:sub( ob_start, ob_end ) for fieldname, pattern in pairs( object ) do if fieldname ~= "ob_start" and fieldname ~= "ob_end" then @@ -910,19 +910,19 @@ function redirection_rules( db, ip, data, meta ) -- arin record points to iana so we won't follow and we assume we have our record if directed_to == iana and directed_from == arin then - stdnse.print_debug( 4, "%s %s %s Accept arin record (matched IANA).", SCRIPT_NAME, ip, directed_from ) + stdnse.debug4("%s %s Accept arin record (matched IANA).", ip, directed_from ) return true, nil, ( icnt+1 ) end -- non-arin record points to iana so we query arin next if directed_to == iana then - stdnse.print_debug( 4, "%s %s Redirecting to arin (matched IANA).", SCRIPT_NAME, ip ) + stdnse.debug4("%s Redirecting to arin (matched IANA).", ip ) return false, arin, ( icnt+1 ) end -- a redirect, but not to iana or to self, so we follow it. if directed_to ~= nmap.registry.whois.whoisdb[directed_from].id then - stdnse.print_debug( 4, "%s %s %s redirects us to %s.", SCRIPT_NAME, ip, directed_from, directed_to ) + stdnse.debug4("%s %s redirects us to %s.", ip, directed_from, directed_to ) return false, directed_to, icnt end @@ -938,14 +938,14 @@ function redirection_rules( db, ip, data, meta ) -- if a field has been captured for the given redirect info if data[db][obj] and data[db][obj][fld] then - stdnse.print_debug( 5, "%s %s Seek redirect in object: %s.%s for %s.", SCRIPT_NAME, ip, obj, fld, pattern ) + stdnse.debug5("%s Seek redirect in object: %s.%s for %s.", ip, obj, fld, pattern ) -- iterate over nmap.registry.whois.whoisdb to find pattern (from each service) in the designated field for member, mem_properties in pairs( nmap.registry.whois.whoisdb ) do -- if pattern if found in the field, we have a redirect to member if type( mem_properties[pattern] ) == "string" and string.lower( data[db][obj][fld] ):match( mem_properties[pattern] ) then - stdnse.print_debug( 5, "%s %s Matched %s in %s.%s.", SCRIPT_NAME, ip, pattern, obj, fld ) + stdnse.debug5("%s Matched %s in %s.%s.", ip, pattern, obj, fld ) return redirection_validation( nmap.registry.whois.whoisdb[member].id, db, iana_count ) elseif type( mem_properties[pattern] ) == "table" then @@ -953,7 +953,7 @@ function redirection_rules( db, ip, data, meta ) -- pattern is an array of patterns for _, pattn in ipairs( mem_properties[pattern] ) do if type( pattn ) == "string" and string.lower( data[db][obj][fld] ):match( pattn ) then - stdnse.print_debug( 5, "%s %s Matched %s in %s.%s.", SCRIPT_NAME, ip, pattern, obj, fld ) + stdnse.debug5("%s Matched %s in %s.%s.", ip, pattern, obj, fld ) return redirection_validation( nmap.registry.whois.whoisdb[member].id, db, iana_count ) end end @@ -1007,7 +1007,7 @@ function constrain_response( response, db, ip, meta ) if # mptr > 1 then -- find the closest one to host.ip and constrain the response to it - stdnse.print_debug( 5, "%s %s %s Focusing on the smallest of %s address ranges.", SCRIPT_NAME, ip, db, #mptr ) + stdnse.debug5("%s %s Focusing on the smallest of %s address ranges.", ip, db, #mptr ) -- sort the table mptr into nets ascending table.sort( mptr, smallest_range ) -- select the first net that includes host.ip @@ -1025,7 +1025,7 @@ function constrain_response( response, db, ip, meta ) if mptr[index+1] and ( mptr[index+1].pointer > mptr[index].pointer ) then bound = mptr[index+1].pointer end - stdnse.print_debug(5, "%s %s %s Smallest range containing target IP addr. is %s.", SCRIPT_NAME, ip, db, trim( str_net ) ) + stdnse.debug5("%s %s Smallest range containing target IP addr. is %s.", ip, db, trim( str_net ) ) local dbg = "%s %s %s smallest range is offset from %s to %s." -- isolate inetnum and associated objects if bound then @@ -1075,7 +1075,7 @@ function not_short_prefix( ip, range, redirect ) first, last, err[#err+1] = ipOps.get_ips_from_range( range ) if #err > 0 then - stdnse.print_debug( 1, "%s Error in not_short_prefix: s%.", SCRIPT_NAME, table.concat( err, " " ) ) + stdnse.debug1("Error in not_short_prefix: s%.", table.concat( err, " " ) ) return nil end @@ -1119,7 +1119,7 @@ function add_to_cache( ip, range, redirect, data ) -- we need to cache some range so we'll cache the small assignment that includes ip. if type( range ) ~= "string" or type( get_prefix_length( range ) ) ~= "number" then range = get_assignment( ip, longest_prefix ) - stdnse.print_debug(5, "%s %s Caching an assumed Range: %s", SCRIPT_NAME, ip, range) + stdnse.debug5("%s Caching an assumed Range: %s", ip, range) end nmap.registry.whois.cache[ip] = {} -- destroy any previous cache entry for this target. @@ -1212,13 +1212,13 @@ function output( ip, services_queried ) end if type( services_queried ) ~= "table" then - stdnse.print_debug( "%s %s Error in output(): No data found.", SCRIPT_NAME, ip ) + stdnse.debug1("%s Error in output(): No data found.", ip ) return nil elseif #services_queried == 0 then - stdnse.print_debug( "%s %s Error in output(): No data found, no queries were completed.", SCRIPT_NAME, ip ) + stdnse.debug1("%s Error in output(): No data found, no queries were completed.", ip ) return nil elseif #services_queried > 0 then - stdnse.print_debug( "%s %s Error in output(): No data found - could not understand query responses.", SCRIPT_NAME, ip ) + stdnse.debug1("%s Error in output(): No data found - could not understand query responses.", ip ) return nil end @@ -1239,7 +1239,7 @@ function get_output_from_cache( ip ) local ip_key = get_cache_key( ip ) if not ip_key then - stdnse.print_debug( 1, "%s %s Error in get_output_from_cache().", SCRIPT_NAME, ip ) + stdnse.debug1("%s Error in get_output_from_cache().", ip ) return nil end @@ -1707,7 +1707,7 @@ function get_args() nmap.registry.whois.using_cache = false elseif ( db == "nofile" ) then nmap.registry.whois.using_local_assignments_file = false - stdnse.print_debug( 2, "%s: Not using local assignments data.", SCRIPT_NAME ) + stdnse.debug2("Not using local assignments data." ) end elseif not ( string.match( table.concat( t, " " ), db ) ) then -- we have a unique valid whois db @@ -1718,18 +1718,18 @@ function get_args() if ( #t > 0 ) and nmap.registry.whois.using_local_assignments_file then -- "nofile" was not explicitly supplied, but it is implied by supplying custom whoisdb_default_order nmap.registry.whois.using_local_assignments_file = false - stdnse.print_debug(3, "%s: Not using local assignments data because custom whoisdb_default_order was supplied.", SCRIPT_NAME) + stdnse.debug3("Not using local assignments data because custom whoisdb_default_order was supplied.") end if ( #t > 1 ) and nmap.registry.whois.nofollow then -- using nofollow, we do not follow redirects and can only accept what we find as a record therefore we only accept the first db supplied t = {t[1]} - stdnse.print_debug( 1, "%s: Too many args supplied with 'nofollow', only using %s.", SCRIPT_NAME, t[1] ) + stdnse.debug1("Too many args supplied with 'nofollow', only using %s.", t[1] ) end if ( #t > 0 ) then nmap.registry.whois.whoisdb_default_order = t - stdnse.print_debug( 2, "%s: whoisdb_default_order: %s.", SCRIPT_NAME, table.concat( t, " " ) ) + stdnse.debug2("whoisdb_default_order: %s.", table.concat( t, " " ) ) end end @@ -1758,7 +1758,7 @@ function get_local_assignments_data() local fetchfile = "nmap-services" local directory_path, err = get_parentpath( fetchfile ) if err then - stdnse.print_debug( 1, "%s: Nmap.fetchfile() failed to get a path to %s: %s.", SCRIPT_NAME, fetchfile, err ) + stdnse.debug1("Nmap.fetchfile() failed to get a path to %s: %s.", fetchfile, err ) return nil, err end @@ -1774,10 +1774,10 @@ function get_local_assignments_data() local file, exists = directory_path .. assignment_data_spec.local_resource exists, err = file_exists( file ) if not exists and err then - stdnse.print_debug( 1, "%s: Error accessing %s: %s.", SCRIPT_NAME, file, err ) + stdnse.debug1("Error accessing %s: %s.", file, err ) elseif not exists then update_required = true - stdnse.print_debug( 2, "%s: %s does not exist or is empty. Fetching it now...", SCRIPT_NAME, file ) + stdnse.debug2("%s does not exist or is empty. Fetching it now...", file ) elseif exists then update_required, modified_date, entity_tag = requires_updating( file ) end @@ -1786,7 +1786,7 @@ function get_local_assignments_data() -- read an existing and up-to-date file into file_content. if exists and not update_required then - stdnse.print_debug( 2, "%s: %s was cached less than %s ago. Reading...", SCRIPT_NAME, file, nmap.registry.whois.local_assignments_file_expiry ) + stdnse.debug2("%s was cached less than %s ago. Reading...", file, nmap.registry.whois.local_assignments_file_expiry ) file_content = read_from_file( file ) end @@ -1795,10 +1795,10 @@ function get_local_assignments_data() if update_required then http_response = ( conditional_download( assignment_data_spec.remote_resource, modified_date, entity_tag ) ) if not http_response or type( http_response.status ) ~= "number" then - stdnse.print_debug( 1, "%s: Failed whilst requesting %s.", SCRIPT_NAME, assignment_data_spec.remote_resource ) + stdnse.debug1("Failed whilst requesting %s.", assignment_data_spec.remote_resource ) elseif http_response.status == 200 then -- prepend our file header - stdnse.print_debug( 2, "%s: Retrieved %s.", SCRIPT_NAME, assignment_data_spec.remote_resource ) + stdnse.debug2("Retrieved %s.", assignment_data_spec.remote_resource ) file_content = stdnse.strsplit( "\r?\n", http_response.body ) table.insert( file_content, 1, "** Do Not Alter This Line or The Following Line **" ) local hline = {} @@ -1810,19 +1810,19 @@ function get_local_assignments_data() table.insert( file_content, 2, table.concat( hline ) ) write_success, err = write_to_file( file, file_content ) if err then - stdnse.print_debug( 1, "%s: Error writing %s to %s: %s.", SCRIPT_NAME, assignment_data_spec.remote_resource, file, err ) + stdnse.debug1("Error writing %s to %s: %s.", assignment_data_spec.remote_resource, file, err ) end elseif http_response.status == 304 then -- update our file header with a new timestamp - stdnse.print_debug( 1, "%s: %s is up-to-date.", SCRIPT_NAME, file ) + stdnse.debug1("%s is up-to-date.", file ) file_content = read_from_file( file ) file_content[2] = file_content[2]:gsub("^<[-+]?%d+>(.*)$", "<" .. os.time() .. ">%1") write_success, err = write_to_file( file, file_content ) if err then - stdnse.print_debug( 1, "%s: Error writing to %s: %s.", SCRIPT_NAME, file, err ) + stdnse.debug1("Error writing to %s: %s.", file, err ) end else - stdnse.print_debug( 1, "%s: HTTP %s whilst requesting %s.", SCRIPT_NAME, http_response.status, assignment_data_spec.remote_resource ) + stdnse.debug1("HTTP %s whilst requesting %s.", http_response.status, assignment_data_spec.remote_resource ) end end @@ -1836,7 +1836,7 @@ function get_local_assignments_data() if #t == 0 or err then -- good header, but bad file? Kill the file! write_to_file( file, "" ) - stdnse.print_debug( 1, "%s: Problem with the data in %s.", SCRIPT_NAME, file ) + stdnse.debug1("Problem with the data in %s.", file ) else for i, v in pairs( t ) do ret[address_family][#ret[address_family]+1] = v @@ -1855,7 +1855,7 @@ function get_local_assignments_data() for af, t in pairs( ret ) do if #t == 0 then ret[af] = nil - stdnse.print_debug( 1, "%s: Cannot use local assignments file for address family %s.", SCRIPT_NAME, af ) + stdnse.debug1("Cannot use local assignments file for address family %s.", af ) end end @@ -1979,7 +1979,7 @@ function read_from_file( file ) local f, err, _ = io.open( file, "r" ) if not f then - stdnse.print_debug( 1, "%s: Error opening %s for reading: %s", SCRIPT_NAME, file, err ) + stdnse.debug1("Error opening %s for reading: %s", file, err ) return nil, err end @@ -2039,7 +2039,7 @@ function conditional_download( url, mod_date, e_tag ) and ( tostring( request_response.status ):match( "30%d" ) and type( request_response.header.location ) == "string" and request_response.header.location ~= "" ) then - stdnse.print_debug( 2, "%s: HTTP Status:%d New Location: %s.", SCRIPT_NAME, request_response.status, request_response.header.location ) + stdnse.debug2("HTTP Status:%d New Location: %s.", request_response.status, request_response.header.location ) request_response = http.get_url( request_response.header.location, request_options ) end @@ -2068,7 +2068,7 @@ function write_to_file( file, content ) local f, err, _ = io.open( file, "w" ) if not f then - stdnse.print_debug( 1, "%s: Error opening %s for writing: %s.", SCRIPT_NAME, file, err ) + stdnse.debug1("Error opening %s for writing: %s.", file, err ) return nil, err end diff --git a/scripts/xmpp-info.nse b/scripts/xmpp-info.nse index 23b3fb0a5..bdb7f6a6a 100644 --- a/scripts/xmpp-info.nse +++ b/scripts/xmpp-info.nse @@ -202,15 +202,15 @@ local id_database = { local receive_tag = function(conn) local status, data = conn:receive_buf(">", true) - if data then stdnse.print_debug(2, "%s: %s", SCRIPT_NAME, data) end + if data then stdnse.debug2("%s", data) end return status and xmpp.XML.parse_tag(data) end local log_tag = function(tag) - stdnse.print_debug(2, "%s: %s", SCRIPT_NAME, "name=" .. tag.name) - stdnse.print_debug(2, "%s: %s", SCRIPT_NAME, "finish=" .. tostring(tag.finish)) - stdnse.print_debug(2, "%s: %s", SCRIPT_NAME, "empty=" .. tostring(tag.empty)) - stdnse.print_debug(2, "%s: %s", SCRIPT_NAME, "contents=" .. tag.contents) + stdnse.debug2("%s", "name=" .. tag.name) + stdnse.debug2("%s", "finish=" .. tostring(tag.finish)) + stdnse.debug2("%s", "empty=" .. tostring(tag.empty)) + stdnse.debug2("%s", "contents=" .. tag.contents) end local make_request = function(server_name, xmlns) @@ -542,7 +542,7 @@ action = function(host, port) local tls_result local starttls_failed - stdnse.print_debug(2, "%s: %s", SCRIPT_NAME, "server = " .. server_name) + stdnse.debug2("%s", "server = " .. server_name) local altname_result = scan(host, port, alt_server_name, false)