mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 22:21:29 +00:00
The script now outputs a table of elements(methods) when used
with -oX and shows the output in oneline on the commandline.
This commit is contained in:
@@ -39,7 +39,7 @@ only the potentially risky methods are shown.
|
|||||||
-- @output
|
-- @output
|
||||||
-- PORT STATE SERVICE REASON
|
-- PORT STATE SERVICE REASON
|
||||||
-- 80/tcp open http syn-ack
|
-- 80/tcp open http syn-ack
|
||||||
-- | http-methods:
|
-- | http-methods:
|
||||||
-- |_ Supported Methods: GET HEAD POST OPTIONS
|
-- |_ Supported Methods: GET HEAD POST OPTIONS
|
||||||
--
|
--
|
||||||
-- @usage
|
-- @usage
|
||||||
@@ -47,7 +47,12 @@ only the potentially risky methods are shown.
|
|||||||
-- nmap --script http-methods --script-args http.url-path='/website' <target>
|
-- nmap --script http-methods --script-args http.url-path='/website' <target>
|
||||||
--
|
--
|
||||||
-- @xmloutput
|
-- @xmloutput
|
||||||
-- <elem key="Supported Methods">GET HEAD POST OPTIONS</elem>
|
-- <table key="Supported Methods">
|
||||||
|
-- <elem>GET</elem>
|
||||||
|
-- <elem>HEAD</elem>
|
||||||
|
-- <elem>POST</elem>
|
||||||
|
-- <elem>OPTIONS</elem>
|
||||||
|
-- </table>
|
||||||
|
|
||||||
|
|
||||||
author = {"Bernd Stroessenreuther <berny1@users.sourceforge.net>", "Gyanendra Mishra"}
|
author = {"Bernd Stroessenreuther <berny1@users.sourceforge.net>", "Gyanendra Mishra"}
|
||||||
@@ -116,6 +121,12 @@ action = function(host, port)
|
|||||||
local output = stdnse.output_table()
|
local output = stdnse.output_table()
|
||||||
local options_status = true
|
local options_status = true
|
||||||
|
|
||||||
|
local spacesep = {
|
||||||
|
__tostring = function(t)
|
||||||
|
return table.concat(t, " ")
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
-- default values for script-args
|
-- default values for script-args
|
||||||
path = stdnse.get_script_args(SCRIPT_NAME .. ".url-path") or '/'
|
path = stdnse.get_script_args(SCRIPT_NAME .. ".url-path") or '/'
|
||||||
retest_http_methods = stdnse.get_script_args(SCRIPT_NAME .. ".retest") or false
|
retest_http_methods = stdnse.get_script_args(SCRIPT_NAME .. ".retest") or false
|
||||||
@@ -174,12 +185,14 @@ action = function(host, port)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if nmap.verbosity() > 0 and #methods > 0 then
|
if nmap.verbosity() > 0 and #methods > 0 then
|
||||||
output["Supported Methods"] = stdnse.strjoin(" ", methods)
|
output["Supported Methods"] = methods
|
||||||
|
setmetatable(output["Supported Methods"], spacesep)
|
||||||
end
|
end
|
||||||
|
|
||||||
local interesting = filter_out(methods, SAFE_METHODS)
|
local interesting = filter_out(methods, SAFE_METHODS)
|
||||||
if #interesting > 0 then
|
if #interesting > 0 then
|
||||||
output["Potentially risky methods"] = stdnse.strjoin(" ", interesting)
|
output["Potentially risky methods"] = interesting
|
||||||
|
setmetatable(output["Potentially risky methods"], spacesep)
|
||||||
end
|
end
|
||||||
|
|
||||||
if path ~= '/' then
|
if path ~= '/' then
|
||||||
|
|||||||
Reference in New Issue
Block a user