Lua 如果参数是硬编码字符串或包含所述字符串的变量,则Nmap NSE脚本函数的行为不同
我正在为学校作业写一个Nmap DNS暴力脚本。 我的问题是在使用函数时:Lua 如果参数是硬编码字符串或包含所述字符串的变量,则Nmap NSE脚本函数的行为不同,lua,scripting,dns,nmap,Lua,Scripting,Dns,Nmap,我正在为学校作业写一个Nmap DNS暴力脚本。 我的问题是在使用函数时:dns.query(dname,options) 如果dname是FQDN,则如果参数为 1:像这样的硬编码字符串 local status, result = dns.query("www.domain.com", {dtype="A",retAll=true}) 或2:在函数匹配中生成的一个变量,用于连接两个字符串 local status, result = dns.query(domain, {dtype="A"
dns.query(dname,options)
如果dname是FQDN,则如果参数为
1:像这样的硬编码字符串
local status, result = dns.query("www.domain.com", {dtype="A",retAll=true})
或2:在函数匹配中生成的一个变量,用于连接两个字符串
local status, result = dns.query(domain, {dtype="A",retAll=true})
调试模式显示变量域确实等于硬编码字符串的相同值。但行为是不同的
什么会导致这种问题
dns库的文档:
local domain=print(sub..”...host.name)
通常print()
返回nil
它必须是:local domain=sub..”...host.name
local function match(sub,host)
local domain = print(sub.."."..host.name)
local status, result = dns.query(domain, {dtype="A",retAll=true})
if status == "true" then
return domain
end
return ''
end