Nmap Development mailing list archives

Re: [NSE] Syntax error messages and help finding them.


From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Thu, 7 Aug 2008 06:35:43 -0600

On Wed, Aug 6, 2008 at 8:53 PM, jah <jah () zadkiel plus com> wrote:
Hello,

If one makes a syntax error that prevents an NSE script from loading one
would see the following:

SCRIPT ENGINE: error while initializing script rules:
'C:\Program Files\Nmap\dev\foo.nse' could not be loaded!
stack traceback:
       [C]: ?
       [C]: ?

SCRIPT ENGINE: Aborting script scan.

This certainly applies to windows, I don't know if there's any more
detail shown when this happens on other OSes. I've attached a quick
script for those that would like to find out - it uses an assignment
operator where it should use comparison.

Using Nmap 4.53 the error message pointed to the actual mistake:

LUA INTERPRETER in ..\nse_init.cc:760: C:\Program
Files\Nmap\dev\foo.nse:11: 'end' expected (to close 'function' at line
 10) near '='
SCRIPT ENGINE: Aborting script scan.

Both of these messages are helpful, but I've often spent ages hunting
through lines of script trying to find the source of the error and have
wished many times for that LUA INTERPRETER message to point me at a mistake.

If these two messages could be combined I think it would be really
beneficial and especially so for users who are new to NSE scripting.


Regards,


jah

Hi Jah,

I've added the error messages to the output now. Please give it a try!

Thanks,

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