mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Replace print() calls with stdnse.print_debug()
NSE scripts should not send data to stdout with print(). One exception was not altered: url-snarf states in its documentation that urls are sent to stdout by default, with a script-arg option to save to a file instead.
This commit is contained in:
@@ -209,7 +209,7 @@ action = function()
|
||||
|
||||
local result = {}
|
||||
for ip, resp in pairs(responses) do
|
||||
print(ip, resp)
|
||||
stdnse.print_debug(ip, resp)
|
||||
table.insert(result, { name = ip, parse_response(resp) } )
|
||||
end
|
||||
return stdnse.format_output(true, result)
|
||||
|
||||
@@ -78,7 +78,7 @@ function verify_password( host, port, username, password, domain )
|
||||
account.valid = false
|
||||
account.message = "Unspecified"
|
||||
else
|
||||
print("UNKNOWN response: " .. response)
|
||||
stdnse.print_debug("UNKNOWN response: " .. response)
|
||||
account.valid = false
|
||||
account.message = "failed"
|
||||
end
|
||||
|
||||
@@ -248,7 +248,7 @@ action = function(host)
|
||||
end
|
||||
file:close()
|
||||
else
|
||||
print("dns-brute: Hostlist file not found. Will use default list.")
|
||||
stdnse.print_debug("dns-brute: Hostlist file not found. Will use default list.")
|
||||
end
|
||||
end
|
||||
if (not hostlist) then hostlist = HOST_LIST end
|
||||
|
||||
@@ -96,7 +96,7 @@ end
|
||||
local function processSwitchMode(socket, swmode)
|
||||
local m, o, a1, a2, p = swmode:match("^(.-)\30(.-)\30(.-)\30(.-)\30(.-)\04$")
|
||||
if ( m ~= "SWITCHMODE") then
|
||||
print("lklklk", m, o)
|
||||
stdnse.print_debug("Unknown SWITCHMODE: %s %s", m, o)
|
||||
return false, "Failed to parse SWITCHMODE"
|
||||
end
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ local msrpc = require "msrpc"
|
||||
local smb = require "smb"
|
||||
local string = require "string"
|
||||
local vulns = require "vulns"
|
||||
local stdnse = require "stdnse"
|
||||
|
||||
description = [[
|
||||
Checks if target machines are vulnerable to the Samba heap overflow vulnerability CVE-2012-1182.
|
||||
@@ -118,7 +119,7 @@ from an anonymous connection.
|
||||
|
||||
local marshaledHandle = string.rep("X",20)
|
||||
status, result = msrpc.samr_getaliasmembership(smbstate,marshaledHandle, data)
|
||||
print(status, result)
|
||||
stdnse.print_debug(2, "msrpc.samr_getaliasmembership: %s, '%s'", status, result)
|
||||
if(status == false and string.find(result,"Failed to receive bytes after 5 attempts") ~= nil) then
|
||||
samba_cve.state = vulns.STATE.VULN -- connection droped, server crashed
|
||||
end
|
||||
|
||||
@@ -81,7 +81,7 @@ local function checkBadUser(host, port)
|
||||
local pass = "badpass-" .. math.random(10000)
|
||||
local helper = sip.Helper:new(host, port, { expires = 0 })
|
||||
|
||||
print(user, pass)
|
||||
stdnse.print_debug(2, "Checking bad user: %s/%s", user, pass)
|
||||
local status, err = helper:connect()
|
||||
if ( not(status) ) then return false, "ERROR: Failed to connect" end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user