Regex NMAP使用哪种类型的正则表达式?
正在尝试使用Nmap扫描Robtex数据库:Regex NMAP使用哪种类型的正则表达式?,regex,nmap,Regex,Nmap,正在尝试使用Nmap扫描Robtex数据库: nmap --script http-robtex-reverse-ip <target> nmap——脚本http robtex反向ip 但是自从Robtex更新了他的网站,Nmap脚本就不再有效了 新的Robtex html结构如下所示: <div class="xsha"> <div> <div> <h3&g
nmap --script http-robtex-reverse-ip <target>
nmap——脚本http robtex反向ip
但是自从Robtex更新了他的网站,Nmap脚本就不再有效了
新的Robtex html结构如下所示:
<div class="xsha">
<div>
<div>
<h3>
<span id="sharedn.b446331/_ma">Pointing to this IP number</span>
</h3>
</div>
<ol class="xbul">
<li>domain1</li>
<li>domain2</li>
<li>domain3</li>
<li>domain...</li>
</ol>
</div>
</div>
指向此IP号码
域1
域2
域3
域
我已经更改了Nmap脚本,但它不起作用
function parse_robtex_response(data)
local data = data:match("<span id=\"sharedn\">.-<ol.->(.-)</ol>")
local result = {}
if data then
for domain in data:gmatch("<li[^>]*>(.-)</li>") do
domain = domain:gsub("<[^>]+>","")
table.insert(result, domain)
end
end
return result
end
prerule = function() return stdnse.get_script_args("http-robtex-reverse-ip.host") ~= nil end
action = function(host, port)
local target = stdnse.get_script_args("http-robtex-reverse-ip.host")
local ip = ipOps.ip_to_str(target)
if ( not(ip) or #ip ~= 4 ) then
return stdnse.format_output(false, "The argument \"http-robtex-reverse-ip.host\" did not contain a valid IPv4 address")
end
local link = "/ip-lookup/"..target..""
local htmldata = http.get("www.robtex.com", 443, link, {any_af=true})
local domains = parse_robtex_response(htmldata.body)
if ( #domains > 0 ) then
return stdnse.format_output(true, domains)
end
end
函数解析\u robtex\u响应(数据)
本地数据=数据:匹配(“.-(.-)”)
局部结果={}
如果是数据那么
对于数据中的域:gmatch(“]*>(.-)”)do
域=域:gsub(“]+>”,“”)
表.插入(结果,域)
结束
结束
返回结果
结束
prerule=function()返回stdnse.get_script_args(“http robtex reverse ip.host”)~=nil end
动作=功能(主机、端口)
本地目标=stdnse.get_script_args(“http robtex reverse ip.host”)
本地ip=ipOps.ip\u到\u str(目标)
如果(不是(ip)或#ip~=4),则
返回stdnse.format_输出(false,“参数\”http robtex reverse ip.host \“未包含有效的IPv4地址”)
结束
本地链接=“/ip查找/”。目标..“
本地htmldata=http.get(“www.robtex.com”,443,link,{any_af=true})
本地域=解析\u robtex\u响应(htmldata.body)
如果(#域>0),则
返回stdnse.format_输出(true,域)
结束
结束
如何解决此问题?下次我们更改网页时,此问题可能会再次出现。与其删除我们的站点,不如使用全新的免费API()。
它更安全、更快、更容易解析。下次我们更改网页时,它可能会再次崩溃。与其删除我们的站点,不如使用全新的免费API()。
它更安全、更快速、更容易解析。“它不起作用”相当含糊……不要获取域名此“regex”看起来像Lua模式,而不是正则表达式。尝试用
替换本地数据
模式,谢谢,现在工作正常!!!“它不工作”是相当模糊的…不要获取域名这个“regex”看起来像Lua模式,而不是正则表达式。尝试用替换本地数据
模式,谢谢,现在工作正常!!!