From 68186c20079318b5252082ff7c813e49d6ce4ca4 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 13 Apr 2010 20:01:38 +0000 Subject: [PATCH] Use parse_timespec in unpwdb.lua. --- nselib/unpwdb.lua | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/nselib/unpwdb.lua b/nselib/unpwdb.lua index 5b758f2b1..139301461 100644 --- a/nselib/unpwdb.lua +++ b/nselib/unpwdb.lua @@ -46,21 +46,21 @@ -- -- @usage -- nmap --script-args userdb=/tmp/user.lst --- nmap --script-args unpwdb.timelimit=500 +-- nmap --script-args unpwdb.timelimit=10m -- -- @args userdb The filename of an alternate username database. -- @args passdb The filename of an alternate password database. -- @args unpwdb.userlimit The maximum number of usernames --- usernames will return --- (default unlimited). +-- usernames will return (default unlimited). -- @args unpwdb.passlimit The maximum number of passwords --- passwords will return --- (default unlimited). --- @args unpwdb.timelimit The maximum amount of time (in seconds) that any --- iterator will run before stopping. The default --- depends on the timing template level (see the module --- description). Use the value 0 to disable --- the time limit. +-- passwords will return (default unlimited). +-- @args unpwdb.timelimit The maximum amount of time that any iterator will run +-- before stopping. The value is in seconds by default and you can follow it +-- with ms, s, m, or h for +-- milliseconds, seconds, minutes, or hours. For example, +-- unpwdb.timelimit=30m or unpwdb.timelimit=.5h for +-- 30 minutes. The default depends on the timing template level (see the module +-- description). Use the value 0 to disable the time limit. -- @author Kris Katterjohn 06/2008 -- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html @@ -156,7 +156,10 @@ timelimit = function() return nil end if args["unpwdb.timelimit"] then - return tonumber(args["unpwdb.timelimit"]) + local limit, err = stdnse.parse_timespec(args["unpwdb.timelimit"]) + if not limit then + error(err) + end end if t <= 3 then