Browse Source

Create the DNS-RR good and bad files.

master
onefang 3 years ago
parent
commit
7fb4a6a850
  1. 42
      apt-panopticon-report-email-web.lua

42
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 = "<font color='green'><b>&#x2705;</b></font>"
if nil ~= lc:find("<font color='") then inRR = "<font color='red'>&#x274c;</font>" end
if nil ~= lc:find("<font color='") then
inRR = "<font color='red'>&#x274c;</font>"
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 = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] &nbsp; '
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 = "<font color='green'><b>&#x2705;</b></font>"
if nil ~= lc:find("<font color='") then inRR = "<font color='red'>&#x274c;</font>" end
if nil ~= lc:find("<font color='") then
inRR = "<font color='red'>&#x274c;</font>"
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 = '[<a href="' .. adr .. k .. '_' .. l .. '">graphs</a>] &nbsp; '
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['[<a href="' .. adr .. k .. '">graphs</a>] &nbsp; ' .. 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
"<br>" ..
APT.options.roundRobin.value .. " is the DNS round robin, which points to the mirrors that are part of the DNS-RR. &nbsp; " ..
"If an IP is part of the DNS-RR, it is marked with '<font color='purple'><b>DNS-RR</b></font>'," ..
" if it should be it is marked with '<font color='green'><b>&#x2705;</b></font>', if it should not be it is marked with '<font color='red'>&#x274c;</font>'. &nbsp; " ..
" if it <a href='DNS-RR_good.txt'>should be</a> it is marked with '<font color='green'><b>&#x2705;</b></font>'," ..
" if it <a href='DNS-RR_bad.txt'>should not be</a> it is marked with '<font color='red'>&#x274c;</font>'. &nbsp; " ..
"<br>" ..
APT.options.referenceSite.value .. " is the master mirror, all the others copy files from it. &nbsp; " ..
"</p>\n"

Loading…
Cancel
Save