1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-14 19:59:02 +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:
dmiller
2016-03-16 05:07:59 +00:00
parent f68650e51e
commit c7892e365f
13 changed files with 21 additions and 14 deletions

View File

@@ -52,13 +52,13 @@ action = function(host, port)
local mutex = nmap.mutex("http-xssed")
mutex "lock"
local response = http.get(XSSED_SITE, 80, target)
local response = http.get(XSSED_SITE, 80, target, {any_af=true})
if string.find(response.body, XSSED_FOUND) then
fixed = {}
unfixed = {}
for m in string.gmatch(response.body, XSSED_MIRROR) do
local mirror = http.get(XSSED_SITE, 80, m)
local mirror = http.get(XSSED_SITE, 80, m, {any_af=true})
for v in string.gmatch(mirror.body, XSSED_URL) do
if string.find(mirror.body, XSSED_FIXED) then
table.insert(fixed, "\t" .. v .. "\n")