Nmap Development mailing list archives

Re: [NSE][PATCH] only show script errors in verbose mode


From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Fri, 26 Sep 2008 21:40:13 -0600

On Fri, Sep 26, 2008 at 8:54 PM, David Fifield <david () bamsoftware com> wrote:
On Fri, Sep 26, 2008 at 01:06:30PM -0600, Patrick Donnelly wrote:
On Fri, Sep 26, 2008 at 12:26 PM, David Fifield <david () bamsoftware com> wrote:
How about just creating a new C type, say nmap.error, each instance of
which would be associated with a certain metatable (so we could do
luaL_checkudata on it), and which would allow a custom string for each
instance. I was reading http://www.lua.org/pil/28.2.html and it appears
to be just what we need.

Well yes, we want a class of errors. As I showed earlier, we have each
userdata used as a unique key in the errors table. If, when we index a
userdata thrown by an error, we get nil, then it is _not_ one of our
module errors (it is just a different kind of error).

I attached a sample implementation, that just defines a simple
nmap.error type and a function nmap.quiet_error to raise one with a
custom string. Does this seems like a decent approach? It raises an
error that is handled like any other error (it doesn't just make the
portrule return false), except that it's not printed by default.

This sounds fine. The quiet error implementation looks good enough.

-- 
-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: