1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Update timeout script-args to use standard timespec

Many scripts were documented as using timespecs (10s, 5000ms, etc) for
timeout script-args, but one 1 or 2 actually did. Now all timeout
script-args will accept timespecs, except those which took a number of
milliseconds, which remain unchanged.

Also fixed some documentation issues (missing script name in arg
description, missing nsedoc for args, etc)
This commit is contained in:
dmiller
2013-03-05 21:34:25 +00:00
parent 3150d2fff6
commit fdb0f775e2
32 changed files with 113 additions and 108 deletions

View File

@@ -21,10 +21,10 @@ peers as targets.
-- @usage
-- nmap --script bittorrent-discovery --script-args newtargets,bittorrent-discovery.torrent=<torrent_file>
--
-- @arg torrent, a string containing the filename of the torrent file
-- @arg magnet, a string containing the magnet link of the torrent
-- @arg timeout, desired (not actual) timeout for the DHT discovery (default = 30 s)
-- @arg include-nodes, boolean selecting whether to show only nodes
-- @args bittorrent-discovery.torrent a string containing the filename of the torrent file
-- @args bittorrent-discovery.magnet a string containing the magnet link of the torrent
-- @args bittorrent-discover.timeout desired (not actual) timeout for the DHT discovery (default = 30s)
-- @args bittorrent-discover.include-nodes boolean selecting whether to show only nodes
--
-- @output
-- | bittorrent-peers:
@@ -59,7 +59,7 @@ prerule = function()
end
action = function()
local timeout = stdnse.get_script_args(SCRIPT_NAME..".dht_timeout")
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME..".timeout"))
local filename = stdnse.get_script_args(SCRIPT_NAME..".torrent")
local magnet = stdnse.get_script_args(SCRIPT_NAME..".magnet")
local include_nodes = stdnse.get_script_args(SCRIPT_NAME..".include-nodes")

View File

@@ -26,6 +26,8 @@ information for all discovered devices.
-- | Description: Canon MG5200 series
-- |_ Command: MultiPass 2.1,IVEC
--
-- @args broadcast-bjnp-discover.timeout specifies the amount of seconds to sniff
-- the network interface. (default 30s)
author = "Patrik Karlsson"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
@@ -39,7 +41,7 @@ local table = require("table")
local printer_port = { number = 8611, protocol = "udp"}
local scanner_port = { number = 8612, protocol = "udp"}
local arg_timeout = tonumber(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
prerule = function()
if ( nmap.address_family() ~= 'inet' ) then

View File

@@ -137,11 +137,8 @@ end
action = function()
local host, port = "255.255.255.255", 67
local timeout = stdnse.get_script_args("broadcast-dhcp-discover.timeout")
timeout = tonumber(timeout) or 10
-- convert from seconds to ms
timeout = timeout * 1000
local timeout = stdnse.parse_timespec(stdnse.get_script_args("broadcast-dhcp-discover.timeout"))
timeout = (timeout or 10) * 1000
-- randomizing the MAC could exhaust dhcp servers with small scopes
-- if ran multiple times, so we should probably refrain from doing

View File

@@ -196,11 +196,11 @@ action = function()
-- Get script arguments
local as = stdnse.get_script_args(SCRIPT_NAME .. ".as")
local kparams = stdnse.get_script_args(SCRIPT_NAME .. ".kparams") or "101000"
local timeout = stdnse.get_script_args(SCRIPT_NAME .. ".timeout") or 10
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
local interface = stdnse.get_script_args(SCRIPT_NAME .. ".interface")
local output, responses, interfaces, lthreads = {}, {}, {}, {}
local result, response, route, eigrp_hello, k
local timeout = timeout * 1000
local timeout = (timeout or 10) * 1000
-- K params should be of length 6
-- Cisco routers ignore eigrp packets that don't have matching K parameters

View File

@@ -317,10 +317,10 @@ local mgroup_name_identify = function(db, ip)
end
action = function(host, port)
local timeout = tonumber(stdnse.get_script_args(SCRIPT_NAME .. ".timeout")) or 7
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
local version = stdnse.get_script_args(SCRIPT_NAME .. ".version") or 2
local interface = stdnse.get_script_args(SCRIPT_NAME .. ".interface")
timeout = timeout * 1000
timeout = (timeout or 7) * 1000
if version ~= 'all' then
version = tonumber(version)
end

View File

@@ -137,7 +137,7 @@ sniffInterface = function(iface, Decoders, decodertab)
local timeout = stdnse.parse_timespec(stdnse.get_script_args("broadcast-listener.timeout"))
-- default to 30 seconds, if nothing else was set
timeout = timeout and (timeout * 1000) or (30 * 1000)
timeout = (timeout or 30) * 1000
-- We want all packets that aren't explicitly for us
sock:pcap_open(iface.name, 1500, true, ("!host %s"):format(iface.address))

View File

@@ -16,12 +16,14 @@ Sends a special broadcast probe to discover PC-Anywhere hosts running on a LAN.
-- | broadcast-pc-anywhere:
-- |_ 10.0.200.113 - WIN2K3SRV-1
--
-- @args broadcast-pc-anywhere.timeout specifies the amount of seconds to sniff
-- the network interface. (default varies according to timing. -T3 = 5s)
author = "Patrik Karlsson"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = { "broadcast", "safe" }
local TIMEOUT = tonumber(stdnse.get_script_args("broadcast-pc-anywhere.timeout"))
local TIMEOUT = stdnse.parse_timespec(stdnse.get_script_args("broadcast-pc-anywhere.timeout"))
prerule = function() return ( nmap.address_family() == "inet") end

View File

@@ -21,12 +21,14 @@ Discovers PC-DUO remote control hosts and gateways running on a LAN by sending a
-- | PC-Duo Hosts
-- |_ 10.0.200.113 - WIN2K3SRV-1
--
-- @args broadcast-pc-duo.timeout specifies the amount of seconds to sniff
-- the network interface. (default varies according to timing. -T3 = 5s)
author = "Patrik Karlsson"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = { "broadcast", "safe" }
local TIMEOUT = tonumber(stdnse.get_script_args("broadcast-pc-duo.timeout"))
local TIMEOUT = stdnse.parse_timespec(stdnse.get_script_args("broadcast-pc-duo.timeout"))
prerule = function() return ( nmap.address_family() == "inet") end

View File

@@ -17,7 +17,7 @@ This works by sending a PIM Hello message to the PIM multicast address
--
-- @args broadcast-pim-discovery.timeout Time to wait for responses in seconds.
-- Defaults to <code>5</code> seconds.
-- Defaults to <code>5s</code>.
--
--@usage
-- nmap --script broadcast-pim-discovery
@@ -151,9 +151,9 @@ local getInterface = function(destination)
end
action = function()
local timeout = tonumber(stdnse.get_script_args(SCRIPT_NAME .. ".timeout")) or 5
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
local responses = {}
timeout = timeout * 1000
timeout = (timeout or 5) * 1000
local mcast = "224.0.0.13"
-- Get the network interface to use

View File

@@ -42,9 +42,9 @@ is 0. The payload is consisted of random bytes.
-- nmap -e <interface> [--ttl <ttl>] [--data-length <payload_length>]
-- --script broadcast-ping [--script-args [broadcast-ping.timeout=<ms>],[num-probes=<n>]]
--
-- @arg interface string specifying which interface to use for this script
-- @arg num_probes number specifying how many ICMP probes should be sent
-- @arg timeout number specifying how long to wait for response in miliseconds
-- @args broadcast-ping.interface string specifying which interface to use for this script (default all interfaces)
-- @args broadcast-ping.num_probes number specifying how many ICMP probes should be sent (default 1)
-- @args broadcast-ping.timeout number specifying how long to wait for response in milliseconds (default 3000)
--
-- @output
-- | broadcast-ping:
@@ -139,8 +139,7 @@ end
local broadcast_if = function(if_table,icmp_responders)
local condvar = nmap.condvar(icmp_responders)
local num_probes = stdnse.get_script_args(SCRIPT_NAME .. ".num-probes")
if not num_probes then num_probes = 1 end
local num_probes = tonumber(stdnse.get_script_args(SCRIPT_NAME .. ".num-probes")) or 1
local timeout = stdnse.get_script_args(SCRIPT_NAME .. ".timeout")
if not timeout then timeout = 3000 end

View File

@@ -31,8 +31,8 @@ from all devices responding to the request.
-- | ip netmask nexthop metric
-- |_ 0.0.0.0 0.0.0.0 10.0.200.1 1
--
-- @args broadcast-rip-discover.timeout sets the timeout in seconds to wait for
-- a response.
-- @args broadcast-rip-discover.timeout timespec defining how long to wait for
-- a response. (default 5s)
--
-- Version 0.1
@@ -147,8 +147,8 @@ RIPv2 = {
action = function()
local timeout = stdnse.get_script_args('broadcast-rip-discover.timeout')
timeout = (timeout and tonumber(timeout) * 1000) or 5000
local timeout = stdnse.parse_timespec(stdnse.get_script_args('broadcast-rip-discover.timeout'))
timeout = (timeout or 5) * 1000
local socket = nmap.new_socket("udp")
socket:set_timeout(timeout)

View File

@@ -18,7 +18,7 @@ are marked using the keyword Willing in the result.
-- | broadcast-xdmcp-discover:
-- |_ 192.168.2.162 - Willing
--
-- @arg broadcast-xdmcp-discover.timeout socket timeout in seconds (default: 5)
-- @args broadcast-xdmcp-discover.timeout socket timeout (default: 5s)
author = "Patrik Karlsson"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
@@ -27,7 +27,7 @@ categories = {"broadcast", "safe"}
prerule = function() return true end
local arg_timeout = stdnse.get_script_args(SCRIPT_NAME .. ".timeout")
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
action = function()

View File

@@ -24,10 +24,10 @@ anonymous identity if no argument is passed.
-- | false EAP-TLS
-- |_ false EAP-MSCHAP-V2
--
-- @args identity Identity to use for the first step of the authentication methods (if omitted "anonymous" will be used).
-- @args scan Table of authentication methods to test, e.g. { 4, 13, 25 } for MD5, TLS and PEAP. Default: TLS, TTLS, PEAP, MSCHAP.
-- @args interface Network interface to use for the scan, overrides "-e".
-- @args timeout Maximum time allowed for the scan, in seconds. Methods not tested because of timeout will be listed as "unknown".
-- @args eap-info.identity Identity to use for the first step of the authentication methods (if omitted "anonymous" will be used).
-- @args eap-info.scan Table of authentication methods to test, e.g. { 4, 13, 25 } for MD5, TLS and PEAP. Default: TLS, TTLS, PEAP, MSCHAP.
-- @args eap-info.interface Network interface to use for the scan, overrides "-e".
-- @args eap-info.timeout Maximum time allowed for the scan (default 10s). Methods not tested because of timeout will be listed as "unknown".
author = "Riccardo Cecolin"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
@@ -53,7 +53,7 @@ action = function()
local arg_interface = stdnse.get_script_args(SCRIPT_NAME .. ".interface")
local arg_identity = stdnse.get_script_args(SCRIPT_NAME .. ".identity")
local arg_scan = stdnse.get_script_args(SCRIPT_NAME .. ".scan")
local arg_timeout = stdnse.get_script_args(SCRIPT_NAME .. ".timeout")
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
local iface
-- trying with provided interface name
@@ -75,10 +75,7 @@ action = function()
end
stdnse.print_debug(1, "iface: %s", iface.device)
local timeout = 10 * 1000
if arg_timeout then
timeout = arg_timeout * 1000
end
local timeout = (arg_timeout or 10) * 1000
stdnse.print_debug(2, "timeout: %s", timeout)

View File

@@ -27,9 +27,9 @@ Based on old ftp-brute.nse script by Diman Todorov, Vlatko Kosturjak and Ron Bow
-- | Statistics
-- |_ Performed 510 guesses in 610 seconds, average tps: 0
--
-- @args timeout the amount of seconds to wait for a response on the socket.
-- @args ftp-brute.timeout the amount of time to wait for a response on the socket.
-- Lowering this value may result in a higher throughput for servers
-- having a delayed response on incorrect login attempts. (default: 5)
-- having a delayed response on incorrect login attempts. (default: 5s)
author = "Aleksandar Nikolic"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
@@ -37,7 +37,8 @@ categories = {"intrusive", "brute"}
portrule = shortport.port_or_service(21, "ftp")
local arg_timeout = stdnse.get_script_args(SCRIPT_NAME .. ".timeout") or 5
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
arg_timeout = (arg_timeout or 5) * 1000
Driver = {
@@ -53,7 +54,7 @@ Driver = {
connect = function( self )
self.socket = nmap.new_socket()
local status, err = self.socket:connect(self.host, self.port)
self.socket:set_timeout(tonumber(arg_timeout) * 1000)
self.socket:set_timeout(arg_timeout)
if(not(status)) then
return false, brute.Error:new( "Couldn't connect to host: " .. err )
end

View File

@@ -20,6 +20,7 @@ Retrieves GPS time, coordinates and speed from the GPSD network daemon.
-- | Coordinates: 59.321685,17.886493
-- |_ Speed: - knots
--
-- @args gpsd-info.timeout timespec defining how long to wait for data (default 10s)
author = "Patrik Karlsson"
@@ -29,7 +30,8 @@ categories = {"discovery", "safe"}
portrule = shortport.port_or_service(2947, "gpsd-ng", "tcp")
local arg_timeout = tonumber(stdnse.get_script_args(SCRIPT_NAME .. ".timeout")) or 10
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
arg_timeout = arg_timeout or 10
local function updateData(gpsinfo, entry)
for k, v in pairs(gpsinfo) do

View File

@@ -27,7 +27,7 @@ Additional documents: https://tools.ietf.org/rfc/rfc6104.txt
---
-- @args ipv6-ra-flood.interface defines interface we should broadcast on
-- @args ipv6-ra-flood.timeout runs the script until the timeout (in seconds) is reached (default: 30s). If timeout is zero, the script will run forever.
-- @args ipv6-ra-flood.timeout runs the script until the timeout is reached (default: 30s). If timeout is zero, the script will run forever.
--
-- @usage
-- nmap -6 --script ipv6-ra-flood.nse
@@ -131,7 +131,8 @@ local function broadcast_on_interface(iface)
-- packet counter
local counter = 0
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME..".timeout") or "30s")
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME..".timeout"))
arg_timeout = arg_timeout or 30
local dnet = nmap.new_dnet()

View File

@@ -24,8 +24,7 @@ For more information, see:
---
--@args llmnr-resolve.hostname Hostname to resolve.
--
--@args llmnr-resolve.timeout Max time to wait for a response. Defaults to
-- <code>3</code> seconds.
--@args llmnr-resolve.timeout Max time to wait for a response. (default 3s)
--
--@usage
-- nmap --script llmnr-resolve --script-args 'llmnr-resolve.hostname=examplename' -e wlan0
@@ -164,9 +163,9 @@ end
action = function()
local timeout = tonumber(stdnse.get_script_args(SCRIPT_NAME .. ".timeout")) or 3
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
timeout = (timeout or 3) * 1000
local hostname = stdnse.get_script_args(SCRIPT_NAME .. ".hostname")
timeout = timeout * 1000
local result, output = {}, {}
local mcast = "224.0.0.252"
local mport = 5355

View File

@@ -21,7 +21,8 @@ http://www.microsoft.com/whdc/connect/Rally/LLTD-spec.mspx
-- @usage
-- nmap -e <interface> --script lltd-discovery
--
-- @arg interface, a string specifying which interface to do lltd discovery on. If not specified, all ethernet interfaces are tried.
-- @args lltd-discovery.interface string specifying which interface to do lltd discovery on. If not specified, all ethernet interfaces are tried.
-- @args lltd-discover.timeout timespec specifying how long to listen for replies (default 30s)
--
-- @output
-- | lltd-discovery:
@@ -258,12 +259,9 @@ end
action = function()
local timeout = stdnse.get_script_args(SCRIPT_NAME..".timeout")
if timeout then
timeout = tonumber(timeout)
else
timeout = 30
end
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME..".timeout"))
timeout = timeout or 30
--get interface script-args, if any
local interface_arg = stdnse.get_script_args(SCRIPT_NAME .. ".interface")
local interface_opt = nmap.get_interface()

