1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-23 16:09:02 +00:00

Making extra functions in my HTTPpasswd.nse and HTTPtrace.nse scripts 'local'. I mark my C functions static, so I'll mark my Lua ones local

This commit is contained in:
kris
2007-09-15 02:44:15 +00:00
parent c3b2e9af3f
commit 0aaa51980d
2 changed files with 8 additions and 8 deletions

View File

@@ -18,7 +18,7 @@ require "shortport"
-- Check for a valid HTTP return code, and check -- Check for a valid HTTP return code, and check
-- the supposed passwd file for validity -- the supposed passwd file for validity
validate = function(response) local validate = function(response)
local passwd local passwd
local line local line
local start, stop local start, stop
@@ -43,7 +43,7 @@ validate = function(response)
end end
-- Connects to host:port, send cmd, and returns the (hopefully valid) response -- Connects to host:port, send cmd, and returns the (hopefully valid) response
talk = function(host, port, cmd) local talk = function(host, port, cmd)
local socket local socket
local response local response
@@ -70,11 +70,11 @@ talk = function(host, port, cmd)
return validate(response) return validate(response)
end end
httpget = function(str) local httpget = function(str)
return "GET " .. str .. " HTTP/1.0\r\n\r\n" return "GET " .. str .. " HTTP/1.0\r\n\r\n"
end end
hexify = function(str) local hexify = function(str)
local ret local ret
ret = str:gsub("%.", "%%2E") ret = str:gsub("%.", "%%2E")
ret = ret:gsub("/", "%%2F") ret = ret:gsub("/", "%%2F")
@@ -83,12 +83,12 @@ hexify = function(str)
end end
-- Returns truncated passwd file and returned length -- Returns truncated passwd file and returned length
truncatePasswd = function(passwd) local truncatePasswd = function(passwd)
local len = 250 local len = 250
return passwd:sub(1, len), len return passwd:sub(1, len), len
end end
output = function(passwd, dir) local output = function(passwd, dir)
local trunc, len = truncatePasswd(passwd) local trunc, len = truncatePasswd(passwd)
local out = "" local out = ""
out = out .. "Found with \"" .. dir .. "\"\n" out = out .. "Found with \"" .. dir .. "\"\n"

View File

@@ -21,7 +21,7 @@ categories = {"discovery"}
require "shortport" require "shortport"
require "stdnse" require "stdnse"
truncate = function(tab) local truncate = function(tab)
local str = "" local str = ""
str = str .. tab[1] .. "\n" str = str .. tab[1] .. "\n"
str = str .. tab[2] .. "\n" str = str .. tab[2] .. "\n"
@@ -31,7 +31,7 @@ truncate = function(tab)
return str return str
end end
validate = function(response, original) local validate = function(response, original)
local start, stop local start, stop
local body local body