Nmap Development mailing list archives
Re: Persistent NSE registry
From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Tue, 18 Nov 2008 13:35:46 -0700
On Tue, Nov 18, 2008 at 12:57 PM, David Fifield <david () bamsoftware com> wrote:
On Tue, Nov 18, 2008 at 01:08:13AM -0700, Patrick Donnelly wrote:o What should happen if a script scan is aborted? Perhaps the Lua State was left corrupt?That is a concern. Really the only thing I want to persist across script scans is the registry. Everything else can be reinitialized.
You either must keep the state or serialize the registry across script scans. I'm not sure myself what all the ramifications are for keeping the state for each script_scan. I'm not sure that there are any initialization concerns. My worry is handling the cases where an error was caught by the engine and the scan was aborted. Should anymore scans be run?
o These two lines: lua_settop(L, 0); // safety, is 0 anyway lua_rawgeti(L, LUA_REGISTRYINDEX, errfunc); // index 1 should be executed each time a script_scan is run. It is possible something was left on the stack from previous runs.I don't understand what the line lua_rawgeti(L, LUA_REGISTRYINDEX, errfunc); // index 1 does. It pushes error_function on the stack, but then what? It doesn't seem to do anything with it. Is this maybe some old code that didn't get updated or do I just not understand?
The error function is used for lua_pcall [1] (used later in the code). The error function executed before the stack is unwound is at index 1 (the final argument to lua_pcall). [1] http://www.lua.org/manual/5.1/manual.html#lua_pcall -- -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 _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Persistent NSE registry David Fifield (Nov 17)
- Re: Persistent NSE registry Patrick Donnelly (Nov 17)
- Re: Persistent NSE registry David Fifield (Nov 18)
- Re: Persistent NSE registry Patrick Donnelly (Nov 18)
- Re: Persistent NSE registry David Fifield (Nov 18)
- Re: Persistent NSE registry David Fifield (Nov 18)
- Re: Persistent NSE registry Patrick Donnelly (Nov 17)