diff options
Diffstat (limited to 'apt-panopticon.lua')
-rwxr-xr-x | apt-panopticon.lua | 65 |
1 files changed, 18 insertions, 47 deletions
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 | ||