View File

@@ -15,7 +15,7 @@ http://mobilemouse.com/
---
-- @usage
-- nmap --script mobilemouse-brute -p 51010 <host>
-- nmap --script mmouse-brute -p 51010 <host>
--
-- @output
-- PORT STATE SERVICE
@@ -26,6 +26,7 @@ http://mobilemouse.com/
-- | Statistics
-- |_ Performed 1199 guesses in 23 seconds, average tps: 47
--
-- @args mmouse-brute.timeout socket timeout (milliseconds) for connecting to Mobile Mouse (default 5000)
author = "Patrik Karlsson"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"

View File

@@ -25,8 +25,8 @@ Cisco IOS.
-- @args mrinfo.target Host to which the request is sent. If not set, the
-- request will be sent to <code>224.0.0.1</code>.
--
-- @args mrinfo.timeout Time to wait for responses in seconds.
-- Defaults to <code>5</code> seconds.
-- @args mrinfo.timeout Time to wait for responses.
-- Defaults to <code>5s</code>.
--
--@usage
-- nmap --script mrinfo
@@ -242,11 +242,11 @@ local getInterface = function(target)
end
action = function()
local timeout = tonumber(stdnse.get_script_args(SCRIPT_NAME .. ".timeout")) or 5
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
timeout = (timeout or 5) * 1000
local target = stdnse.get_script_args(SCRIPT_NAME .. ".target") or "224.0.0.1"
local responses = {}
local interface, result
timeout = timeout * 1000
interface = nmap.get_interface()
if interface then

View File

@@ -33,8 +33,8 @@ This is similar to the mtrace utility provided in Cisco IOS.
--@args mtrace.firsthop Host to which the query is sent. If not set, the
-- query will be sent to <code>224.0.0.2</code>.
--
--@args mtrace.timeout Time to wait for responses in seconds.
-- Defaults to <code>7</code> seconds.
--@args mtrace.timeout Time to wait for responses.
-- Defaults to <code>7s</code>.
--
--@usage
-- nmap --script mtrace --script-args 'mtrace.fromip=172.16.45.4'
@@ -324,9 +324,9 @@ action = function()
local toip = stdnse.get_script_args(SCRIPT_NAME .. ".toip")
local group = stdnse.get_script_args(SCRIPT_NAME .. ".group") or "0.0.0.0"
local firsthop = stdnse.get_script_args(SCRIPT_NAME .. ".firsthop") or "224.0.0.2"
local timeout = tonumber(stdnse.get_script_args(SCRIPT_NAME .. ".timeout")) or 7
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
local responses = {}
timeout = timeout * 1000
timeout = (timeout or 7) * 1000
-- Source address from which to traceroute
if not fromip then

View File

@@ -20,6 +20,8 @@ Performs password guessing against MySQL.
-- | mysql-brute:
-- | Accounts
-- | root:root - Valid credentials
--
-- @args mysql-brute.timeout socket timeout for connecting to MySQL (default 5s)
author = "Patrik Karlsson"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
@@ -34,7 +36,8 @@ categories = {"intrusive", "brute"}
portrule = shortport.port_or_service(3306, "mysql")
local arg_timeout = stdnse.get_script_args(SCRIPT_NAME .. ".timeout") or 5
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
arg_timeout = (arg_timeout or 5) * 1000
Driver = {
@@ -50,7 +53,7 @@ Driver = {
connect = function( self )
self.socket = nmap.new_socket()
local status, err = self.socket:connect(self.host, self.port)
self.socket:set_timeout(tonumber(arg_timeout) * 1000)
self.socket:set_timeout(arg_timeout)
if(not(status)) then
return false, brute.Error:new( "Couldn't connect to host: " .. err )
end

View File

@@ -35,6 +35,8 @@ http://seclists.org/fulldisclosure/2012/Dec/9
-- | test_mysql:<empty> - Valid credentials
-- | Statistics
-- |_ Performed 11 guesses in 1 seconds, average tps: 11
--
-- @args mysql-enum.timeout socket timeout for connecting to MySQL (default 5s)
author = "Aleksandar Nikolic"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
@@ -42,7 +44,8 @@ categories = {"intrusive", "brute"}
portrule = shortport.port_or_service(3306, "mysql")
local arg_timeout = stdnse.get_script_args(SCRIPT_NAME .. ".timeout") or 5
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
arg_timeout = (arg_timeout or 5) * 1000
Driver = {
@@ -58,7 +61,7 @@ Driver = {
connect = function( self )
self.socket = nmap.new_socket()
local status, err = self.socket:connect(self.host, self.port)
self.socket:set_timeout(tonumber(arg_timeout) * 1000)
self.socket:set_timeout(arg_timeout)
if(not(status)) then
return false, brute.Error:new( "Couldn't connect to host: " .. err )
end

View File

@@ -64,9 +64,9 @@ Interesting post about this vuln:
-- | http://seclists.org/oss-sec/2012/q2/493
-- |_ http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-2122
--
-- @args mysql-cve2012-2122.user MySQL username. Default: root.
-- @args mysql-cve2012-2122.iterations Connection retries. Default: 1500.
-- @args mysql-cve2012-2122.socket_timeout Socket timeout. Default: 5000.
-- @args mysql-vuln-cve2012-2122.user MySQL username. Default: root.
-- @args mysql-vuln-cve2012-2122.iterations Connection retries. Default: 1500.
-- @args mysql-vuln-cve2012-2122.socket_timeout Socket timeout (milliseconds). Default: 5000.
---
local mysql = require "mysql"

View File

@@ -20,6 +20,7 @@ Performs brute force password auditing against a Nessus vulnerability scanning d
-- |_ Performed 1933 guesses in 26 seconds, average tps: 73
--
-- @args nessus-xmlrpc-brute.threads sets the number of threads.
-- @args nessus-xmlrpc-brute.timeout socket timeout (milliseconds) for connecting to Nessus (default 5000)
author = "Patrik Karlsson"

View File

@@ -28,6 +28,8 @@ some time until server becomes available again.
-- | administrator:administrator - Valid credentials
-- | Statistics
-- |_ Performed 2 guesses in 55 seconds, average tps: 0
--
-- @args pcanywhere-brute.timeout socket timeout for connecting to PCAnywhere (default 10s)
author = "Aleksandar Nikolic"
@@ -37,7 +39,8 @@ categories = {"intrusive", "brute"}
portrule = shortport.port_or_service(5631, "pcanywheredata")
local arg_timeout = stdnse.get_script_args(SCRIPT_NAME .. ".timeout") or 10
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
arg_timeout = (arg_timeout or 10) * 1000
-- implements simple xor based encryption which the server expects
local function encrypt(data)
@@ -78,7 +81,7 @@ Driver = {
-- variable "retry" signifies if we need to wait or this is just not pcAnywhere server
while not status do
status, err = self.socket:connect(self.host, self.port)
self.socket:set_timeout(tonumber(arg_timeout) * 1000)
self.socket:set_timeout(arg_timeout)
if(not(status)) then
return false, brute.Error:new( "Couldn't connect to host: " .. err )
end

View File

@@ -21,7 +21,7 @@ Performs brute force password auditing against the classic UNIX rexec (remote ex
-- | Statistics
-- |_ Performed 16 guesses in 7 seconds, average tps: 2
--
-- @args rexec-brute.timeout number
-- @args rexec-brute.timeout socket timeout for connecting to rexec (default 10s)
-- Version 0.1
-- Created 11/02/2011 - v0.1 - created by Patrik Karlsson <patrik@cqure.net>
@@ -85,16 +85,14 @@ Driver = {
}
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
arg_timeout = (arg_timeout or 10) * 1000
action = function(host, port)
local options = {
timeout = stdnse.get_script_args("rexec-brute.timeout")
timeout = arg_timeout
}
options.timeout = options.timeout and
tonumber(options.timeout) * 1000 or
10000
local engine = brute.Engine:new(Driver, host, port, options)
engine.options.script_name = SCRIPT_NAME
local status, result = engine:start()

View File

@@ -22,7 +22,7 @@ Performs brute force password auditing against the classic UNIX rlogin (remote l
-- | Statistics
-- |_ Performed 4 guesses in 5 seconds, average tps: 0
--
-- @args rlogin-brute.timeout number
-- @args rlogin-brute.timeout socket timeout for connecting to rlogin (default 10s)
-- Version 0.1
-- Created 11/02/2011 - v0.1 - created by Patrik Karlsson <patrik@cqure.net>
@@ -138,6 +138,9 @@ Driver = {
end,
}
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
arg_timeout = (arg_timeout or 10) * 1000
action = function(host, port)
if ( not(nmap.is_privileged()) ) then
@@ -145,13 +148,9 @@ action = function(host, port)
end
local options = {
timeout = stdnse.get_script_args("rlogin-brute.timeout")
timeout = arg_timeout
}
options.timeout = options.timeout and
tonumber(options.timeout) * 1000 or
10000
local engine = brute.Engine:new(Driver, host, port, options)
engine.options.script_name = SCRIPT_NAME
local status, result = engine:start()

View File

@@ -26,7 +26,7 @@ Timeout (408) or Hang up (200).
--@args sip-call-spoof.src Source address to spoof.
--
--@args sip-call-spoof.timeout Time to wait for a response. Defaults to
-- <code>5</code> seconds.
-- <code>5s</code>
--
-- @usage
-- nmap --script=sip-call-spoof -sU -p 5060 <targets>
@@ -133,14 +133,10 @@ action = function(host, port)
local from = stdnse.get_script_args(SCRIPT_NAME .. ".from") or "Home"
local src = stdnse.get_script_args(SCRIPT_NAME .. ".src")
local extension = stdnse.get_script_args(SCRIPT_NAME .. ".extension") or 100
local timeout = tonumber(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
local timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. ".timeout"))
-- Default timeout value = 5 seconds.
if timeout then
timeout = timeout * 1000
else
timeout = 5000
end
timeout = (timeout or 5) * 1000
session = sip.Session:new(host, port)
status = session:connect()

View File

@@ -22,8 +22,8 @@ Attempts to discover available IPv6 hosts on the LAN by sending an MLD (multicas
-- |
-- |_ Use --script-args=newtargets to add the results as targets
--
-- @args targets-ipv6-multicast-mld.timeout timeout in seconds to wait for
-- responses (default: 10)
-- @args targets-ipv6-multicast-mld.timeout timeout to wait for
-- responses (default: 10s)
--
author = "niteesh"
@@ -31,7 +31,7 @@ license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery","broadcast"}
local arg_timeout = tonumber(stdnse.get_script_args(SCRIPT_NAME .. '.timeout'))
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME .. '.timeout'))
prerule = function()
if ( not(nmap.is_privileged()) ) then

View File

@@ -79,9 +79,8 @@ action = function()
local sock = nmap.new_socket()
local packet_counter = 0
local ip_counter = 0
local DEFAULT_TIMEOUT_SEC = 10 -- Default timeout value in seconds if the timeout argument is not specified
local timeoutstr = stdnse.get_script_args("targets-sniffer.timeout") or tostring(DEFAULT_TIMEOUT_SEC)
local timeout = (stdnse.parse_timespec(timeoutstr) * 1000)
local timeout = stdnse.parse_timespec(stdnse.get_script_args("targets-sniffer.timeout"))
timeout = (timeout or 10) * 1000
local interface = stdnse.get_script_args("targets-sniffer.iface") or nmap.get_interface()
interface_info = nmap.get_interface_info(interface)

View File

@@ -24,10 +24,11 @@ ctrl+break is issued, by setting the timeout to 0.
-- | url-snarf:
-- |_ Sniffed 169 URLs in 5 seconds
--
-- @arg timeout runs the script until the timeout (in seconds) is reached.
-- @args url-snarf.timeout runs the script until the timeout is reached.
-- a timeout of 0s can be used to run until ctrl+break. (default: 30s)
-- @arg nostdout doesn't write any output to stdout while running
-- @arg outfile filename to which all discovered URLs are written
-- @args url-snarf.nostdout doesn't write any output to stdout while running
-- @args url-snarf.outfile filename to which all discovered URLs are written
-- @args url-snarf.interface interface on which to sniff (overrides <code>-e</code>)
--
author = "Patrik Karlsson"
@@ -85,7 +86,8 @@ local function get_url(data)
return u
end
local arg_timeout = tonumber(stdnse.get_script_args(SCRIPT_NAME..".timeout")) or 30
local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME..".timeout"))
arg_timeout = arg_timeout or 30
local arg_nostdout= stdnse.get_script_args(SCRIPT_NAME..".nostdout")
local arg_outfile = stdnse.get_script_args(SCRIPT_NAME..".outfile")