Nmap Development mailing list archives

Re: [RFC] Basing timeouts in NSE on host.times.timeout


From: Patrick Donnelly <batrick () batbytes com>
Date: Fri, 1 Aug 2014 11:12:04 -0400

Hi Daniel,

On Fri, Aug 1, 2014 at 12:00 AM, Daniel Miller <bonsaiviking () gmail com> wrote:
List,

Right now, there are several sources of default timeouts on socket
operations within NSE:

* A socket created by nmap.new_socket() has a timeout of 30 seconds
* The sockets used in the comm.lua library have 8-second timeouts
* of all the calls to set_timeout, a plurality (44%) are 5 seconds, with
the remaining 56% evenly split between 10 seconds and other times (ranging
from 10ms to 50s)

In a large number of these cases (portrule and hostrule scripts), the
socket is intended to communicate with a port on a host for which Nmap
already has a timeout calculated, reported via the host.times.timeout
variable. It seems to me like a lot of these timeouts could be replaced
with:

--was: socket:set_timeout(8000)
socket:set_timeout(((host.times and host.times.timeout) or 8) * 1000)

Obviously this would not work for prerule, postrule, or external scripts.
But I think it's probably a huge improvement over the default 30-second
timeout!

Does anyone have thoughts or concerns regarding this approach?

I really like the idea. My only concern is that perhaps
host.times.timeout may be too exact and perhaps we should add a few
seconds? Or does it already include some wiggle-room?

-- 
Patrick Donnelly
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: