mirror of
https://github.com/nmap/nmap.git
synced 2025-12-24 00:19:01 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user