From c25be95b5922c3a3c398864872bb84067d0db07f Mon Sep 17 00:00:00 2001 From: david Date: Sun, 9 Dec 2007 05:47:26 +0000 Subject: [PATCH] Add some "local" declarations to scripts/xamppDefaultPass.nse. Without this I was getting errors like SCRIPT ENGINE: [string "Global Access"]:1: Attempted to change the global 'socket' in c:david mapmswin32DebugscriptsxamppDefaultPass.nse - use nmap.registry if you really wan t to share data between scripts. Notice that there's another issue with the error message, which is that backslashes in the file name are being interpreted as beginning escape sequences (see how the '\n' in "C:\david\nmap" turned into a newline. --- scripts/xamppDefaultPass.nse | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/xamppDefaultPass.nse b/scripts/xamppDefaultPass.nse index 35bf42ca9..c902dee0a 100644 --- a/scripts/xamppDefaultPass.nse +++ b/scripts/xamppDefaultPass.nse @@ -15,7 +15,8 @@ require "shortport" portrule = shortport.port_or_service(21, "ftp") login = function(socket, user, pass) - res = "" + local status, err + local res = "" status, err = socket:send("USER " .. user .. "\n") status, err = socket:send("PASS " .. pass .. "\n") @@ -37,7 +38,8 @@ login = function(socket, user, pass) end action = function(host, port) - socket = nmap.new_socket() + local res + local socket = nmap.new_socket() socket:connect(host.ip, port.number) res = login(socket, "nobody", "e0e0e0e0")