From a19c9eb461be115e5bff5abb969c4eb54bb3364c Mon Sep 17 00:00:00 2001 From: batrick Date: Sat, 2 Aug 2014 18:32:26 +0000 Subject: [PATCH] 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. --- scripts/broadcast-dhcp-discover.nse | 2 +- scripts/broadcast-dhcp6-discover.nse | 2 +- scripts/broadcast-eigrp-discovery.nse | 4 ++-- scripts/broadcast-igmp-discovery.nse | 4 ++-- scripts/broadcast-listener.nse | 2 +- scripts/broadcast-pim-discovery.nse | 8 ++++---- scripts/broadcast-ping.nse | 2 +- scripts/broadcast-pppoe-discover.nse | 2 +- scripts/firewalk.nse | 2 +- scripts/firewall-bypass.nse | 2 +- scripts/ipidseq.nse | 2 +- scripts/ipv6-ra-flood.nse | 2 +- scripts/ldap-brute.nse | 14 +++++++------- scripts/llmnr-resolve.nse | 6 +++--- scripts/lltd-discovery.nse | 2 +- scripts/mrinfo.nse | 8 ++++---- scripts/mtrace.nse | 12 ++++++------ scripts/path-mtu.nse | 2 +- scripts/qscan.nse | 2 +- scripts/ssl-ccs-injection.nse | 2 +- scripts/targets-ipv6-multicast-mld.nse | 2 +- scripts/url-snarf.nse | 4 ++-- 22 files changed, 44 insertions(+), 44 deletions(-) diff --git a/scripts/broadcast-dhcp-discover.nse b/scripts/broadcast-dhcp-discover.nse index 06aabbc8d..13ba09508 100644 --- a/scripts/broadcast-dhcp-discover.nse +++ b/scripts/broadcast-dhcp-discover.nse @@ -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 diff --git a/scripts/broadcast-dhcp6-discover.nse b/scripts/broadcast-dhcp6-discover.nse index 3ea4431e3..8ce5d9f47 100644 --- a/scripts/broadcast-dhcp6-discover.nse +++ b/scripts/broadcast-dhcp6-discover.nse @@ -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 diff --git a/scripts/broadcast-eigrp-discovery.nse b/scripts/broadcast-eigrp-discovery.nse index 2b09af30d..61d08c78a 100644 --- a/scripts/broadcast-eigrp-discovery.nse +++ b/scripts/broadcast-eigrp-discovery.nse @@ -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 diff --git a/scripts/broadcast-igmp-discovery.nse b/scripts/broadcast-igmp-discovery.nse index 8d88d0f01..4544146aa 100644 --- a/scripts/broadcast-igmp-discovery.nse +++ b/scripts/broadcast-igmp-discovery.nse @@ -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 diff --git a/scripts/broadcast-listener.nse b/scripts/broadcast-listener.nse index 21b66ca0b..6eeadec02 100644 --- a/scripts/broadcast-listener.nse +++ b/scripts/broadcast-listener.nse @@ -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 diff --git a/scripts/broadcast-pim-discovery.nse b/scripts/broadcast-pim-discovery.nse index c28660613..1e779db7c 100644 --- a/scripts/broadcast-pim-discovery.nse +++ b/scripts/broadcast-pim-discovery.nse @@ -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 diff --git a/scripts/broadcast-ping.nse b/scripts/broadcast-ping.nse index 37a82f1ea..ac7990ccb 100644 --- a/scripts/broadcast-ping.nse +++ b/scripts/broadcast-ping.nse @@ -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 diff --git a/scripts/broadcast-pppoe-discover.nse b/scripts/broadcast-pppoe-discover.nse index 153eccb1d..757f4cfdd 100644 --- a/scripts/broadcast-pppoe-discover.nse +++ b/scripts/broadcast-pppoe-discover.nse @@ -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 diff --git a/scripts/firewalk.nse b/scripts/firewalk.nse index 981432f96..36cafe64d 100644 --- a/scripts/firewalk.nse +++ b/scripts/firewalk.nse @@ -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 diff --git a/scripts/firewall-bypass.nse b/scripts/firewall-bypass.nse index ef1c18935..42af026b8 100644 --- a/scripts/firewall-bypass.nse +++ b/scripts/firewall-bypass.nse @@ -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 diff --git a/scripts/ipidseq.nse b/scripts/ipidseq.nse index aab3dbe88..04db03c13 100644 --- a/scripts/ipidseq.nse +++ b/scripts/ipidseq.nse @@ -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 diff --git a/scripts/ipv6-ra-flood.nse b/scripts/ipv6-ra-flood.nse index e15ab9b22..222bc6940 100644 --- a/scripts/ipv6-ra-flood.nse +++ b/scripts/ipv6-ra-flood.nse @@ -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 diff --git a/scripts/ldap-brute.nse b/scripts/ldap-brute.nse index 73815dbad..1f83eca41 100644 --- a/scripts/ldap-brute.nse +++ b/scripts/ldap-brute.nse @@ -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 "" ) ) - stdnse.print_verbose(2, string.format(" ldap-brute: %s:%s => Valid credentials, account disabled", fq_username, password:len()>0 and password or "" )) + stdnse.verbose2("%s:%s => Valid credentials, account disabled", fq_username, password:len()>0 and password or "" ) 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 "" ) ) - 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 "" )) + stdnse.verbose2("%s:%s => Valid credentials, password must be changed at next logon", fq_username, password:len()>0 and password or "") 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 "" ) ) - stdnse.print_verbose(2, string.format(" ldap-brute: %s:%s => Valid credentials, account expired", fq_username, password:len()>0 and password or "" )) + stdnse.verbose2("%s:%s => Valid credentials, account expired", fq_username, password:len()>0 and password or "") 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 "" ) ) - 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 "" )) + stdnse.verbose2("%s:%s => Valid credentials, account cannot log in at current time", fq_username, password:len()>0 and password or "") 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 "" ) ) - 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 "" )) + stdnse.verbose2("%s:%s => Valid credentials, account cannot log in from current host", fq_username, password:len()>0 and password or "") 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 "" ) ) - stdnse.print_verbose(2, string.format(" ldap-brute: %s:%s => Valid credentials", fq_username, password:len()>0 and password or "" ) ) + stdnse.verbose2("%s:%s => Valid credentials", fq_username, password:len()>0 and password or "") -- Add credentials for other ldap scripts to use if nmap.registry.ldapaccounts == nil then nmap.registry.ldapaccounts = {} diff --git a/scripts/llmnr-resolve.nse b/scripts/llmnr-resolve.nse index 920f50955..7eb300755 100644 --- a/scripts/llmnr-resolve.nse +++ b/scripts/llmnr-resolve.nse @@ -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 diff --git a/scripts/lltd-discovery.nse b/scripts/lltd-discovery.nse index 774f57bd3..f1cdff3b0 100644 --- a/scripts/lltd-discovery.nse +++ b/scripts/lltd-discovery.nse @@ -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 diff --git a/scripts/mrinfo.nse b/scripts/mrinfo.nse index 369f4b72b..9037b211f 100644 --- a/scripts/mrinfo.nse +++ b/scripts/mrinfo.nse @@ -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 diff --git a/scripts/mtrace.nse b/scripts/mtrace.nse index e19c51d29..5a74613eb 100644 --- a/scripts/mtrace.nse +++ b/scripts/mtrace.nse @@ -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 diff --git a/scripts/path-mtu.nse b/scripts/path-mtu.nse index 950ef0efd..cae9e600f 100644 --- a/scripts/path-mtu.nse +++ b/scripts/path-mtu.nse @@ -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 diff --git a/scripts/qscan.nse b/scripts/qscan.nse index d6fd4ddf2..6955c0bf1 100644 --- a/scripts/qscan.nse +++ b/scripts/qscan.nse @@ -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 diff --git a/scripts/ssl-ccs-injection.nse b/scripts/ssl-ccs-injection.nse index 5dc5d7ca7..426fea21d 100644 --- a/scripts/ssl-ccs-injection.nse +++ b/scripts/ssl-ccs-injection.nse @@ -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 diff --git a/scripts/targets-ipv6-multicast-mld.nse b/scripts/targets-ipv6-multicast-mld.nse index d590be161..fdd146db9 100644 --- a/scripts/targets-ipv6-multicast-mld.nse +++ b/scripts/targets-ipv6-multicast-mld.nse @@ -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 diff --git a/scripts/url-snarf.nse b/scripts/url-snarf.nse index 83387f0ab..26fd303c2 100644 --- a/scripts/url-snarf.nse +++ b/scripts/url-snarf.nse @@ -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