From f3eeefbe85dfddded148b28817a0306768cb7e75 Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 24 Nov 2019 05:26:04 +1000 Subject: Reverese lookup the DNS-RR names. --- apt-panopticon-report-web.lua | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/apt-panopticon-report-web.lua b/apt-panopticon-report-web.lua index 251aa89..f17bf54 100755 --- a/apt-panopticon-report-web.lua +++ b/apt-panopticon-report-web.lua @@ -121,6 +121,27 @@ local W = function(s, p, t, h) log(1, "WARNING ", s, p, t, h) end local E = function(s, p, t, h) log(0, "ERROR ", s, p, t, h) end local C = function(s) log(-1, "CRITICAL", s) end +local mirrors = loadfile("results/mirrors.lua")() + +local revDNS = function(dom, IP) + if "deb.devuan.org" ~= dom then return "" end + for k, v in pairs(mirrors) do + if "deb.devuan.org" ~= k then + local IPs = v.IPs + for i, u in pairs(IPs) do + if "table" == type(u) then + for h, t in pairs(u) do + if IP == h then return k end + end + else + if IP == i then return k end + end + end + end + end + return "" +end + local faulty = "" local status = function(host, results, typ) local result = "" @@ -190,7 +211,6 @@ local collate = function(host, ip, results) return results end -local mirrors = loadfile("results/mirrors.lua")() local m = {} local logCount = function(domain, ip) @@ -307,11 +327,11 @@ if nil == file then C("opening mirrors file - " .. e) else n[l] = {} for i, u in pairs(w) do local log = logCount(k, i) - if "" == log then n[l][i] = u else n[l][log] = u end + if "" == log then n[l][i] = u else n[l][log .. " " .. revDNS(k, i)] = u end end else local log = logCount(k, l) - if "" == log then n[l] = w else n[log] = w end + if "" == log then n[l] = w else n[log .. " " .. revDNS(k, l)] = w end end end m[log .. " DNS entries -"] = n -- cgit v1.1