diff --git a/scripts/broadcast-ataoe-discover.nse b/scripts/broadcast-ataoe-discover.nse index 86e87a582..794ffdf38 100644 --- a/scripts/broadcast-ataoe-discover.nse +++ b/scripts/broadcast-ataoe-discover.nse @@ -131,12 +131,12 @@ action = function() local iname = nmap.get_interface() if ( not(iname) ) then - stdnse.print_debug("%s: No interface supplied, use -e", SCRIPT_NAME) + stdnse.debug1("No interface supplied, use -e") return end if ( not(nmap.is_privileged()) ) then - stdnse.print_debug("%s: not running for lack of privileges", SCRIPT_NAME) + stdnse.debug1("not running for lack of privileges") return end diff --git a/scripts/broadcast-eigrp-discovery.nse b/scripts/broadcast-eigrp-discovery.nse index eab97d9aa..a343b5c9e 100644 --- a/scripts/broadcast-eigrp-discovery.nse +++ b/scripts/broadcast-eigrp-discovery.nse @@ -224,7 +224,7 @@ action = function() return ("\n ERROR: Failed to retrieve %s interface information."):format(interface) end interfaces = {interface} - stdnse.print_debug("%s: Will use %s interface.", SCRIPT_NAME, interface.shortname) + stdnse.debug1("Will use %s interface.", interface.shortname) else local ifacelist = nmap.list_interfaces() for _, iface in ipairs(ifacelist) do @@ -232,7 +232,7 @@ action = function() if iface.address and iface.link=="ethernet" and iface.address:match("%d+%.%d+%.%d+%.%d+") then - stdnse.print_debug("%s: Will use %s interface.", SCRIPT_NAME, iface.shortname) + stdnse.debug1("Will use %s interface.", iface.shortname) table.insert(interfaces, iface) end end @@ -243,7 +243,7 @@ action = function() if not as then -- We use a table for condvar local astab = {} - stdnse.print_debug("%s: No A.S value provided, will sniff for one.", SCRIPT_NAME) + stdnse.debug1("No A.S value provided, will sniff for one.") -- We should iterate over interfaces for _, interface in pairs(interfaces) do local co = stdnse.new_thread(asListener, interface, timeout, astab) diff --git a/scripts/broadcast-igmp-discovery.nse b/scripts/broadcast-igmp-discovery.nse index b4a4a9001..6bc1d9c7a 100644 --- a/scripts/broadcast-igmp-discovery.nse +++ b/scripts/broadcast-igmp-discovery.nse @@ -302,14 +302,14 @@ local mgroup_names_fetch = function(filename) end local mgroup_name_identify = function(db, ip) - --stdnse.print_debug("%s: '%s'", SCRIPT_NAME, ip) + --stdnse.debug1("'%s'", ip) for _, mg in ipairs(db) do local ip1 = mg[1] local ip2 = mg[2] local desc = mg[3] - --stdnse.print_debug("%s: try: %s <= %s <= %s (%s)", SCRIPT_NAME, ip1, ip, ip2, desc) + --stdnse.debug1("try: %s <= %s <= %s (%s)", ip1, ip, ip2, desc) if (not ipOps.compare_ip(ip, "lt", ip1) and not ipOps.compare_ip(ip2, "lt", ip)) then - --stdnse.print_debug("%s: found! %s <= %s <= %s (%s)", SCRIPT_NAME, ip1, ip, ip2, desc) + --stdnse.debug1("found! %s <= %s <= %s (%s)", ip1, ip, ip2, desc) return desc end end @@ -341,7 +341,7 @@ action = function(host, port) return ("ERROR: Failed to retrieve %s interface information."):format(interface) end interfaces = {interface} - stdnse.print_debug("%s: Will use %s interface.", SCRIPT_NAME, interface.shortname) + stdnse.debug1("Will use %s interface.", interface.shortname) else local ifacelist = nmap.list_interfaces() for _, iface in ipairs(ifacelist) do @@ -349,7 +349,7 @@ action = function(host, port) if iface.address and iface.link=="ethernet" and iface.address:match("%d+%.%d+%.%d+%.%d+") then - stdnse.print_debug("%s: Will use %s interface.", SCRIPT_NAME, iface.shortname) + stdnse.debug1("Will use %s interface.", iface.shortname) table.insert(interfaces, iface) end end diff --git a/scripts/broadcast-listener.nse b/scripts/broadcast-listener.nse index 68a60daa3..7d814f8f4 100644 --- a/scripts/broadcast-listener.nse +++ b/scripts/broadcast-listener.nse @@ -111,7 +111,7 @@ loadDecoders = function(fname) local env = setmetatable({Decoders = {}}, {__index = _G}); local file = loadfile(abs_fname, "t", env) if(not(file)) then - stdnse.print_debug("%s: Couldn't load decoder file: %s", SCRIPT_NAME, fname) + stdnse.debug1("Couldn't load decoder file: %s", fname) return false, "ERROR: Couldn't load decoder file: " .. fname end diff --git a/scripts/broadcast-pim-discovery.nse b/scripts/broadcast-pim-discovery.nse index cc5abc9fc..c28660613 100644 --- a/scripts/broadcast-pim-discovery.nse +++ b/scripts/broadcast-pim-discovery.nse @@ -167,7 +167,7 @@ action = function() return ("\n ERROR: Couldn't get interface for %s"):format(mcast) end - stdnse.print_debug("%s: will send via %s interface.", SCRIPT_NAME, interface.shortname) + stdnse.debug1("will send via %s interface.", interface.shortname) -- Launch listener stdnse.new_thread(helloListen, interface, timeout, responses) diff --git a/scripts/eppc-enum-processes.nse b/scripts/eppc-enum-processes.nse index 501c6a52b..2d1e3bbd1 100644 --- a/scripts/eppc-enum-processes.nse +++ b/scripts/eppc-enum-processes.nse @@ -45,7 +45,7 @@ action = function( host, port ) local try = nmap.new_try( function() - stdnse.print_debug("%s: failed", SCRIPT_NAME) + stdnse.debug1("failed") socket:close() end ) diff --git a/scripts/http-backup-finder.nse b/scripts/http-backup-finder.nse index 028241db9..f99f91056 100644 --- a/scripts/http-backup-finder.nse +++ b/scripts/http-backup-finder.nse @@ -89,7 +89,7 @@ action = function(host, port) local res, res404, known404 = http.identify_404(host, port) if not res then - stdnse.print_debug("%s: Can't identify 404 pages", SCRIPT_NAME) + stdnse.debug1("Can't identify 404 pages") return nil end diff --git a/scripts/http-git.nse b/scripts/http-git.nse index 975b703ff..02fadc086 100644 --- a/scripts/http-git.nse +++ b/scripts/http-git.nse @@ -125,7 +125,7 @@ function action(host, port) -- Do the requests. replies = http.pipeline_go(host, port, pl_requests) if replies == nil then - stdnse.print_debug("%s: pipeline_go() error. Aborting.", SCRIPT_NAME) + stdnse.debug1("pipeline_go() error. Aborting.") return nil end diff --git a/scripts/ip-geolocation-geobytes.nse b/scripts/ip-geolocation-geobytes.nse index e1c1b6739..f4b13229a 100644 --- a/scripts/ip-geolocation-geobytes.nse +++ b/scripts/ip-geolocation-geobytes.nse @@ -52,7 +52,7 @@ end -- made so no more requests are made to the server during one scan action = function(host) if nmap.registry["ip-geolocation-geobytes"] and nmap.registry["ip-geolocation-geobytes"].blocked then - stdnse.print_debug("%s: 20 requests per hour Limit Exceeded", SCRIPT_NAME) + stdnse.debug1("20 requests per hour Limit Exceeded") return nil end local response = http.get("www.geobytes.com", 80, "/IpLocator.htm?GetLocation&template=json.txt&IpAddress="..host.ip, nil) @@ -63,7 +63,7 @@ action = function(host) if loc.city and loc.city == "Limit Exceeded" then if not nmap.registry["ip-geolocation-geobytes"] then nmap.registry["ip-geolocation-geobytes"]={} end nmap.registry["ip-geolocation-geobytes"].blocked = true - stdnse.print_debug("%s: 20 requests per hour Limit Exceeded", SCRIPT_NAME) + stdnse.debug1("20 requests per hour Limit Exceeded") return nil end -- Process output @@ -80,7 +80,7 @@ action = function(host) elseif response.body:match("Limit Exceeded") then if not nmap.registry["ip-geolocation-geobytes"] then nmap.registry["ip-geolocation-geobytes"]={} end nmap.registry["ip-geolocation-geobytes"].blocked = true - stdnse.print_debug("%s: 20 requests per hour Limit Exceeded", SCRIPT_NAME) + stdnse.debug1("20 requests per hour Limit Exceeded") return nil end return nil diff --git a/scripts/iscsi-info.nse b/scripts/iscsi-info.nse index 54d1f32d8..d98d1dbb1 100644 --- a/scripts/iscsi-info.nse +++ b/scripts/iscsi-info.nse @@ -63,14 +63,14 @@ action = function( host, port ) local status = helper:connect() if ( not(status) ) then - stdnse.print_debug("%s: failed to connect to server", SCRIPT_NAME ) + stdnse.debug1("failed to connect to server" ) return end local records status, records = helper:discoverTargets() if ( not(status) ) then - stdnse.print_debug("%s: failed to discover targets", SCRIPT_NAME ) + stdnse.debug1("failed to discover targets" ) return end status = helper:logout() diff --git a/scripts/llmnr-resolve.nse b/scripts/llmnr-resolve.nse index 0f4d46813..dd952bc3c 100644 --- a/scripts/llmnr-resolve.nse +++ b/scripts/llmnr-resolve.nse @@ -74,7 +74,7 @@ local llmnrSend = function(query, mcast, mport) local sock = nmap.new_socket() local status, err = sock:connect(mcast, mport, "udp") if not status then - stdnse.print_debug("%s: %s", SCRIPT_NAME, err) + stdnse.debug1("%s", err) return end sock:send(query) diff --git a/scripts/mrinfo.nse b/scripts/mrinfo.nse index 1bbdf8c6b..369f4b72b 100644 --- a/scripts/mrinfo.nse +++ b/scripts/mrinfo.nse @@ -258,7 +258,7 @@ action = function() return ("\n ERROR: Couldn't get interface for %s"):format(target) end - stdnse.print_debug("%s: will send to %s via %s interface.", SCRIPT_NAME, target, interface.shortname) + stdnse.debug1("will send to %s via %s interface.", target, interface.shortname) -- Thread that listens for responses stdnse.new_thread(mrinfoListen, interface, timeout, responses) diff --git a/scripts/mtrace.nse b/scripts/mtrace.nse index 9bca98bf0..e19c51d29 100644 --- a/scripts/mtrace.nse +++ b/scripts/mtrace.nse @@ -348,8 +348,8 @@ action = function() -- Destination defaults to our own host toip = toip or interface.address - stdnse.print_debug("%s: Traceroute group %s from %s to %s.", SCRIPT_NAME, group, fromip, toip) - stdnse.print_debug("%s: will send to %s via %s interface.", SCRIPT_NAME, firsthop, interface.shortname) + stdnse.debug1("Traceroute group %s from %s to %s.", group, fromip, toip) + stdnse.debug1("will send to %s via %s interface.", firsthop, interface.shortname) -- Thread that listens for responses stdnse.new_thread(traceListener, interface, timeout, responses) diff --git a/scripts/mysql-info.nse b/scripts/mysql-info.nse index ebe802903..bf4ff08a5 100644 --- a/scripts/mysql-info.nse +++ b/scripts/mysql-info.nse @@ -80,14 +80,14 @@ action = function(host, port) local status, err = socket:connect(host, port) if not status then - stdnse.print_debug("%s: error connecting: %s", SCRIPT_NAME, err) + stdnse.debug1("error connecting: %s", err) return nil end local status, info = mysql.receiveGreeting(socket) if not status then - stdnse.print_debug("%s: MySQL error: %s", SCRIPT_NAME, info) + stdnse.debug1("MySQL error: %s", info) output["MySQL Error"] = info if nmap.verbosity() > 1 then return output diff --git a/scripts/omp2-enum-targets.nse b/scripts/omp2-enum-targets.nse index 188749808..0dbdc30c6 100644 --- a/scripts/omp2-enum-targets.nse +++ b/scripts/omp2-enum-targets.nse @@ -59,14 +59,14 @@ local function account_enum_targets(host, port, username, password) local status, err = session:connect(host, port) if not status then - stdnse.print_debug("%s: connection failure (%s)", SCRIPT_NAME, err) + stdnse.debug1("connection failure (%s)", err) return nil end if session:authenticate(username, password) then targets = session:ls_targets() else - stdnse.print_debug("%s: authentication failure (%s:%s)", SCRIPT_NAME, username, password) + stdnse.debug1("authentication failure (%s:%s)", username, password) end session:close() @@ -115,7 +115,7 @@ action = function(host, port) end if target.ALLOW_NEW_TARGETS and targets ~= nil then - stdnse.print_debug("%s: adding new targets %s", SCRIPT_NAME, stdnse.strjoin(", ", targets)) + stdnse.debug1("adding new targets %s", stdnse.strjoin(", ", targets)) target.add(table.unpack(targets)) end diff --git a/scripts/rpc-grind.nse b/scripts/rpc-grind.nse index 2cd967a0f..7a68f1c36 100644 --- a/scripts/rpc-grind.nse +++ b/scripts/rpc-grind.nse @@ -78,7 +78,7 @@ local isRPC = function(host, port) rpcConn = rpc.Comm:new("rpcbind", 2) status, err = rpcConn:Connect(host, port) if not status then - stdnse.print_debug("%s: %s", SCRIPT_NAME, err) + stdnse.debug1("%s", err) return end @@ -94,7 +94,7 @@ local isRPC = function(host, port) -- And check response status, data = rpcConn:ReceivePacket() if not status then - stdnse.print_debug("%s: isRPC didn't receive response.", SCRIPT_NAME) + stdnse.debug1("isRPC didn't receive response.") return else -- If we got response, set port to open @@ -110,7 +110,7 @@ local isRPC = function(host, port) end end end - stdnse.print_debug("%s: RPC checking function response data is not RPC.", SCRIPT_NAME) + stdnse.debug1("RPC checking function response data is not RPC.") end -- Function that iterates over the nmap-rpc file and @@ -121,14 +121,14 @@ local rpcIterator = function() -- Check if nmap-rpc file is present. local path = nmap.fetchfile("nmap-rpc") if not path then - stdnse.print_debug("%s: Could not find nmap-rpc file.", SCRIPT_NAME) + stdnse.debug1("Could not find nmap-rpc file.") return false end -- And is readable local nmaprpc, _, _ = io.open( path, "r" ) if not nmaprpc then - stdnse.print_debug("%s: Could not open nmap-rpc for reading.", SCRIPT_NAME) + stdnse.debug1("Could not open nmap-rpc for reading.") return false end @@ -199,7 +199,7 @@ local rpcGrinder = function(host, port, iterator, result) if type(response) == 'table' then if xid ~= response.xid then -- Shouldn't happen. - stdnse.print_debug("%s: XID mismatch.", SCRIPT_NAME) + stdnse.debug1("XID mismatch.") end -- Look at accept state -- Not supported version means that we used the right program number diff --git a/scripts/ssl-ccs-injection.nse b/scripts/ssl-ccs-injection.nse index d595f3d16..21b5851b8 100644 --- a/scripts/ssl-ccs-injection.nse +++ b/scripts/ssl-ccs-injection.nse @@ -176,7 +176,7 @@ local function test_ccs_injection(host, port, version) local record i, record = tls.record_read(response, i) if record == nil then - stdnse.print_debug("%s: Unknown response from server", SCRIPT_NAME) + stdnse.debug1("Unknown response from server") s:close() return "NOT_VULNERABLE" elseif record.protocol ~= version then diff --git a/scripts/ssl-date.nse b/scripts/ssl-date.nse index 48a70d4f4..c6d32c950 100644 --- a/scripts/ssl-date.nse +++ b/scripts/ssl-date.nse @@ -109,7 +109,7 @@ end local extract_time = function(response) local i, record = tls.record_read(response, 0) if record == nil then - stdnse.print_debug("%s: Unknown response from server", SCRIPT_NAME) + stdnse.debug1("Unknown response from server") return nil end @@ -120,7 +120,7 @@ local extract_time = function(response) end end end - stdnse.print_debug("%s: Server response was not server_hello", SCRIPT_NAME) + stdnse.debug1("Server response was not server_hello") return nil end diff --git a/scripts/ssl-heartbleed.nse b/scripts/ssl-heartbleed.nse index 1c48a3cc6..51f8bfd9a 100644 --- a/scripts/ssl-heartbleed.nse +++ b/scripts/ssl-heartbleed.nse @@ -153,11 +153,11 @@ local function testversion(host, port, version) local record i, record = tls.record_read(response, i) if record == nil then - stdnse.print_debug("%s: Unknown response from server", SCRIPT_NAME) + stdnse.debug1("Unknown response from server") s:close() return nil elseif record.protocol ~= version then - stdnse.print_debug("%s: Protocol version mismatch", SCRIPT_NAME) + stdnse.debug1("Protocol version mismatch") s:close() return nil end @@ -176,7 +176,7 @@ local function testversion(host, port, version) end until done if not supported then - stdnse.print_debug("%s: Server does not support TLS Heartbeat Requests.", SCRIPT_NAME) + stdnse.debug1("Server does not support TLS Heartbeat Requests.") s:close() return nil end diff --git a/scripts/sstp-discover.nse b/scripts/sstp-discover.nse index 9a1cedb11..fae3a110d 100644 --- a/scripts/sstp-discover.nse +++ b/scripts/sstp-discover.nse @@ -68,7 +68,7 @@ action = function(host, port) string.format(request, host.targetname or host.ip), { timeout=3000, lines=4 }) if not socket then - stdnse.print_debug("%s: Problem establishing connection: %s", SCRIPT_NAME, response) + stdnse.debug1("Problem establishing connection: %s", response) return nil end socket:close() diff --git a/scripts/tls-nextprotoneg.nse b/scripts/tls-nextprotoneg.nse index 197adca17..a6237a9f5 100644 --- a/scripts/tls-nextprotoneg.nse +++ b/scripts/tls-nextprotoneg.nse @@ -102,19 +102,19 @@ end local check_npn = function(response) local i, record = tls.record_read(response, 0) if record == nil then - stdnse.print_debug("%s: Unknown response from server", SCRIPT_NAME) + stdnse.debug1("Unknown response from server") return nil end if record.type == "handshake" and record.body[1].type == "server_hello" then if record.body[1].extensions == nil then - stdnse.print_debug("%s: Server does not support TLS NPN extension.", SCRIPT_NAME) + stdnse.debug1("Server does not support TLS NPN extension.") return nil end local results = {} local npndata = record.body[1].extensions["next_protocol_negotiation"] if npndata == nil then - stdnse.print_debug("%s: Server does not support TLS NPN extension.", SCRIPT_NAME) + stdnse.debug1("Server does not support TLS NPN extension.") return nil end -- Parse data @@ -127,7 +127,7 @@ local check_npn = function(response) return results else - stdnse.print_debug("%s: Server response was not server_hello", SCRIPT_NAME) + stdnse.debug1("Server response was not server_hello") return nil end end