Nmap Development mailing list archives

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


From: jah <jah () zadkiel plus com>
Date: Sat, 09 Aug 2008 23:54:19 +0100

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.


Regards,
 
 
jah
--- showSMTPVersion.nse.orig    2008-06-14 20:35:10.171875000 +0100
+++ showSMTPVersion.nse 2008-08-09 23:51:48.640625000 +0100
@@ -20,6 +20,6 @@
                return
        end
 
-       return string.gsub(result, "\n", "")
+       return ( string.gsub(result, "\n", "") )
 end
 

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

Current thread: