mirror of
https://github.com/nmap/nmap.git
synced 2025-12-10 09:49:05 +00:00
Added pipeline support to http-enum.nse
This commit is contained in:
@@ -46,6 +46,7 @@ action = function(host, port)
|
|||||||
local check404body = ""
|
local check404body = ""
|
||||||
local checkHEAD = "200"
|
local checkHEAD = "200"
|
||||||
local result = ""
|
local result = ""
|
||||||
|
local all = {}
|
||||||
local safeURLcheck = {
|
local safeURLcheck = {
|
||||||
{checkdir="/_vti_bin/", checkdesc="FrontPage directory"},
|
{checkdir="/_vti_bin/", checkdesc="FrontPage directory"},
|
||||||
{checkdir="/_vti_cnf/", checkdesc="FrontPage directory"},
|
{checkdir="/_vti_cnf/", checkdesc="FrontPage directory"},
|
||||||
@@ -130,11 +131,15 @@ action = function(host, port)
|
|||||||
if check404:match( "200" ) then
|
if check404:match( "200" ) then
|
||||||
-- check body for specific text, add confirmation message to result
|
-- check body for specific text, add confirmation message to result
|
||||||
for _, combination in pairs (safeURLcheck) do
|
for _, combination in pairs (safeURLcheck) do
|
||||||
|
all = http.pGet( host, port, combination.checkdir, nil, nil, all )
|
||||||
|
end
|
||||||
|
|
||||||
data = http.get( host, port, combination.checkdir )
|
results = http.pipeline(host, port, all, nil)
|
||||||
|
|
||||||
|
for i, data in pairs( results ) do
|
||||||
|
|
||||||
if data and data.status and tostring( data.status ):match( "403" ) then
|
if data and data.status and tostring( data.status ):match( "403" ) then
|
||||||
result = result .. combination.checkdir .. " " .. combination.checkdesc .. " (403 Forbidden)\n"
|
result = result .. safeURLcheck[i].checkdir .. " " .. safeURLcheck[i].checkdesc .. " (403 Forbidden)\n"
|
||||||
else
|
else
|
||||||
if data.body and check404body then
|
if data.body and check404body then
|
||||||
-- compare body and look for matches
|
-- compare body and look for matches
|
||||||
@@ -142,7 +147,7 @@ action = function(host, port)
|
|||||||
-- assume it's another 404 page
|
-- assume it's another 404 page
|
||||||
else
|
else
|
||||||
-- assume it's not a 404
|
-- assume it's not a 404
|
||||||
result = result .. combination.checkdir .. " " .. combination.checkdesc .. "\n"
|
result = result .. safeURLcheck[i].checkdir .. " " .. safeURLcheck[i].checkdesc .. "\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -151,19 +156,25 @@ action = function(host, port)
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
for _, combination in pairs (safeURLcheck) do
|
if checkHEAD:match( "200" ) then
|
||||||
|
for _, combination in pairs (safeURLcheck) do
|
||||||
if checkHEAD:match( "200" ) then
|
all = http.pHead( host, port, combination.checkdir, nil, nil, all )
|
||||||
data = http.head( host, port, combination.checkdir )
|
|
||||||
else
|
|
||||||
data = http.get( host, port, combination.checkdir )
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
for _, combination in pairs (safeURLcheck) do
|
||||||
|
all = http.pGet( host, port, combination.checkdir, nil, nil, all )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
results = http.pipeline(host, port, all, nil)
|
||||||
|
|
||||||
|
for i, data in pairs( results ) do
|
||||||
|
|
||||||
if data and data.status and tostring( data.status ):match( "200" ) then
|
if data and data.status and tostring( data.status ):match( "200" ) then
|
||||||
result = result .. combination.checkdir .. " " .. combination.checkdesc .. "\n"
|
result = result .. safeURLcheck[i].checkdir .. " " .. safeURLcheck[i].checkdesc .. "\n"
|
||||||
end
|
end
|
||||||
if data and data.status and tostring( data.status ):match( "403" ) then
|
if data and data.status and tostring( data.status ):match( "403" ) then
|
||||||
result = result .. combination.checkdir .. " " .. combination.checkdesc .. " (403 Forbidden)\n"
|
result = result .. safeURLcheck[i].checkdir .. " " .. safeURLcheck[i].checkdesc .. " (403 Forbidden)\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user