mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
[NSE] Updated Robtex scripts to make them work again. Primarily, changed the addresses to https and corrected some wrong patterns.
This commit is contained in:
@@ -13,7 +13,7 @@ The target must be specified by DNS name, not IP address.
|
||||
-- @usage
|
||||
-- nmap --script http-robtex-shared-ns
|
||||
--
|
||||
-- @output
|
||||
-- @outt
|
||||
-- Host script results:
|
||||
-- | http-robtex-shared-ns:
|
||||
-- | example.edu
|
||||
@@ -43,11 +43,12 @@ end
|
||||
function parse_robtex_response(data)
|
||||
local result = {}
|
||||
|
||||
-- cut out the section we're interested in
|
||||
data = data:match("<span id=\\\"sharednss?\\\">.-<ul.->(.-)</ul>")
|
||||
if ( not(data) ) then
|
||||
return
|
||||
end
|
||||
|
||||
-- cut out the section we're interested in
|
||||
data = data:match("<span id=\"sharednss\">.-<ul.->(.-)</ul>")
|
||||
|
||||
-- process each html list item
|
||||
for li in data:gmatch("<li>(.-)</li>") do
|
||||
@@ -65,35 +66,21 @@ local function lookup_dns_server(data)
|
||||
end
|
||||
|
||||
local function fetch_robtex_data(url)
|
||||
local htmldata = http.get_url(url)
|
||||
local htmldata = http.get("www.robtex.com", 443, url)
|
||||
if ( not(htmldata) or not(htmldata.body) ) then
|
||||
return
|
||||
end
|
||||
|
||||
local url = htmldata.body:match("var%s*uurl%s*='([^']*)")
|
||||
if ( not(url) ) then
|
||||
return
|
||||
end
|
||||
|
||||
-- retreive the url having the shared dns information
|
||||
htmldata = http.get_url(url)
|
||||
if ( not(htmldata) or not(htmldata.body) ) then
|
||||
return
|
||||
end
|
||||
|
||||
-- fixup line breaks
|
||||
htmldata = htmldata.body:gsub("(.-)\\\r?\n", "%1")
|
||||
|
||||
-- fixup hex encodings
|
||||
return unescape(htmldata)
|
||||
return unescape(htmldata.body)
|
||||
end
|
||||
|
||||
hostrule = function (host) return host.targetname end
|
||||
|
||||
action = function(host)
|
||||
local base_url = "http://www.robtex.com/dns/%s.html"
|
||||
local data = fetch_robtex_data(base_url:format(host.targetname))
|
||||
local domains = parse_robtex_response(data)
|
||||
local base_url = "/dns/" .. host.targetname .. ".html"
|
||||
local data = fetch_robtex_data(base_url)
|
||||
local domains = parse_robtex_response(data)
|
||||
|
||||
if ( not(domains) ) then
|
||||
local server = lookup_dns_server(data)
|
||||
@@ -103,6 +90,7 @@ action = function(host)
|
||||
local url = base_url:format(server)
|
||||
stdnse.print_debug(2, "%s: Querying URL: %s", SCRIPT_NAME, url)
|
||||
data = fetch_robtex_data(url)
|
||||
|
||||
domains = parse_robtex_response(data)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user