mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +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:
@@ -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,9 +70,6 @@ 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
|
||||||
|
|||||||
Reference in New Issue
Block a user