mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
stdnse.print_verbose -> stdnse.verbose1
$ sed -i 's/stdnse.print_verbose( *\([0-9]*\) *, *" *%s *:* *\([^"]*\)" *, *SCRIPT_NAME/stdnse.verbose\1("\2"/' *.nse
$ sed -i 's/stdnse.print_verbose( *" *%s *:* *\([^"]*\)" *, *SCRIPT_NAME/stdnse.verbose1("\1"/' *.nse
and some manual corrections.
This commit is contained in:
@@ -52,7 +52,7 @@ categories = {"broadcast", "safe"}
|
||||
|
||||
prerule = function()
|
||||
if not nmap.is_privileged() then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ categories = {"broadcast", "safe"}
|
||||
|
||||
prerule = function()
|
||||
if not nmap.is_privileged() then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
@@ -76,11 +76,11 @@ categories = {"discovery", "broadcast", "safe"}
|
||||
|
||||
prerule = function()
|
||||
if nmap.address_family() ~= 'inet' then
|
||||
stdnse.print_verbose("%s is IPv4 only.", SCRIPT_NAME)
|
||||
stdnse.verbose1("is IPv4 only.")
|
||||
return false
|
||||
end
|
||||
if not nmap.is_privileged() then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
|
||||
@@ -89,11 +89,11 @@ interfaces.
|
||||
|
||||
prerule = function()
|
||||
if nmap.address_family() ~= 'inet' then
|
||||
stdnse.print_verbose("%s is IPv4 only.", SCRIPT_NAME)
|
||||
stdnse.verbose1("is IPv4 only.")
|
||||
return false
|
||||
end
|
||||
if ( not(nmap.is_privileged()) ) then
|
||||
stdnse.print_verbose("%s not running due to lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running due to lack of privileges.")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
|
||||
@@ -87,7 +87,7 @@ categories = {"broadcast", "safe"}
|
||||
|
||||
prerule = function()
|
||||
if not nmap.is_privileged() then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
|
||||
@@ -42,11 +42,11 @@ categories = {"discovery", "safe", "broadcast"}
|
||||
|
||||
prerule = function()
|
||||
if nmap.address_family() ~= 'inet' then
|
||||
stdnse.print_verbose("%s is IPv4 only.", SCRIPT_NAME)
|
||||
stdnse.verbose1("is IPv4 only.")
|
||||
return false
|
||||
end
|
||||
if not nmap.is_privileged() then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
@@ -135,12 +135,12 @@ local getInterface = function(destination)
|
||||
local sock = nmap.new_socket()
|
||||
local status, err = sock:connect(destination, "12345", "udp")
|
||||
if not status then
|
||||
stdnse.print_verbose("%s: %s", SCRIPT_NAME, err)
|
||||
stdnse.verbose1("%s", err)
|
||||
return
|
||||
end
|
||||
local status, address, _, _, _ = sock:get_info()
|
||||
if not status then
|
||||
stdnse.print_verbose("%s: %s", SCRIPT_NAME, err)
|
||||
stdnse.verbose1("%s", err)
|
||||
return
|
||||
end
|
||||
for _, interface in pairs(nmap.list_interfaces()) do
|
||||
|
||||
@@ -63,7 +63,7 @@ prerule = function()
|
||||
if not nmap.is_privileged() then
|
||||
nmap.registry[SCRIPT_NAME] = nmap.registry[SCRIPT_NAME] or {}
|
||||
if not nmap.registry[SCRIPT_NAME].rootfail then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
end
|
||||
nmap.registry[SCRIPT_NAME].rootfail = true
|
||||
return nil
|
||||
|
||||
@@ -36,7 +36,7 @@ categories = {"broadcast", "safe"}
|
||||
|
||||
prerule = function()
|
||||
if not nmap.is_privileged() then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
|
||||
@@ -689,7 +689,7 @@ hostrule = function(host)
|
||||
if not nmap.is_privileged() then
|
||||
nmap.registry[SCRIPT_NAME] = nmap.registry[SCRIPT_NAME] or {}
|
||||
if not nmap.registry[SCRIPT_NAME].rootfail then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
end
|
||||
nmap.registry[SCRIPT_NAME].rootfail = true
|
||||
return false
|
||||
|
||||
@@ -192,7 +192,7 @@ hostrule = function(host)
|
||||
if not nmap.is_privileged() then
|
||||
nmap.registry[SCRIPT_NAME] = nmap.registry[SCRIPT_NAME] or {}
|
||||
if not nmap.registry[SCRIPT_NAME].rootfail then
|
||||
stdnse.print_verbose("%s lacks privileges.", SCRIPT_NAME )
|
||||
stdnse.verbose1("lacks privileges." )
|
||||
nmap.registry[SCRIPT_NAME].rootfail = true
|
||||
end
|
||||
return false
|
||||
|
||||
@@ -184,7 +184,7 @@ hostrule = function(host)
|
||||
if not nmap.is_privileged() then
|
||||
nmap.registry[SCRIPT_NAME] = nmap.registry[SCRIPT_NAME] or {}
|
||||
if not nmap.registry[SCRIPT_NAME].rootfail then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
end
|
||||
nmap.registry[SCRIPT_NAME].rootfail = true
|
||||
return nil
|
||||
|
||||
@@ -126,7 +126,7 @@ end
|
||||
--- Broadcasting on the selected interface
|
||||
-- @param iface table containing interface information
|
||||
local function broadcast_on_interface(iface)
|
||||
stdnse.print_verbose("Starting " .. SCRIPT_NAME .. " on interface " .. iface)
|
||||
stdnse.print_verbose1("Starting on interface " .. iface)
|
||||
|
||||
-- packet counter
|
||||
local counter = 0
|
||||
|
||||
@@ -226,7 +226,7 @@ action = function( host, port )
|
||||
-- Account Locked Out
|
||||
if not status and response:match("AcceptSecurityContext error, data 775,") then
|
||||
table.insert( valid_accounts, string.format("%s => Valid credentials, account locked", fq_username ) )
|
||||
stdnse.print_verbose(2, string.format(" ldap-brute: %s => Valid credentials, account locked", fq_username ))
|
||||
stdnse.verbose2("%s => Valid credentials, account locked", fq_username)
|
||||
credTable:add(fq_username,password, creds.State.LOCKED_VALID)
|
||||
break
|
||||
end
|
||||
@@ -234,7 +234,7 @@ action = function( host, port )
|
||||
-- Login correct, account disabled
|
||||
if not status and response:match("AcceptSecurityContext error, data 533,") then
|
||||
table.insert( valid_accounts, string.format("%s:%s => Valid credentials, account disabled", fq_username, password:len()>0 and password or "<empty>" ) )
|
||||
stdnse.print_verbose(2, string.format(" ldap-brute: %s:%s => Valid credentials, account disabled", fq_username, password:len()>0 and password or "<empty>" ))
|
||||
stdnse.verbose2("%s:%s => Valid credentials, account disabled", fq_username, password:len()>0 and password or "<empty>" )
|
||||
credTable:add(fq_username,password, creds.State.DISABLED_VALID)
|
||||
break
|
||||
end
|
||||
@@ -242,7 +242,7 @@ action = function( host, port )
|
||||
-- Login correct, user must change password
|
||||
if not status and response:match("AcceptSecurityContext error, data 773,") then
|
||||
table.insert( valid_accounts, string.format("%s:%s => Valid credentials, password must be changed at next logon", fq_username, password:len()>0 and password or "<empty>" ) )
|
||||
stdnse.print_verbose(2, string.format(" ldap-brute: %s:%s => Valid credentials, password must be changed at next logon", fq_username, password:len()>0 and password or "<empty>" ))
|
||||
stdnse.verbose2("%s:%s => Valid credentials, password must be changed at next logon", fq_username, password:len()>0 and password or "<empty>")
|
||||
credTable:add(fq_username,password, creds.State.CHANGEPW)
|
||||
break
|
||||
end
|
||||
@@ -250,7 +250,7 @@ action = function( host, port )
|
||||
-- Login correct, user account expired
|
||||
if not status and response:match("AcceptSecurityContext error, data 701,") then
|
||||
table.insert( valid_accounts, string.format("%s:%s => Valid credentials, account expired", fq_username, password:len()>0 and password or "<empty>" ) )
|
||||
stdnse.print_verbose(2, string.format(" ldap-brute: %s:%s => Valid credentials, account expired", fq_username, password:len()>0 and password or "<empty>" ))
|
||||
stdnse.verbose2("%s:%s => Valid credentials, account expired", fq_username, password:len()>0 and password or "<empty>")
|
||||
credTable:add(fq_username,password, creds.State.EXPIRED)
|
||||
break
|
||||
end
|
||||
@@ -258,7 +258,7 @@ action = function( host, port )
|
||||
-- Login correct, user account logon time restricted
|
||||
if not status and response:match("AcceptSecurityContext error, data 530,") then
|
||||
table.insert( valid_accounts, string.format("%s:%s => Valid credentials, account cannot log in at current time", fq_username, password:len()>0 and password or "<empty>" ) )
|
||||
stdnse.print_verbose(2, string.format(" ldap-brute: %s:%s => Valid credentials, account cannot log in at current time", fq_username, password:len()>0 and password or "<empty>" ))
|
||||
stdnse.verbose2("%s:%s => Valid credentials, account cannot log in at current time", fq_username, password:len()>0 and password or "<empty>")
|
||||
credTable:add(fq_username,password, creds.State.TIME_RESTRICTED)
|
||||
break
|
||||
end
|
||||
@@ -266,7 +266,7 @@ action = function( host, port )
|
||||
-- Login correct, user account can only log in from certain workstations
|
||||
if not status and response:match("AcceptSecurityContext error, data 531,") then
|
||||
table.insert( valid_accounts, string.format("%s:%s => Valid credentials, account cannot log in from current host", fq_username, password:len()>0 and password or "<empty>" ) )
|
||||
stdnse.print_verbose(2, string.format(" ldap-brute: %s:%s => Valid credentials, account cannot log in from current host", fq_username, password:len()>0 and password or "<empty>" ))
|
||||
stdnse.verbose2("%s:%s => Valid credentials, account cannot log in from current host", fq_username, password:len()>0 and password or "<empty>")
|
||||
credTable:add(fq_username,password, creds.State.HOST_RESTRICTED)
|
||||
break
|
||||
end
|
||||
@@ -276,7 +276,7 @@ action = function( host, port )
|
||||
status = is_valid_credential( socket, context )
|
||||
if status then
|
||||
table.insert( valid_accounts, string.format("%s:%s => Valid credentials", fq_username, password:len()>0 and password or "<empty>" ) )
|
||||
stdnse.print_verbose(2, string.format(" ldap-brute: %s:%s => Valid credentials", fq_username, password:len()>0 and password or "<empty>" ) )
|
||||
stdnse.verbose2("%s:%s => Valid credentials", fq_username, password:len()>0 and password or "<empty>")
|
||||
-- Add credentials for other ldap scripts to use
|
||||
if nmap.registry.ldapaccounts == nil then
|
||||
nmap.registry.ldapaccounts = {}
|
||||
|
||||
@@ -38,7 +38,7 @@ For more information, see:
|
||||
|
||||
prerule = function()
|
||||
if not nmap.is_privileged() then
|
||||
stdnse.print_verbose("%s not running due to lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running due to lack of privileges.")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
@@ -146,12 +146,12 @@ local getInterface = function(target)
|
||||
local sock = nmap.new_socket()
|
||||
local status, err = sock:connect(target, "12345", "udp")
|
||||
if not status then
|
||||
stdnse.print_verbose("%s: %s", SCRIPT_NAME, err)
|
||||
stdnse.verbose1("%s", err)
|
||||
return
|
||||
end
|
||||
local status, address, _, _, _ = sock:get_info()
|
||||
if not status then
|
||||
stdnse.print_verbose("%s: %s", SCRIPT_NAME, err)
|
||||
stdnse.verbose1("%s", err)
|
||||
return
|
||||
end
|
||||
for _, interface in pairs(nmap.list_interfaces()) do
|
||||
|
||||
@@ -49,7 +49,7 @@ prerule = function()
|
||||
if not nmap.is_privileged() then
|
||||
nmap.registry[SCRIPT_NAME] = nmap.registry[SCRIPT_NAME] or {}
|
||||
if not nmap.registry[SCRIPT_NAME].rootfail then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
end
|
||||
nmap.registry[SCRIPT_NAME].rootfail = true
|
||||
return nil
|
||||
|
||||
@@ -72,11 +72,11 @@ categories = {"discovery", "safe", "broadcast"}
|
||||
|
||||
prerule = function()
|
||||
if nmap.address_family() ~= 'inet' then
|
||||
stdnse.print_verbose("%s is IPv4 only.", SCRIPT_NAME)
|
||||
stdnse.verbose1("is IPv4 only.")
|
||||
return false
|
||||
end
|
||||
if not nmap.is_privileged() then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
@@ -226,12 +226,12 @@ local getInterface = function(target)
|
||||
local sock = nmap.new_socket()
|
||||
local status, err = sock:connect(target, "12345", "udp")
|
||||
if not status then
|
||||
stdnse.print_verbose("%s: %s", SCRIPT_NAME, err)
|
||||
stdnse.verbose1("%s", err)
|
||||
return
|
||||
end
|
||||
local status, address, _, _, _ = sock:get_info()
|
||||
if not status then
|
||||
stdnse.print_verbose("%s: %s", SCRIPT_NAME, err)
|
||||
stdnse.verbose1("%s", err)
|
||||
return
|
||||
end
|
||||
for _, interface in pairs(nmap.list_interfaces()) do
|
||||
|
||||
@@ -102,11 +102,11 @@ FWD_CODE = {
|
||||
|
||||
prerule = function()
|
||||
if nmap.address_family() ~= 'inet' then
|
||||
stdnse.print_verbose("%s is IPv4 only.", SCRIPT_NAME)
|
||||
stdnse.verbose1("is IPv4 only.")
|
||||
return false
|
||||
end
|
||||
if not nmap.is_privileged() then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
@@ -214,7 +214,7 @@ local traceParse = function(data)
|
||||
if index >= #data then
|
||||
break
|
||||
elseif #data - index < 31 then
|
||||
stdnse.print_verbose("%s malformed traceroute response.", SCRIPT_NAME)
|
||||
stdnse.verbose1("malformed traceroute response.")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -303,12 +303,12 @@ local getInterface = function(target)
|
||||
local sock = nmap.new_socket()
|
||||
local status, err = sock:connect(target, "12345", "udp")
|
||||
if not status then
|
||||
stdnse.print_verbose("%s: %s", SCRIPT_NAME, err)
|
||||
stdnse.verbose1("%s", err)
|
||||
return
|
||||
end
|
||||
local status, address, _, _, _ = sock:get_info()
|
||||
if not status then
|
||||
stdnse.print_verbose("%s: %s", SCRIPT_NAME, err)
|
||||
stdnse.verbose1("%s", err)
|
||||
return
|
||||
end
|
||||
for _, interface in pairs(nmap.list_interfaces()) do
|
||||
@@ -330,7 +330,7 @@ action = function()
|
||||
|
||||
-- Source address from which to traceroute
|
||||
if not fromip then
|
||||
stdnse.print_verbose("%s: A source IP must be provided through fromip argument.", SCRIPT_NAME)
|
||||
stdnse.verbose1("A source IP must be provided through fromip argument.")
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ hostrule = function(host)
|
||||
if not nmap.is_privileged() then
|
||||
nmap.registry[SCRIPT_NAME] = nmap.registry[SCRIPT_NAME] or {}
|
||||
if not nmap.registry[SCRIPT_NAME].rootfail then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
end
|
||||
nmap.registry[SCRIPT_NAME].rootfail = true
|
||||
return nil
|
||||
|
||||
@@ -365,7 +365,7 @@ hostrule = function(host)
|
||||
if not nmap.is_privileged() then
|
||||
nmap.registry[SCRIPT_NAME] = nmap.registry[SCRIPT_NAME] or {}
|
||||
if not nmap.registry[SCRIPT_NAME].rootfail then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
end
|
||||
nmap.registry[SCRIPT_NAME].rootfail = true
|
||||
return nil
|
||||
|
||||
@@ -168,7 +168,7 @@ local function test_ccs_injection(host, port, version)
|
||||
repeat
|
||||
status, response, err = tls.record_buffer(s, response, i)
|
||||
if err == "TIMEOUT" or not status then
|
||||
stdnse.print_verbose(1, "No response from server: %s", err)
|
||||
stdnse.verbose1("No response from server: %s", err)
|
||||
s:close()
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME ..
|
||||
|
||||
prerule = function()
|
||||
if ( not(nmap.is_privileged()) ) then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
|
||||
@@ -41,11 +41,11 @@ local arg_iface = nmap.get_interface() or stdnse.get_script_args(SCRIPT_NAME ..
|
||||
prerule = function()
|
||||
local has_interface = ( arg_iface ~= nil )
|
||||
if not nmap.is_privileged() then
|
||||
stdnse.print_verbose("%s not running for lack of privileges.", SCRIPT_NAME)
|
||||
stdnse.verbose1("not running for lack of privileges.")
|
||||
return false
|
||||
end
|
||||
if ( not(has_interface) ) then
|
||||
stdnse.print_verbose("%s no network interface was supplied, aborting ...", SCRIPT_NAME)
|
||||
stdnse.verbose1("no network interface was supplied, aborting ...")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user