mirror of
https://github.com/nmap/nmap.git
synced 2026-08-03 22:29:06 +00:00
[NSE] Updated http-robtex-* scripts to match current robtex API.
This commit is contained in:
parent
b4988f1f5b
commit
4651a8f4ae
2 changed files with 9 additions and 8 deletions
|
|
@ -46,10 +46,12 @@ categories = {"discovery", "safe", "external"}
|
|||
-- @param data string containing the retrieved web page
|
||||
-- @return table containing the resolved host names
|
||||
function parse_robtex_response(data)
|
||||
local data = string.gsub(data,"\r?\n","")
|
||||
local data = data:match("<span id=\"shared_ma\">.-<ol.->(.-)</ol>")
|
||||
local result = {}
|
||||
for href, link in string.gmatch(data,"<li><a href=\"([^\"^']-)\" >([^\"^']-)</a></li>") do
|
||||
table.insert(result, link)
|
||||
if data then
|
||||
for domain in data:gmatch("<li><code>(.-)</code></li>") do
|
||||
table.insert(result, domain)
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
|
@ -64,8 +66,8 @@ action = function(host, port)
|
|||
return stdnse.format_output(false, "The argument \"http-robtex-reverse-ip.host\" did not contain a valid IPv4 address")
|
||||
end
|
||||
|
||||
local link = "https://www.robtex.com/ip/"..target..".html"
|
||||
local htmldata = http.get_url(link)
|
||||
local link = "/ip/"..target..".html"
|
||||
local htmldata = http.get("www.robtex.com", 443, link)
|
||||
local domains = parse_robtex_response(htmldata.body)
|
||||
if ( #domains > 0 ) then
|
||||
return stdnse.format_output(true, domains)
|
||||
|
|
|
|||
|
|
@ -48,12 +48,11 @@ function parse_robtex_response(data)
|
|||
end
|
||||
|
||||
-- cut out the section we're interested in
|
||||
data = data:match("<span id=\"sharednss\">.-<ul.->(.-)</ul>")
|
||||
data = data:match("<span id=\"shared_pn_mn\">.-<ol.->(.-)</ol>")
|
||||
|
||||
-- process each html list item
|
||||
if data then
|
||||
for li in data:gmatch("<li>(.-)</li>") do
|
||||
local domain = li:match("<a.->(.*)</a>")
|
||||
for domain in data:gmatch("<li><code>(.-)</code></li>") do
|
||||
if ( domain ) then
|
||||
table.insert(result, domain)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue