mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 21:21:31 +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 = {}
|
local result = {}
|
||||||
for ip, resp in pairs(responses) do
|
for ip, resp in pairs(responses) do
|
||||||
print(ip, resp)
|
stdnse.print_debug(ip, resp)
|
||||||
table.insert(result, { name = ip, parse_response(resp) } )
|
table.insert(result, { name = ip, parse_response(resp) } )
|
||||||
end
|
end
|
||||||
return stdnse.format_output(true, result)
|
return stdnse.format_output(true, result)
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ function verify_password( host, port, username, password, domain )
|
|||||||
account.valid = false
|
account.valid = false
|
||||||
account.message = "Unspecified"
|
account.message = "Unspecified"
|
||||||
else
|
else
|
||||||
print("UNKNOWN response: " .. response)
|
stdnse.print_debug("UNKNOWN response: " .. response)
|
||||||
account.valid = false
|
account.valid = false
|
||||||
account.message = "failed"
|
account.message = "failed"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ action = function(host)
|
|||||||
end
|
end
|
||||||
file:close()
|
file:close()
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
if (not hostlist) then hostlist = HOST_LIST end
|
if (not hostlist) then hostlist = HOST_LIST end
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ end
|
|||||||
local function processSwitchMode(socket, swmode)
|
local function processSwitchMode(socket, swmode)
|
||||||
local m, o, a1, a2, p = swmode:match("^(.-)\30(.-)\30(.-)\30(.-)\30(.-)\04$")
|
local m, o, a1, a2, p = swmode:match("^(.-)\30(.-)\30(.-)\30(.-)\30(.-)\04$")
|
||||||
if ( m ~= "SWITCHMODE") then
|
if ( m ~= "SWITCHMODE") then
|
||||||
print("lklklk", m, o)
|
stdnse.print_debug("Unknown SWITCHMODE: %s %s", m, o)
|
||||||
return false, "Failed to parse SWITCHMODE"
|
return false, "Failed to parse SWITCHMODE"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ local msrpc = require "msrpc"
|
|||||||
local smb = require "smb"
|
local smb = require "smb"
|
||||||
local string = require "string"
|
local string = require "string"
|
||||||
local vulns = require "vulns"
|
local vulns = require "vulns"
|
||||||
|
local stdnse = require "stdnse"
|
||||||
|
|
||||||
description = [[
|
description = [[
|
||||||
Checks if target machines are vulnerable to the Samba heap overflow vulnerability CVE-2012-1182.
|
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)
|
local marshaledHandle = string.rep("X",20)
|
||||||
status, result = msrpc.samr_getaliasmembership(smbstate,marshaledHandle, data)
|
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
|
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
|
samba_cve.state = vulns.STATE.VULN -- connection droped, server crashed
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ local function checkBadUser(host, port)
|
|||||||
local pass = "badpass-" .. math.random(10000)
|
local pass = "badpass-" .. math.random(10000)
|
||||||
local helper = sip.Helper:new(host, port, { expires = 0 })
|
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()
|
local status, err = helper:connect()
|
||||||
if ( not(status) ) then return false, "ERROR: Failed to connect" end
|
if ( not(status) ) then return false, "ERROR: Failed to connect" end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user