Nmap Development mailing list archives

Re: [NSE] Multiple return values from action. Scripts without id.


From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Sat, 9 Aug 2008 18:43:41 -0600

On Sat, Aug 9, 2008 at 4:54 PM, jah <jah () zadkiel plus com> wrote:
Hello nmappers,


Attached is a small patch for showSMTPversion.nse which prevents its
action() from returning two values:

return string.gsub(result, "\n", "")

Both a string and the number of replacements made are returned and this
results in some weirdness which I've not been able to fix:

Initiating SCRIPT ENGINE at 23:51
SCRIPT ENGINE: The script has no 'id' entry, the 'filename' entry was
changed to:
nil
SCRIPT ENGINE: Script scanning completed.
SCRIPT ENGINE: Aborting script scan.

The script has an id and there's nothing wrong with the filename
(matches the entry in scripts.db).   It seems that when action() returns
two results it somehow messes with the Lua stack (or something like
that) and process_getScriptId() in nse_main.cc results in script abortion.


Whilst fiddling, I found that (on windows at least) the script filepath
(rather than just the filename) is output in the script results if the
script does not have either an id or filename field.  I'm not sure if
that is the intention - I thought I'd mention it anyway.

Thank you Jah for locating this. Currently there is a unofficial rule
that a script may only return one value. This will be changed when
time permits.

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: