diff options
author | onefang | 2020-06-01 20:35:41 +1000 |
---|---|---|
committer | onefang | 2020-06-01 20:35:41 +1000 |
commit | 7fb4a6a8504425df0edfcaa923d2af2c471913e1 (patch) | |
tree | f10e84661d181dee0927d9cc1b59b87aea446fcd | |
parent | Try to figure outn what IPs should and should not be in the DNS-RR. (diff) | |
download | apt-panopticon-7fb4a6a8504425df0edfcaa923d2af2c471913e1.zip apt-panopticon-7fb4a6a8504425df0edfcaa923d2af2c471913e1.tar.gz apt-panopticon-7fb4a6a8504425df0edfcaa923d2af2c471913e1.tar.bz2 apt-panopticon-7fb4a6a8504425df0edfcaa923d2af2c471913e1.tar.xz |
Create the DNS-RR good and bad files.
Diffstat (limited to '')
-rwxr-xr-x | apt-panopticon-report-email-web.lua | 42 |
1 files 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) | |||
310 | local m = {} | 310 | local m = {} |
311 | local adr = '' | 311 | local adr = '' |
312 | local checkRR = hosts == APT.mirrors; | 312 | local checkRR = hosts == APT.mirrors; |
313 | local RRbfile, RRgfile | ||
313 | if APT.options.cgi.value then adr = 'php.cgi/' end | 314 | if APT.options.cgi.value then adr = 'php.cgi/' end |
314 | adr = '/' .. adr .. 'apt-panopticon/apt-panopticon_cgp/host.php?h=' | 315 | adr = '/' .. adr .. 'apt-panopticon/apt-panopticon_cgp/host.php?h=' |
316 | if checkRR then | ||
317 | -- 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. | ||
318 | -- 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 | ||
319 | RRbfile, e = io.open("results/DNS-RR_bad.txt", "w+") | ||
320 | if nil == RRbfile then C("opening DNS-RR_bad.txt file - " .. e) end | ||
321 | RRgfile, e = io.open("results/DNS-RR_good.txt", "w+") | ||
322 | if nil == RRgfile then C("opening DNS-RR_good.txt file - " .. e) end | ||
323 | end | ||
315 | for k, v in pairs(hosts) do | 324 | for k, v in pairs(hosts) do |
316 | local log = k | 325 | local log = k |
317 | local n = {} | 326 | local n = {} |
@@ -334,7 +343,16 @@ local makeIPlist = function(hosts) | |||
334 | if checkRR then | 343 | if checkRR then |
335 | -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. | 344 | -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. |
336 | inRR = "<font color='green'><b>✅</b></font>" | 345 | inRR = "<font color='green'><b>✅</b></font>" |
337 | if nil ~= lc:find("<font color='") then inRR = "<font color='red'>❌</font>" end | 346 | if nil ~= lc:find("<font color='") then |
347 | inRR = "<font color='red'>❌</font>" | ||
348 | if nil ~= RRbfile then | ||
349 | local f, e = RRbfile:write(i, '\n') | ||
350 | if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end | ||
351 | end | ||
352 | elseif nil ~= RRgfile then | ||
353 | local f, e = RRgfile:write(i, '\n') | ||
354 | if f == nil then C("writing DNS-RR_good.txt file - " .. e) end | ||
355 | end | ||
338 | end | 356 | end |
339 | local log = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] ' | 357 | local log = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] ' |
340 | if "" == log then n[l][i] = u else n[l][log .. inRR .. ' ' .. revDNS(hosts, k, i) .. ' ' .. lc] = u end | 358 | 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) | |||
345 | if checkRR then | 363 | if checkRR then |
346 | -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. | 364 | -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. |
347 | inRR = "<font color='green'><b>✅</b></font>" | 365 | inRR = "<font color='green'><b>✅</b></font>" |
348 | if nil ~= lc:find("<font color='") then inRR = "<font color='red'>❌</font>" end | 366 | if nil ~= lc:find("<font color='") then |
367 | inRR = "<font color='red'>❌</font>" | ||
368 | if nil ~= RRbfile then | ||
369 | local f, e = RRbfile:write(l, '\n') | ||
370 | if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end | ||
371 | end | ||
372 | elseif nil ~= RRgfile then | ||
373 | local f, e = RRgfile:write(l, '\n') | ||
374 | if f == nil then C("writing DNS-RR_good.txt file - " .. e) end | ||
375 | end | ||
349 | end | 376 | end |
350 | local log = '[<a href="' .. adr .. k .. '_' .. l .. '">graphs</a>] ' | 377 | local log = '[<a href="' .. adr .. k .. '_' .. l .. '">graphs</a>] ' |
351 | if "" == log then n[l] = w else n[log .. inRR .. ' ' .. revDNS(hosts, k, l) .. ' ' .. lc] = w end | 378 | 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) | |||
354 | end | 381 | end |
355 | m['[<a href="' .. adr .. k .. '">graphs</a>] ' .. log .. " DNS entries -" .. redirs(hosts, k)] = n | 382 | m['[<a href="' .. adr .. k .. '">graphs</a>] ' .. log .. " DNS entries -" .. redirs(hosts, k)] = n |
356 | end | 383 | end |
384 | if nil ~= RRgfile then | ||
385 | RRgfile:close() | ||
386 | 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') | ||
387 | end | ||
388 | if nil ~= RRbfile then | ||
389 | RRbfile:close() | ||
390 | 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') | ||
391 | end | ||
357 | return m | 392 | return m |
358 | end | 393 | end |
359 | 394 | ||
@@ -506,7 +541,8 @@ if nil == web then C("opening mirrors file - " .. e) else | |||
506 | "<br>" .. | 541 | "<br>" .. |
507 | APT.options.roundRobin.value .. " is the DNS round robin, which points to the mirrors that are part of the DNS-RR. " .. | 542 | APT.options.roundRobin.value .. " is the DNS round robin, which points to the mirrors that are part of the DNS-RR. " .. |
508 | "If an IP is part of the DNS-RR, it is marked with '<font color='purple'><b>DNS-RR</b></font>'," .. | 543 | "If an IP is part of the DNS-RR, it is marked with '<font color='purple'><b>DNS-RR</b></font>'," .. |
509 | " if it should be it is marked with '<font color='green'><b>✅</b></font>', if it should not be it is marked with '<font color='red'>❌</font>'. " .. | 544 | " if it <a href='DNS-RR_good.txt'>should be</a> it is marked with '<font color='green'><b>✅</b></font>'," .. |
545 | " if it <a href='DNS-RR_bad.txt'>should not be</a> it is marked with '<font color='red'>❌</font>'. " .. | ||
510 | "<br>" .. | 546 | "<br>" .. |
511 | APT.options.referenceSite.value .. " is the master mirror, all the others copy files from it. " .. | 547 | APT.options.referenceSite.value .. " is the master mirror, all the others copy files from it. " .. |
512 | "</p>\n" | 548 | "</p>\n" |