mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 05:01:29 +00:00
Normalize some timeouts in scripts
Added use of stdnse.parse_timespec for timeout args. Used comm.lua
default timeouts in a couple cases. Corrected 2 cases of incorrect
documentation ("Default 60" when the default was 30 seconds).
This commit is contained in:
@@ -52,7 +52,7 @@ action = function(host, port)
|
||||
local result = {}
|
||||
|
||||
-- Set timeout
|
||||
local timeout = tonumber(nmap.registry.args[SCRIPT_NAME .. '.timeout'])
|
||||
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
|
||||
if not timeout or timeout < 0 then timeout = 10 end
|
||||
|
||||
-- Set bytes
|
||||
|
||||
@@ -25,9 +25,7 @@ For more information about Ganglia, see:
|
||||
-- nmap --script ganglia-info --script-args ganglia-info.timeout=60,ganglia-info.bytes=1000000 -p <port> <target>
|
||||
--
|
||||
-- @args ganglia-info.timeout
|
||||
-- Set the timeout in seconds. The default value is 60.
|
||||
-- This should be enough for a grid of more than 100 hosts at 200Kb/s.
|
||||
-- About 5KB-10KB of data is returned for each host in the cluster.
|
||||
-- Set the timeout in seconds. The default value is 30.
|
||||
-- @args ganglia-info.bytes
|
||||
-- Set the number of bytes to retrieve. The default value is 1000000.
|
||||
-- This should be enough for a grid of more than 100 hosts.
|
||||
@@ -92,24 +90,16 @@ action = function( host, port )
|
||||
local result = {}
|
||||
|
||||
-- Set timeout
|
||||
local timeout = nmap.registry.args[SCRIPT_NAME .. '.timeout']
|
||||
if not timeout then
|
||||
timeout = 30
|
||||
else
|
||||
tonumber(timeout)
|
||||
end
|
||||
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. '.timeout'))
|
||||
timeout = timeout or 30
|
||||
|
||||
-- Set bytes
|
||||
local bytes = nmap.registry.args[SCRIPT_NAME .. '.bytes']
|
||||
if not bytes then
|
||||
bytes = 1000000
|
||||
else
|
||||
tonumber(bytes)
|
||||
end
|
||||
local bytes = stdnse.get_script_args(SCRIPT_NAME .. '.bytes')
|
||||
bytes = tonumber(bytes) or 1000000
|
||||
|
||||
-- Retrieve grid data in XML format over TCP
|
||||
stdnse.debug1("Connecting to %s:%s", host.targetname or host.ip, port.number)
|
||||
local status, data = comm.get_banner(host, port, {timeout=timeout*1000,bytes=bytes})
|
||||
local status, data = comm.get_banner(host, port, {request_timeout=timeout*1000,bytes=bytes})
|
||||
if not status then
|
||||
stdnse.debug1("Timeout exceeded for %s:%s (Timeout: %ss).", host.targetname or host.ip, port.number, timeout)
|
||||
return
|
||||
|
||||
@@ -27,10 +27,12 @@ license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
|
||||
categories = {"intrusive", "brute"}
|
||||
|
||||
local shortport = require "shortport"
|
||||
local comm = require "comm"
|
||||
local bin = require "bin"
|
||||
local brute = require "brute"
|
||||
local creds = require "creds"
|
||||
local nmap = require "nmap"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local openssl = stdnse.silent_require "openssl"
|
||||
|
||||
portrule = shortport.portnumber(8728, "tcp")
|
||||
@@ -88,13 +90,12 @@ Driver =
|
||||
}
|
||||
|
||||
action = function(host, port)
|
||||
local result
|
||||
local thread_num = stdnse.get_script_args(SCRIPT_NAME..".threads") or 1
|
||||
local options = {timeout = 5000}
|
||||
local bengine = brute.Engine:new(Driver, host, port, options)
|
||||
|
||||
bengine:setMaxThreads(thread_num)
|
||||
bengine.options.script_name = SCRIPT_NAME
|
||||
_, result = bengine:start()
|
||||
local _, result = bengine:start()
|
||||
return result
|
||||
end
|
||||
|
||||
@@ -41,7 +41,7 @@ For more information about QNX QCONN, see:
|
||||
-- |_ http://metasploit.org/modules/exploit/unix/misc/qnx_qconn_exec
|
||||
--
|
||||
-- @args qconn-exec.timeout
|
||||
-- Set the timeout in seconds. The default value is 60.
|
||||
-- Set the timeout in seconds. The default value is 30.
|
||||
--
|
||||
-- @args qconn-exec.bytes
|
||||
-- Set the number of bytes to retrieve. The default value is 1024.
|
||||
|
||||
@@ -17,8 +17,7 @@ end
|
||||
|
||||
action = function(host, port)
|
||||
local status, result = comm.exchange(host, port,
|
||||
"t3 12.1.2\nAS:2048\nHL:19\n\n",
|
||||
{proto=port.protocol, timeout=5000})
|
||||
"t3 12.1.2\nAS:2048\nHL:19\n\n")
|
||||
|
||||
if (not status) then
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user