Nmap Development mailing list archives

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


From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Wed, 24 Sep 2008 12:29:00 -0600

On Wed, Sep 24, 2008 at 11:48 AM, David Fifield <david () bamsoftware com> wrote:
Sven, is there a way to check if require("openssl") failed by actually
trying it, rather than predicting it will fail with nmap.have_ssl?

pcall(require, "openssl")

I
mean, run require("openssl") and somehow catch any error. That would
make the technique more general and it could become the recommended way
to handle scripts which use any optional modules.

David Fifield

What you guys are proposing doesn't sound any different from what I
did except the way it is handled. The alternate methods proposed,
particularly:

-portrule = shortport.port_or_service(22, "ssh")
+if nmap.have_ssl() then
+  require("openssl")
+  portrule = shortport.port_or_service(22, "ssh")
+else
+  portrule = function() return false end
+end

makes the script not run. The patch I made does the same thing _and_
tells the user the script failed due to X dependency provided the
verbosity is high enough. I'm not sure what you guys are really
looking for.

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