Nmap Development mailing list archives

[NSE] Large recode for nse_main (test please)


From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Tue, 3 Jun 2008 02:33:44 -0600

Hi,

Attached is a patch against Nmap 4.65. The patch improves NSE's
interface with Lua, especially in critical regions (particularly where
threads are manipulated). The changes also consist of optimizing how
memory/information is managed for each thread. Some highlights:

1) A userdata is created for each Target. This userdata, when
collected (through __gc), let's us stop the time out clock for that
target. This alleviates the need to loop through all the threads
checking if a Target is finished.
2) Each thread for a script has it's own action closure and environment.
3) The need to remember the number of arguments for resuming scripts
has been eliminated, simply calling lua_gettop(thread) for resume will
let you resume the script correctly.
4) Running/Waiting Threads are no longer stored in a "queue". They are
simply stored in a hash table. Mainloop will now iterate over all the
threads in running and only then add waiting threads ready to move
into running.
5) While C++ managed a lot of the memory for a script through
structures and lists, it is now handled through Lua. This reduces the
upkeep for us and allows the information to always be readily
accessible (strings, tables, etc.).
6) nse_string.* has been removed. NSE now uses Lua to form printable
output and a simpler hexify procedure has been made and moved to NSE's
nsock library.

Cheers,

-- 
-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."

-Will Durant

Attachment: nse.patch
Description:


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

Current thread: