Nmap Development mailing list archives

Re: A few NSE errors


From: Daniel Miller <bonsaiviking () gmail com>
Date: Wed, 06 Jun 2012 17:20:21 -0500

I see easy fixes to a few of these, but I don't have time to get to the rest. Patches inlined...

On 06/06/2012 04:44 PM, Ron wrote:
Here are some NSE errors I've run into scanning the Internet:

  NSE: afp-serverinfo against x.x.x.x:548 threw an error! scripts/afp-serverinfo.nse:83: variable 'response' is not 
declared
diff --git a/scripts/afp-serverinfo.nse b/scripts/afp-serverinfo.nse
index ce4689f..b5ba213 100644
--- a/scripts/afp-serverinfo.nse
+++ b/scripts/afp-serverinfo.nse
@@ -71,9 +71,9 @@ action = function(host, port)
   try( socket:connect(host, port) )

   -- get our data
-  afp_proto = afp.Proto:new( { socket=socket } )
+  local afp_proto = afp.Proto:new( { socket=socket } )

-  response = afp_proto:fp_get_server_info( socket )
+  local response = afp_proto:fp_get_server_info( socket )
   response = response.result

-- all the server information is output in the order it occurs in the server

  NSE: ajp-auth against x.x.x.x:8009 threw an error! scripts/ajp-auth.nse:37: attempt to index upvalue 'ajp' (a boolean 
value)
  NSE: ajp-methods against x.x.x.x:8009 threw an error! scripts/ajp-methods.nse:60: attempt to index upvalue 'ajp' (a 
boolean value)

diff --git a/nselib/ajp.lua b/nselib/ajp.lua
index cd9a2f3..56d5b4e 100644
--- a/nselib/ajp.lua
+++ b/nselib/ajp.lua
@@ -521,3 +521,5 @@ Helper = {
        end,

 }
+
+return _ENV

  NSE: ip-geolocation-geobytes against x.x.x.x threw an error! nselib/json.lua:35: variable 'arg' is not declared
(I'm not actually sure about this, but I think it's right)
diff --git a/nselib/json.lua b/nselib/json.lua
index 233122b..fe13640 100644
--- a/nselib/json.lua
+++ b/nselib/json.lua
@@ -32,18 +32,18 @@ _ENV = stdnse.module("json", stdnse.seeall)

 --Some local shortcuts
 local function dbg(str,...)
-       stdnse.print_debug("Json:"..str, table.unpack(arg))
+       stdnse.print_debug("Json:"..str, table.unpack(...))
 end
 local function d4(str,...)
-       if nmap.debugging() > 3 then dbg(str,table.unpack(arg)) end
+       if nmap.debugging() > 3 then dbg(str,table.unpack(...)) end
 end
 local function d3(str,...)
-       if nmap.debugging() > 2 then dbg(str,table.unpack(arg)) end
+       if nmap.debugging() > 2 then dbg(str,table.unpack(...)) end
 end

 --local dbg =stdnse.print_debug
 local function dbg_err(str,...)
-       stdnse.print_debug("json-ERR:"..str, table.unpack(arg))
+       stdnse.print_debug("json-ERR:"..str, table.unpack(...))
 end

  -- Javascript null representation, see explanation above

  NSE: ip-geolocation-maxmind against x.x.x.x threw an error! scripts/ip-geolocation-maxmind.nse:405: Cannot open 
Maxmind database file
I think this is expected, since you didn't provide a filename for the MaxMind database. Maybe the check for that script-arg could be put in the hostrule to avoid running the action function at all?
  NSE: ssl-cert against x.x.x.x:5222 threw an error! nselib/xmpp.lua:169: Cannot connect to XMPP server without valid 
server name
  NSE: ssl-cert against x.x.x.x:5269 threw an error! nselib/xmpp.lua:169: Cannot connect to XMPP server without valid 
server name
I already looked into this one, and I can't come up with a cleaner way of exiting. It's an expected failure since no server name was provided. Currently it tries to use the script-arg then the targetname (as specified on the command line). I think another decent fallback would be the reverse-lookup name if available.

If you'd like more info on any of those, let me know!

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

And of course, I was beat to the punch by the inestimable Patrik Karlsson. Sending anyway, in case he missed any of these.

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


Current thread: