mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Changed the handling of the values returned from dns.query() (changed in r14493)
This commit is contained in:
@@ -38,12 +38,16 @@ require "dns"
|
|||||||
--@return Ip address of hostname in hex
|
--@return Ip address of hostname in hex
|
||||||
function hex_resolve(hostname)
|
function hex_resolve(hostname)
|
||||||
local a, b, c, d;
|
local a, b, c, d;
|
||||||
local t, err = ipOps.get_parts_as_number(dns.query(hostname))
|
local dns_status, ip = dns.query(hostname)
|
||||||
|
if not dns_status then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local t, err = ipOps.get_parts_as_number(ip)
|
||||||
if t and not err
|
if t and not err
|
||||||
then a, b, c, d = unpack(t)
|
then a, b, c, d = unpack(t)
|
||||||
else return false
|
else return false
|
||||||
end
|
end
|
||||||
sip = string.format("%.2x ", a) .. string.format("%.2x ", b) .. string.format("%.2x ", c) .. string.format("%.2x ",d)
|
local sip = string.format("%.2x ", a) .. string.format("%.2x ", b) .. string.format("%.2x ", c) .. string.format("%.2x ",d)
|
||||||
return true, sip
|
return true, sip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user