diff options
Diffstat (limited to '')
-rwxr-xr-x | apt-panopticon.lua | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 8543210..482a2ac 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -175,24 +175,21 @@ gatherIPs = function (host) | |||
175 | -- Takes about 30 seconds to look up the lot. | 175 | -- Takes about 30 seconds to look up the lot. |
176 | -- I tested using dig's -f option, it didn't seem much faster. | 176 | -- I tested using dig's -f option, it didn't seem much faster. |
177 | -- The sort -r assumes that deb.devuan.org is the first alphabetically. | 177 | -- The sort -r assumes that deb.devuan.org is the first alphabetically. |
178 | local dig = io.popen('dig +keepopen +noall +nottlid +answer ' .. host .. ' A ' .. host .. ' AAAA ' .. host .. ' CNAME ' .. host .. ' SRV | sort -r | uniq') | 178 | local dig = APT.readCmd('dig +keepopen +noall +nottlid +answer ' .. host .. ' A ' .. host .. ' AAAA ' .. host .. ' CNAME ' .. host .. ' SRV | sort -r | uniq') |
179 | repeat | 179 | for i,IPs in ipairs(dig) do |
180 | IPs = dig:read("*l") | 180 | for k, t, v in IPs:gmatch("([%w_%-%.]*)%.%s*IN%s*(%a*)%s*(.*)") do |
181 | if nil ~= IPs then | 181 | if "." == v:sub(-1, -1) then v = v:sub(1, -2) end |
182 | for k, t, v in IPs:gmatch("([%w_%-%.]*)%.%s*IN%s*(%a*)%s*(.*)") do | 182 | if nil == IP[k] then IP[k] = {} end |
183 | if "." == v:sub(-1, -1) then v = v:sub(1, -2) end | 183 | IP[k][v] = t |
184 | if nil == IP[k] then IP[k] = {} end | 184 | D(" DNS record " .. host .. " == " .. k .. " type " .. t .. " -> " .. v) |
185 | IP[k][v] = t | 185 | if t == "CNAME" then |
186 | D(" DNS record " .. host .. " == " .. k .. " type " .. t .. " -> " .. v) | 186 | gatherIPs(v) |
187 | if t == "CNAME" then | 187 | IP[k][v] = IP[v] |
188 | gatherIPs(v) | 188 | elseif v == "SRV" then |
189 | IP[k][v] = IP[v] | 189 | print("SVR record found, now what do we do?") |
190 | elseif v == "SRV" then | ||
191 | print("SVR record found, now what do we do?") | ||
192 | end | ||
193 | end | 190 | end |
194 | end | 191 | end |
195 | until nil == IPs | 192 | end |
196 | end | 193 | end |
197 | 194 | ||
198 | -- If this is the DNS-RR domain name, gather the IPs for the mirrors that mirror_list.txt says should be in it. | 195 | -- If this is the DNS-RR domain name, gather the IPs for the mirrors that mirror_list.txt says should be in it. |
@@ -1179,8 +1176,8 @@ else | |||
1179 | local APT_args = APT.args | 1176 | local APT_args = APT.args |
1180 | local APT_logFile = APT.logFile | 1177 | local APT_logFile = APT.logFile |
1181 | local debians = {} | 1178 | local debians = {} |
1182 | local srvs = io.popen('ls -1 results/*.lua') | 1179 | local srvs = APT.readCmd('ls -1 results/*.lua') |
1183 | for l in srvs:lines() do | 1180 | for ii,l in ipairs(srvs) do |
1184 | local hst = l:sub(9, -5) | 1181 | local hst = l:sub(9, -5) |
1185 | if nil ~= l:find('_R%.lua') then hst = hst:sub(1, -3) end | 1182 | if nil ~= l:find('_R%.lua') then hst = hst:sub(1, -3) end |
1186 | if (hst:find('_') == nil) and (nil == APT.mirrors[hst]) then | 1183 | if (hst:find('_') == nil) and (nil == APT.mirrors[hst]) then |
@@ -1197,8 +1194,8 @@ else | |||
1197 | end | 1194 | end |
1198 | end | 1195 | end |
1199 | end | 1196 | end |
1200 | local files = io.popen('ls -1 results/LOG_' .. hst .. '_*.html') | 1197 | local files = APT.readCmd('ls -1 results/LOG_' .. hst .. '_*.html') |
1201 | for ll in files:lines() do | 1198 | for iii,ll in ipairs(files) do |
1202 | local dn = false | 1199 | local dn = false |
1203 | for i, a in pairs(ips) do | 1200 | for i, a in pairs(ips) do |
1204 | if type(a) == 'table' then | 1201 | if type(a) == 'table' then |