1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-04 05:39:01 +00:00

Made some big style changes to clean up HTTP library. Primarily focused on improving the interface, NSEDoc, and pipline support

This commit is contained in:
ron
2010-11-02 02:07:01 +00:00
parent d7ab029c76
commit fef25e6a42
4 changed files with 357 additions and 265 deletions

View File

@@ -351,17 +351,17 @@ action = function(host, port)
for i = 1, #fingerprints, 1 do
-- Add each path. The order very much matters here.
for j = 1, #fingerprints[i].probes, 1 do
all = http.addPipeline(host, port, basepath .. fingerprints[i].probes[j].path, nil, nil, all, fingerprints[i].probes[j].method or 'GET')
all = http.pipeline_add(basepath .. fingerprints[i].probes[j].path, nil, all, fingerprints[i].probes[j].method or 'GET')
end
end
-- Perform all the requests.
local results = http.pipeline(host, port, all, nil)
local results = http.pipeline_go(host, port, all, nil)
-- Check for http.pipeline error
if(results == nil) then
stdnse.print_debug(1, "http-enum: http.pipeline encountered an error")
return stdnse.format_output(false, "http.pipeline encountered an error")
stdnse.print_debug(1, "http-enum: http.pipeline_go encountered an error")
return stdnse.format_output(false, "http.pipeline_go encountered an error")
end
-- Loop through the fingerprints. Note that for each fingerprint, we may have multiple results

View File

@@ -68,18 +68,6 @@ action = function(host, port)
-- Check if we can use HEAD requests
local use_head = http.can_use_head(host, port, result_404)
-- If we can't use HEAD, make sure we can use GET requests
if(use_head == false) then
local result, err = http.can_use_get(host, port)
if(result == false) then
if(nmap.debugging() > 0) then
return "ERROR: " .. err
else
return nil
end
end
end
-- Queue up the checks
local all = {}
local i
@@ -90,13 +78,13 @@ action = function(host, port)
end
if(use_head) then
all = http.pHead(host, port, "/~" .. usernames[i], nil, nil, all)
all = http.pipeline_add("/~" .. usernames[i], nil, 'HEAD')
else
all = http.pGet(host, port, "/~" .. usernames[i], nil, nil, all)
all = http.pipeline_add("/~" .. usernames[i], nil, 'GET')
end
end
local results = http.pipeline(host, port, all, nil)
local results = http.pipeline_go(host, port, all)
-- Check for http.pipeline error
if(results == nil) then

View File

@@ -101,11 +101,10 @@ Creates a pipeline table and returns the result
]]--
local function inject(host, port, injectable)
local all = {}
local pOpts = {}
for k, v in pairs(injectable) do
all = http.pGet(host, port, v, nil, nil, all)
all = http.pipeline_add(v, nil, all, 'GET')
end
return http.pipeline(host, port, all, pOpts)
return http.pipeline_go(host, port, all)
end
--[[