mirror of
https://github.com/nmap/nmap.git
synced 2025-12-31 03:49:01 +00:00
Re-indent some scripts. Whitespace-only commit
https://secwiki.org/w/Nmap/Code_Standards
This commit is contained in:
@@ -38,42 +38,42 @@ portrule = shortport.http
|
||||
|
||||
action = function(host, port)
|
||||
local paths = stdnse.get_script_args(SCRIPT_NAME..".paths")
|
||||
local result = {}
|
||||
local result = {}
|
||||
|
||||
-- convert single string entry to table
|
||||
if ( "string" == type(paths) ) then
|
||||
paths = { paths }
|
||||
end
|
||||
-- convert single string entry to table
|
||||
if ( "string" == type(paths) ) then
|
||||
paths = { paths }
|
||||
end
|
||||
|
||||
-- Identify servers that answer 200 to invalid HTTP requests and exit as these would invalidate the tests
|
||||
local _, http_status, _ = http.identify_404(host,port)
|
||||
if ( http_status == 200 ) then
|
||||
stdnse.print_debug(1, "%s: Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", SCRIPT_NAME, host.ip, port.number)
|
||||
return false
|
||||
end
|
||||
-- Identify servers that answer 200 to invalid HTTP requests and exit as these would invalidate the tests
|
||||
local _, http_status, _ = http.identify_404(host,port)
|
||||
if ( http_status == 200 ) then
|
||||
stdnse.print_debug(1, "%s: Exiting due to ambiguous response from web server on %s:%s. All URIs return status 200.", SCRIPT_NAME, host.ip, port.number)
|
||||
return false
|
||||
end
|
||||
|
||||
-- fallback to jmx-console
|
||||
paths = paths or {"/jmx-console/"}
|
||||
-- fallback to jmx-console
|
||||
paths = paths or {"/jmx-console/"}
|
||||
|
||||
for _, path in ipairs(paths) do
|
||||
local getstatus = http.get(host, port, path).status
|
||||
for _, path in ipairs(paths) do
|
||||
local getstatus = http.get(host, port, path).status
|
||||
|
||||
-- Checks if HTTP authentication or a redirection to a login page is applied.
|
||||
if getstatus == 401 or getstatus == 302 then
|
||||
local headstatus = http.head(host, port, path).status
|
||||
if headstatus == 500 and path == "/jmx-console/" then
|
||||
-- JBoss authentication bypass.
|
||||
table.insert(result, ("%s: Vulnerable to CVE-2010-0738."):format(path))
|
||||
elseif headstatus == 200 then
|
||||
-- Vulnerable to authentication bypass.
|
||||
table.insert(result, ("%s: Authentication bypass possible"):format(path))
|
||||
end
|
||||
-- Checks if no authentication is required for Jmx console
|
||||
-- which is default configuration and common.
|
||||
elseif getstatus == 200 then
|
||||
table.insert(result, ("%s: Authentication was not required"):format(path))
|
||||
end
|
||||
-- Checks if HTTP authentication or a redirection to a login page is applied.
|
||||
if getstatus == 401 or getstatus == 302 then
|
||||
local headstatus = http.head(host, port, path).status
|
||||
if headstatus == 500 and path == "/jmx-console/" then
|
||||
-- JBoss authentication bypass.
|
||||
table.insert(result, ("%s: Vulnerable to CVE-2010-0738."):format(path))
|
||||
elseif headstatus == 200 then
|
||||
-- Vulnerable to authentication bypass.
|
||||
table.insert(result, ("%s: Authentication bypass possible"):format(path))
|
||||
end
|
||||
-- Checks if no authentication is required for Jmx console
|
||||
-- which is default configuration and common.
|
||||
elseif getstatus == 200 then
|
||||
table.insert(result, ("%s: Authentication was not required"):format(path))
|
||||
end
|
||||
end
|
||||
|
||||
return stdnse.format_output(true, result)
|
||||
return stdnse.format_output(true, result)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user