mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Let http.lua functions optionally connect via any address family
Sometimes (e.g. when using an external API), a script wants to connect by name to a server and doesn't care whether IPv4 or IPv6 is used. By passing the "any_af" option, the first resolved address of any address family will be used, allowing external-category scripts which used to fail with -6 to succeed.
This commit is contained in:
@@ -136,7 +136,7 @@ local function requestFileScan(filename)
|
||||
local port = { number = 80, protocol = "tcp" }
|
||||
local path = "/vtapi/v2/file/scan"
|
||||
|
||||
local response = http.post( host, port, path, { header = header }, nil, postdata )
|
||||
local response = http.post( host, port, path, {any_af = true, header = header }, nil, postdata )
|
||||
if ( not(response) or response.status ~= 200 ) then
|
||||
return false, "Failed to request file scan"
|
||||
end
|
||||
@@ -156,7 +156,7 @@ local function getFileScanReport(resource)
|
||||
local path = "/vtapi/v2/file/report"
|
||||
|
||||
|
||||
local response = http.post(host, port, path, nil, nil, { ["apikey"] = arg_apiKey, ["resource"] = resource })
|
||||
local response = http.post(host, port, path, {any_af=true}, nil, { ["apikey"] = arg_apiKey, ["resource"] = resource })
|
||||
if ( not(response) or response.status ~= 200 ) then
|
||||
return false, "Failed to retrieve scan report"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user