1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 06:01:28 +00:00

Updates the script to use stdnse.get_script_args() instead of reading the arguments from the registry and removes extra commented lines.

This commit is contained in:
paulino
2011-10-07 07:01:08 +00:00
parent 68646bd590
commit 6e5e5cf72f

View File

@@ -34,17 +34,14 @@ require "http"
portrule = shortport.http portrule = shortport.http
action = function(host, port) action = function(host, port)
local path = nmap.registry.args.path local path = stdnse.get_script_args(SCRIPT_NAME..".path") or "/"
local useget = stdnse.get_script_args(SCRIPT_NAME..".useget")
local request_type = "HEAD" local request_type = "HEAD"
if(path == nil) then
path = '/'
end
local status = false local status = false
local result local result
-- Check if the user didn't want HEAD to be used -- Check if the user didn't want HEAD to be used
if(nmap.registry.args.useget == nil) then if(useget == nil) then
-- Try using HEAD first -- Try using HEAD first
status, result = http.can_use_head(host, port, nil, path) status, result = http.can_use_head(host, port, nil, path)
end end
@@ -73,10 +70,7 @@ action = function(host, port)
end end
table.insert(result.rawheader, "(Request type: " .. request_type .. ")") table.insert(result.rawheader, "(Request type: " .. request_type .. ")")
-- for _, header in ipairs(result.rawheader) do
-- response = response .. header .. "\n"
-- end
return stdnse.format_output(true, result.rawheader) return stdnse.format_output(true, result.rawheader)
end end