Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: [NSE] Better Handling for Require Errors
From: Patrick Donnelly <batrick () batbytes com>
Date: Wed, 8 Jun 2011 13:11:53 -0400

On Wed, Jun 8, 2011 at 2:12 AM, David Fifield <david () bamsoftware com> wrote:
On Wed, May 04, 2011 at 05:07:57PM -0400, Patrick Donnelly wrote:
On Mon, Mar 28, 2011 at 1:02 PM, Patrick Donnelly <batrick () batbytes com> wrote:
So I wrote up a quick patch to make require errors easier for scripts.
Basically, you can now require libraries that may not exist without
having to use pcall. See also [1].

This is committed as of revision 23085. The "root" module has been
removed in favor of keeping the check for root access in the rule
function. The require function has been modified so that NSE can
silently catch require errors. If you want/need to use the real
require function, it is available as stdnse.require.

This can cause some confusion during --script-updatedb. There was an
error in ncp.lua where "ipOps" was written "ipops" and failed to import
on a case-sensistive filesystem. The quiet require errors led to a
confusing error message:

$ ./nmap --script-updatedb

Starting Nmap 5.51SVN ( http://nmap.org ) at 2011-06-07 23:08 PDT
NSE: Updating rule database.
NSE: failed to initialize the script engine:
/home/david/nmap-git/nse_main.lua:1017: attempt to index local 'script' (a nil value)
stack traceback:
       /home/david/nmap-git/nse_main.lua:1017: in main chunk
       [C]: ?

QUITTING!

Running with -d shows a stack trace and makes it more obvious what the
problem is ("module 'ipops' not found"), but can we do anything about
this?

Would artificially upping the debug level be acceptable when updating
the database?

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

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]