Nmap Development mailing list archives

Re: A sleep function for NSE


From: David Fifield <david () bamsoftware com>
Date: Mon, 23 Feb 2009 16:58:22 -0700

On Wed, Feb 18, 2009 at 01:24:02PM -0700, David Fifield wrote:
One of the Nmap TODO items is a sleep function for NSE. Such a function
allows rate-limiting traffic for politeness or to avoid triggering some
filter. The attached stdnse.sleep.diff implements such a function.

Even though sleep is implemented through Lua's C API, I put in in
stdnse, which is otherwise a pure Lua module. I originally put it in the
nmap module just because that is already a C module and it was easy to
implement there. But then I reflected that sleep doesn't fit the
description of the nmap module: "an interface with Nmap's internal
functions and data structures." Looking at the other modules I though
that stdnse was the best fit.

This trick is accomplished by loading sleep into a private stdnse.c
module. stdnse.lua requires this module, then transfers its contents
into its own namespace; i.e., stdnse.c.sleep becomes stdnse.sleep. What
do you think? I think we should group functions by what they do, not by
what language they happen to be implemented in, whenever possible. The
person calling stdnse.sleep likely doesn't care if it's written in Lua
or C.

I committed this in r12270.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: