diff --git a/CHANGELOG b/CHANGELOG index 664afb067..e05b58b04 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,11 @@ o Updated rpcinfo.nse to use nmap.fetchfile() to read from nmap-rpc instead of having a huge table of RPC numbers. This reduced the script's size by nearly 3/4. [Kris] +o Fixed multiple NSE scripts that weren't always properly closing their + sockets. The error message was: + "bad argument #1 to 'close' (nsock expected, got no value)" + [Kris] + 4.51BETA o We now have a detailed Zenmap Guide at diff --git a/scripts/SMTPcommands.nse b/scripts/SMTPcommands.nse index 87747b080..81086e55d 100644 --- a/scripts/SMTPcommands.nse +++ b/scripts/SMTPcommands.nse @@ -48,7 +48,7 @@ action = function(host, port) result1 = try(socket:receive_lines(1)) if not string.match(result1, "^250") then - socket.close() + socket:close() -- TODO: use print_debug instead return "EHLO with errors or timeout. Enable --script-trace to see what is happening." end @@ -70,7 +70,7 @@ action = function(host, port) result2 = try(socket:receive_lines(1)) if not string.match(result2, "^214") then - socket.close() + socket:close() -- TODO: use print_debug instead return "HELP with errors or timeout. Enable --script-trace to see what is happening." end diff --git a/scripts/SQLInject.nse b/scripts/SQLInject.nse index b4ed5a543..dc68fad92 100644 --- a/scripts/SQLInject.nse +++ b/scripts/SQLInject.nse @@ -41,7 +41,7 @@ local maxdepth = 10 local get_page_from_host local soc -local catch = function() soc.close() end +local catch = function() soc:close() end local try = nmap.new_try(catch) portrule = shortport.service("http") diff --git a/scripts/bruteTelnet.nse b/scripts/bruteTelnet.nse index 8a84b0c3c..712913b83 100644 --- a/scripts/bruteTelnet.nse +++ b/scripts/bruteTelnet.nse @@ -9,7 +9,7 @@ require('stdnse') require('strbuf') local soc -local catch = function() soc.close() end +local catch = function() soc:close() end local try = nmap.new_try(catch) portrule = shortport.port_or_service(23, 'telnet') diff --git a/scripts/robots.nse b/scripts/robots.nse index 0b2c134bc..ec2a6e681 100644 --- a/scripts/robots.nse +++ b/scripts/robots.nse @@ -34,7 +34,7 @@ end action = function(host, port) local soc, lines, status - local catch = function() soc.close() end + local catch = function() soc:close() end local try = nmap.new_try(catch) -- connect to webserver diff --git a/scripts/zoneTrans.nse b/scripts/zoneTrans.nse index 57ed8ea39..934e5d8d7 100644 --- a/scripts/zoneTrans.nse +++ b/scripts/zoneTrans.nse @@ -263,7 +263,7 @@ end action = function(host, port) local soc, status, data - local catch = function() soc.close() end + local catch = function() soc:close() end local try = nmap.new_try(catch) -- can't do anything without a hostname