Home page logo
/

nmap-dev logo Nmap Development mailing list archives

[NSE] Better Handling for Require Errors
From: Patrick Donnelly <batrick () batbytes com>
Date: Mon, 28 Mar 2011 13:02:53 -0400

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].

To quote the rationale for why scripts started pcall'ing require:

"I think in the past we decided it was decided that errors thrown this
way can't be used because it ends up aborting the entire scan. In
earlier versions of NSE, this would actually occur in the middle of a
scan which made it *really* annoying. Now we have NSE loaded at Nmap
startup so this isn't quite as big an issue."

So, because NSE now loads scripts at Nmap startup, aborting mid-scan
is no longer a problem.

Still, we don't want a script that fails to load, because of a missing
library, preventing from NSE from continuing. So I made it so these
errors are ignored (but debug output is still produced).

I haven't messed with any of the libraries doing this. I can't tell
from a cursory glance if they still intend to offer partial
functionality despite X library (e.g. openssl) not being available.

Patch is attached.

[1] http://seclists.org/nmap-dev/2011/q1/963

-- 
- Patrick Donnelly

Attachment: require-errors.patch
Description:

_______________________________________________
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:
  • [NSE] Better Handling for Require Errors Patrick Donnelly (Mar 28)
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault