From 7fb4a6a8504425df0edfcaa923d2af2c471913e1 Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 1 Jun 2020 20:35:41 +1000 Subject: Create the DNS-RR good and bad files. --- apt-panopticon-report-email-web.lua | 42 ++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index 9894de7..9c21afb 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua @@ -310,8 +310,17 @@ local makeIPlist = function(hosts) local m = {} local adr = '' local checkRR = hosts == APT.mirrors; + local RRbfile, RRgfile if APT.options.cgi.value then adr = 'php.cgi/' end adr = '/' .. adr .. 'apt-panopticon/apt-panopticon_cgp/host.php?h=' + if checkRR then +-- TODO - note that an IP can end up in both, which means it failed direct, but worked via DNS-RR, or the other way around. +-- TODO - They want to use a masterlist instead of the actual DNS to know which should be in either file. Should put this into https://pkgmaster.devuan.org/mirror_list.txt + RRbfile, e = io.open("results/DNS-RR_bad.txt", "w+") + if nil == RRbfile then C("opening DNS-RR_bad.txt file - " .. e) end + RRgfile, e = io.open("results/DNS-RR_good.txt", "w+") + if nil == RRgfile then C("opening DNS-RR_good.txt file - " .. e) end + end for k, v in pairs(hosts) do local log = k local n = {} @@ -334,7 +343,16 @@ local makeIPlist = function(hosts) if checkRR then -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. inRR = "" - if nil ~= lc:find("" end + if nil ~= lc:find("" + if nil ~= RRbfile then + local f, e = RRbfile:write(i, '\n') + if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end + end + elseif nil ~= RRgfile then + local f, e = RRgfile:write(i, '\n') + if f == nil then C("writing DNS-RR_good.txt file - " .. e) end + end end local log = '[graphs]   ' if "" == log then n[l][i] = u else n[l][log .. inRR .. ' ' .. revDNS(hosts, k, i) .. ' ' .. lc] = u end @@ -345,7 +363,16 @@ local makeIPlist = function(hosts) if checkRR then -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. inRR = "" - if nil ~= lc:find("" end + if nil ~= lc:find("" + if nil ~= RRbfile then + local f, e = RRbfile:write(l, '\n') + if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end + end + elseif nil ~= RRgfile then + local f, e = RRgfile:write(l, '\n') + if f == nil then C("writing DNS-RR_good.txt file - " .. e) end + end end local log = '[graphs]   ' if "" == log then n[l] = w else n[log .. inRR .. ' ' .. revDNS(hosts, k, l) .. ' ' .. lc] = w end @@ -354,6 +381,14 @@ local makeIPlist = function(hosts) end m['[graphs]   ' .. log .. " DNS entries -" .. redirs(hosts, k)] = n end + if nil ~= RRgfile then + RRgfile:close() + os.execute('sort results/DNS-RR_good.txt | uniq > results/DNS-RR_good.txt_ && mv results/DNS-RR_good.txt_ results/DNS-RR_good.txt') + end + if nil ~= RRbfile then + RRbfile:close() + os.execute('sort results/DNS-RR_bad.txt | uniq > results/DNS-RR_bad.txt_ && mv results/DNS-RR_bad.txt_ results/DNS-RR_bad.txt') + end return m end @@ -506,7 +541,8 @@ if nil == web then C("opening mirrors file - " .. e) else "
" .. APT.options.roundRobin.value .. " is the DNS round robin, which points to the mirrors that are part of the DNS-RR.   " .. "If an IP is part of the DNS-RR, it is marked with 'DNS-RR'," .. - " if it should be it is marked with '', if it should not be it is marked with ''.   " .. + " if it should be it is marked with ''," .. + " if it should not be it is marked with ''.   " .. "
" .. APT.options.referenceSite.value .. " is the master mirror, all the others copy files from it.   " .. "

\n" -- cgit v1.1