diff options
| -rw-r--r-- | apt-panopticommon.lua | 14 | ||||
| -rwxr-xr-x | apt-panopticon-report-email-web.lua | 82 | ||||
| -rwxr-xr-x | apt-panopticon.lua | 65 |
3 files changed, 54 insertions, 107 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index b1f39d7..8a18c4b 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua | |||
| @@ -334,6 +334,20 @@ dumpTableSub = function (table, space) | |||
| 334 | return r | 334 | return r |
| 335 | end | 335 | end |
| 336 | 336 | ||
| 337 | |||
| 338 | APT.allpairs = function(tbl, func) | ||
| 339 | for k, v in pairs(tbl) do | ||
| 340 | if 'table' == type(v) then | ||
| 341 | for i, w in pairs(v) do | ||
| 342 | func(i, w, k, v) | ||
| 343 | end | ||
| 344 | else | ||
| 345 | func(k, v) | ||
| 346 | end | ||
| 347 | end | ||
| 348 | end | ||
| 349 | |||
| 350 | |||
| 337 | APT.search = function(t, s) | 351 | APT.search = function(t, s) |
| 338 | for i, v in pairs(t) do | 352 | for i, v in pairs(t) do |
| 339 | if v == s then return true end | 353 | if v == s then return true end |
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index 7d5ce7f..5598515 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua | |||
| @@ -205,33 +205,20 @@ if nil == email then C("opening mirrors file - " .. e) else | |||
| 205 | 205 | ||
| 206 | -- DNS-RR test. | 206 | -- DNS-RR test. |
| 207 | if ("deb.devuan.org" ~= k) and (nil ~= APT.mirrors["deb.devuan.org"]) then | 207 | if ("deb.devuan.org" ~= k) and (nil ~= APT.mirrors["deb.devuan.org"]) then |
| 208 | for l, w in pairs(APT.mirrors[k].IPs) do | 208 | APT.allpairs(APT.mirrors[k].IPs, |
| 209 | if type(w) == "table" then | 209 | function(i, w, k, v) |
| 210 | for i, u in pairs(w) do | 210 | if nil ~= APT.mirrors["deb.devuan.org"].IPs["deb.roundr.devuan.org"][i] then |
| 211 | if nil ~= APT.mirrors["deb.devuan.org"].IPs["deb.roundr.devuan.org"][i] then | 211 | local log = logCount("deb.devuan.org", i) |
| 212 | local log = logCount("deb.devuan.org", i) | ||
| 213 | if "" ~= log then | ||
| 214 | if "" == dns then dns = " " else dns = dns .. " " end | ||
| 215 | dns = dns .. logCount("deb.devuan.org", i) | ||
| 216 | else | ||
| 217 | if "" == dns then dns = " " else dns = dns .. " " end | ||
| 218 | dns = dns .. i | ||
| 219 | end | ||
| 220 | end | ||
| 221 | end | ||
| 222 | else | ||
| 223 | if nil ~= APT.mirrors["deb.devuan.org"].IPs["deb.roundr.devuan.org"][l] then | ||
| 224 | local log = logCount("deb.devuan.org", l) | ||
| 225 | if "" ~= log then | 212 | if "" ~= log then |
| 226 | if "" == dns then dns = " " else dns = dns .. " " end | 213 | if "" == dns then dns = " " else dns = dns .. " " end |
| 227 | dns = dns .. log | 214 | dns = dns .. logCount("deb.devuan.org", i) |
| 228 | else | 215 | else |
| 229 | if "" == dns then dns = " " else dns = dns .. " " end | 216 | if "" == dns then dns = " " else dns = dns .. " " end |
| 230 | dns = dns .. l | 217 | dns = dns .. i |
| 231 | end | 218 | end |
| 232 | end | 219 | end |
| 233 | end | 220 | end |
| 234 | end | 221 | ) |
| 235 | if "" == dns then dns = "[no]" end | 222 | if "" == dns then dns = "[no]" end |
| 236 | dns = " DNS-RR: " .. dns | 223 | dns = " DNS-RR: " .. dns |
| 237 | end | 224 | end |
| @@ -396,33 +383,20 @@ if nil == web then C("opening mirrors file - " .. e) else | |||
| 396 | 383 | ||
| 397 | -- DNS-RR test. | 384 | -- DNS-RR test. |
| 398 | if ("deb.devuan.org" ~= k) and (nil ~= APT.mirrors["deb.devuan.org"]) then | 385 | if ("deb.devuan.org" ~= k) and (nil ~= APT.mirrors["deb.devuan.org"]) then |
| 399 | for l, w in pairs(APT.mirrors[k].IPs) do | 386 | APT.allpairs(APT.mirrors[k].IPs, |
| 400 | if type(w) == "table" then | 387 | function(i, w, k, v) |
| 401 | for i, u in pairs(w) do | 388 | if nil ~= APT.mirrors["deb.devuan.org"].IPs["deb.roundr.devuan.org"][i] then |
| 402 | if nil ~= APT.mirrors["deb.devuan.org"].IPs["deb.roundr.devuan.org"][i] then | 389 | local log = logCount("deb.devuan.org", i) |
| 403 | local log = logCount("deb.devuan.org", i) | ||
| 404 | if "" ~= log then | ||
| 405 | if "" == dns then dns = " " else dns = dns .. " " end | ||
| 406 | dns = dns .. logCount("deb.devuan.org", i) | ||
| 407 | else | ||
| 408 | if "" == dns then dns = " " else dns = dns .. " " end | ||
| 409 | dns = dns .. "<font color='maroon'><b>" .. i .. "</b></font>" | ||
| 410 | end | ||
| 411 | end | ||
| 412 | end | ||
| 413 | else | ||
| 414 | if nil ~= APT.mirrors["deb.devuan.org"].IPs["deb.roundr.devuan.org"][l] then | ||
| 415 | local log = logCount("deb.devuan.org", l) | ||
| 416 | if "" ~= log then | 390 | if "" ~= log then |
| 417 | if "" == dns then dns = " " else dns = dns .. " " end | 391 | if "" == dns then dns = " " else dns = dns .. " " end |
| 418 | dns = dns .. log | 392 | dns = dns .. logCount("deb.devuan.org", i) |
| 419 | else | 393 | else |
| 420 | if "" == dns then dns = " " else dns = dns .. " " end | 394 | if "" == dns then dns = " " else dns = dns .. " " end |
| 421 | dns = dns .. "<font color='maroon'><b>" .. l .. "</b></font>" | 395 | dns = dns .. "<font color='maroon'><b>" .. i .. "</b></font>" |
| 422 | end | 396 | end |
| 423 | end | 397 | end |
| 424 | end | 398 | end |
| 425 | end | 399 | ) |
| 426 | if "" == dns then dns = "<font color='grey'><b>no</b></font>" end | 400 | if "" == dns then dns = "<font color='grey'><b>no</b></font>" end |
| 427 | 401 | ||
| 428 | if 0 == max then | 402 | if 0 == max then |
| @@ -495,6 +469,7 @@ if nil == web then C("opening mirrors file - " .. e) else | |||
| 495 | APT.mirrors[k].BaseURL = nil | 469 | APT.mirrors[k].BaseURL = nil |
| 496 | APT.mirrors[k].Country = nil | 470 | APT.mirrors[k].Country = nil |
| 497 | APT.mirrors[k].Bandwidth = nil | 471 | APT.mirrors[k].Bandwidth = nil |
| 472 | |||
| 498 | for l, w in pairs(APT.mirrors[k].IPs) do | 473 | for l, w in pairs(APT.mirrors[k].IPs) do |
| 499 | if type(w) == "table" then | 474 | if type(w) == "table" then |
| 500 | n[l] = {} | 475 | n[l] = {} |
| @@ -564,33 +539,20 @@ if nil == web then C("opening mirrors file - " .. e) else | |||
| 564 | 539 | ||
| 565 | -- DNS-RR test. | 540 | -- DNS-RR test. |
| 566 | if ("deb.devuan.org" ~= k) and (nil ~= APT.debians["deb.devuan.org"]) then | 541 | if ("deb.devuan.org" ~= k) and (nil ~= APT.debians["deb.devuan.org"]) then |
| 567 | for l, w in pairs(APT.debians[k].IPs) do | 542 | APT.allpairs(APT.debians[k].IPs, |
| 568 | if type(w) == "table" then | 543 | function(i, w, k, v) |
| 569 | for i, u in pairs(w) do | 544 | if nil ~= APT.mirrors["deb.devuan.org"].IPs["deb.roundr.devuan.org"][i] then |
| 570 | if nil ~= APT.debians["deb.devuan.org"].IPs["deb.roundr.devuan.org"][i] then | 545 | local log = logCount("deb.devuan.org", i) |
| 571 | local log = logCount("deb.devuan.org", i) | ||
| 572 | if "" ~= log then | ||
| 573 | if "" == dns then dns = " " else dns = dns .. " " end | ||
| 574 | dns = dns .. logCount("deb.devuan.org", i) | ||
| 575 | else | ||
| 576 | if "" == dns then dns = " " else dns = dns .. " " end | ||
| 577 | dns = dns .. "<font color='maroon'><b>" .. i .. "</b></font>" | ||
| 578 | end | ||
| 579 | end | ||
| 580 | end | ||
| 581 | else | ||
| 582 | if nil ~= APT.debians["deb.devuan.org"].IPs["deb.roundr.devuan.org"][l] then | ||
| 583 | local log = logCount("deb.devuan.org", l) | ||
| 584 | if "" ~= log then | 546 | if "" ~= log then |
| 585 | if "" == dns then dns = " " else dns = dns .. " " end | 547 | if "" == dns then dns = " " else dns = dns .. " " end |
| 586 | dns = dns .. log | 548 | dns = dns .. logCount("deb.devuan.org", i) |
| 587 | else | 549 | else |
| 588 | if "" == dns then dns = " " else dns = dns .. " " end | 550 | if "" == dns then dns = " " else dns = dns .. " " end |
| 589 | dns = dns .. "<font color='maroon'><b>" .. l .. "</b></font>" | 551 | dns = dns .. "<font color='maroon'><b>" .. i .. "</b></font>" |
| 590 | end | 552 | end |
| 591 | end | 553 | end |
| 592 | end | 554 | end |
| 593 | end | 555 | ) |
| 594 | if "" == dns then dns = "<font color='grey'><b>no</b></font>" end | 556 | if "" == dns then dns = "<font color='grey'><b>no</b></font>" end |
| 595 | 557 | ||
| 596 | if 0 == max then | 558 | if 0 == max then |
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 25c2b49..675754d 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
| @@ -1011,17 +1011,8 @@ if 0 < #arg then | |||
| 1011 | if nil == path then path = '' end | 1011 | if nil == path then path = '' end |
| 1012 | if APT.origin then | 1012 | if APT.origin then |
| 1013 | local ips = APT.results["IPs"] | 1013 | local ips = APT.results["IPs"] |
| 1014 | for k, v in pairs(ips) do | 1014 | APT.allpairs(ips, |
| 1015 | if "table" == type(v) then | 1015 | function(k, v) |
| 1016 | for k1, v1 in pairs(v) do | ||
| 1017 | if v1 == "A" then | ||
| 1018 | if APT.testing("IPv4") then APT.exe("./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k1 .. " " .. file):Nice():log():fork() end | ||
| 1019 | elseif v1 == "AAAA" then | ||
| 1020 | if APT.testing("IPv6") then APT.exe("./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k1 .. " " .. file):Nice():log():fork() end | ||
| 1021 | end | ||
| 1022 | D('logging to ' .. APT.logName(pu.host, k1, file)[2]) | ||
| 1023 | end | ||
| 1024 | else | ||
| 1025 | if v == "A" then | 1016 | if v == "A" then |
| 1026 | if APT.testing("IPv4") then APT.exe("./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k .. " " .. file):Nice():log():fork() end | 1017 | if APT.testing("IPv4") then APT.exe("./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k .. " " .. file):Nice():log():fork() end |
| 1027 | elseif v == "AAAA" then | 1018 | elseif v == "AAAA" then |
| @@ -1029,7 +1020,7 @@ if 0 < #arg then | |||
| 1029 | end | 1020 | end |
| 1030 | D('logging to ' .. APT.logName(pu.host, k, file)[2]) | 1021 | D('logging to ' .. APT.logName(pu.host, k, file)[2]) |
| 1031 | end | 1022 | end |
| 1032 | end | 1023 | ) |
| 1033 | end | 1024 | end |
| 1034 | 1025 | ||
| 1035 | if not APT.redir then | 1026 | if not APT.redir then |
| @@ -1156,48 +1147,28 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. | |||
| 1156 | if not dn then table.insert(baseFiles, ll) end | 1147 | if not dn then table.insert(baseFiles, ll) end |
| 1157 | end | 1148 | end |
| 1158 | 1149 | ||
| 1159 | APT.logOpen(hst) | 1150 | local combine = function(ip, a) |
| 1160 | APT.logFile:write('<h1>Note log lines will be out of order, this is a bunch of other log files combined.</h1>\n') | 1151 | if not APT.logOpen(hst, ip) then print('PROBLEM OPENING LOG FILE ' .. hst .. ' ' .. ip) end |
| 1161 | for i, f in pairs(baseFiles) do | 1152 | APT.logFile:write('<h1>Note log lines will be out of order, this is a bunch of other log files combined.</h1>\n') |
| 1162 | f = f:sub(9, -1) | 1153 | for i, f in pairs(a) do |
| 1163 | APT.logFile:write('<hr>\n<hr>\n<h2><a href="' .. f .. '">' .. f .. '</a></h2>\n') | 1154 | f = f:sub(9, -1) |
| 1164 | for l in io.lines('results/' .. f) do | 1155 | APT.logFile:write('<hr>\n<hr>\n<h2><a href="' .. f .. '">' .. f .. '</a></h2>\n') |
| 1165 | if l:match('^' .. os.date('%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(l .. '\n') end | 1156 | for ln in io.lines('results/' .. f) do |
| 1157 | if ln:match('^' .. os.date('!%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(ln .. '\n') end -- %F isn't good enough, coz we have to escape the '-'. | ||
| 1158 | end | ||
| 1166 | end | 1159 | end |
| 1160 | APT.logPost() | ||
| 1161 | APT.args = APT_args | ||
| 1162 | APT.logFile = APT_logFile | ||
| 1167 | end | 1163 | end |
| 1168 | APT.logPost() | 1164 | combine(nil, baseFiles) |
| 1169 | APT.args = APT_args | ||
| 1170 | APT.logFile = APT_logFile | ||
| 1171 | |||
| 1172 | for ip, a in pairs(IPfiles) do | 1165 | for ip, a in pairs(IPfiles) do |
| 1173 | if nil == a[1] then | 1166 | if nil == a[1] then |
| 1174 | for i, f in pairs(a) do | 1167 | for i, f in pairs(a) do |
| 1175 | if not APT.logOpen(hst, i) then print('PROBLEM OPENING LOG FILE ' .. hst .. ' ' .. i) end | 1168 | combine(i, f) |
| 1176 | APT.logFile:write('<h1>Note log lines will be out of order, this is a bunch of other log files combined.</h1>\n') | ||
| 1177 | for j, g in pairs(f) do | ||
| 1178 | g = g:sub(9, -1) | ||
| 1179 | APT.logFile:write('<hr>\n<hr>\n<h2><a href="' .. g .. '">' .. g .. '</a></h2>\n') | ||
| 1180 | for l in io.lines('results/' .. g) do | ||
| 1181 | if l:match('^' .. os.date('%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(l .. '\n') end | ||
| 1182 | end | ||
| 1183 | end | ||
| 1184 | APT.logPost() | ||
| 1185 | APT.args = APT_args | ||
| 1186 | APT.logFile = APT_logFile | ||
| 1187 | end | 1169 | end |
| 1188 | else | 1170 | else |
| 1189 | if not APT.logOpen(hst, ip) then print('PROBLEM OPENING LOG FILE ' .. hst .. ' ' .. ip) end | 1171 | combine(ip, a) |
| 1190 | APT.logFile:write('<h1>Note log lines will be out of order, this is a bunch of other log files combined.</h1>\n') | ||
| 1191 | for i, f in pairs(a) do | ||
| 1192 | f = f:sub(9, -1) | ||
| 1193 | APT.logFile:write('<hr>\n<hr>\n<h2><a href="' .. f .. '">' .. f .. '</a></h2>\n') | ||
| 1194 | for l in io.lines('results/' .. f) do | ||
| 1195 | if l:match('^' .. os.date('%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(l .. '\n') end | ||
| 1196 | end | ||
| 1197 | end | ||
| 1198 | APT.logPost() | ||
| 1199 | APT.args = APT_args | ||
| 1200 | APT.logFile = APT_logFile | ||
| 1201 | end | 1172 | end |
| 1202 | end | 1173 | end |
| 1203 | 1174 | ||
