diff options
-rwxr-xr-x | apt-panopticon-report-web.lua | 26 |
1 files 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 | |||
121 | local E = function(s, p, t, h) log(0, "ERROR ", s, p, t, h) end | 121 | local E = function(s, p, t, h) log(0, "ERROR ", s, p, t, h) end |
122 | local C = function(s) log(-1, "CRITICAL", s) end | 122 | local C = function(s) log(-1, "CRITICAL", s) end |
123 | 123 | ||
124 | local mirrors = loadfile("results/mirrors.lua")() | ||
125 | |||
126 | local revDNS = function(dom, IP) | ||
127 | if "deb.devuan.org" ~= dom then return "" end | ||
128 | for k, v in pairs(mirrors) do | ||
129 | if "deb.devuan.org" ~= k then | ||
130 | local IPs = v.IPs | ||
131 | for i, u in pairs(IPs) do | ||
132 | if "table" == type(u) then | ||
133 | for h, t in pairs(u) do | ||
134 | if IP == h then return k end | ||
135 | end | ||
136 | else | ||
137 | if IP == i then return k end | ||
138 | end | ||
139 | end | ||
140 | end | ||
141 | end | ||
142 | return "" | ||
143 | end | ||
144 | |||
124 | local faulty = "" | 145 | local faulty = "" |
125 | local status = function(host, results, typ) | 146 | local status = function(host, results, typ) |
126 | local result = "" | 147 | local result = "" |
@@ -190,7 +211,6 @@ local collate = function(host, ip, results) | |||
190 | return results | 211 | return results |
191 | end | 212 | end |
192 | 213 | ||
193 | local mirrors = loadfile("results/mirrors.lua")() | ||
194 | local m = {} | 214 | local m = {} |
195 | 215 | ||
196 | local logCount = function(domain, ip) | 216 | local logCount = function(domain, ip) |
@@ -307,11 +327,11 @@ if nil == file then C("opening mirrors file - " .. e) else | |||
307 | n[l] = {} | 327 | n[l] = {} |
308 | for i, u in pairs(w) do | 328 | for i, u in pairs(w) do |
309 | local log = logCount(k, i) | 329 | local log = logCount(k, i) |
310 | if "" == log then n[l][i] = u else n[l][log] = u end | 330 | if "" == log then n[l][i] = u else n[l][log .. " " .. revDNS(k, i)] = u end |
311 | end | 331 | end |
312 | else | 332 | else |
313 | local log = logCount(k, l) | 333 | local log = logCount(k, l) |
314 | if "" == log then n[l] = w else n[log] = w end | 334 | if "" == log then n[l] = w else n[log .. " " .. revDNS(k, l)] = w end |
315 | end | 335 | end |
316 | end | 336 | end |
317 | m[log .. " DNS entries -"] = n | 337 | m[log .. " DNS entries -"] = n |