feat: report preview page, sharp report logo, time to ban by blocker
The Reports page now previews the HTML report itself (same document as the download and the print), with only Download and Print. The report logo is the repository logo at 800 px. Survival splits fail2ban and the Urutau second firewall. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5d3374ee11
commit
9bdfdb491b
10 files changed
+245
-500
No files matched your search
@@ -10,6 +10,13 @@
|
||||
|
||||
U.registerI18n({
|
||||
en: {
|
||||
'an.sv.blk': 'Who blocked, and how fast',
|
||||
'an.sv.blk.hint': 'Bans applied by the server firewall (fail2ban jails) and by the Urutau second firewall, with the time from the start of the attack episode to the ban.',
|
||||
'an.sv.blk.fail2ban': 'Server firewall (fail2ban)',
|
||||
'an.sv.blk.urutau': 'Urutau second firewall',
|
||||
'an.sv.blk.row': '{n} bans ({pct}) · median {p50} · 90% within {p90}',
|
||||
'an.sv.blk.none': 'No bans in this slice.',
|
||||
'an.sv.blk.off': 'The Urutau second firewall has not banned anyone in this slice. Turn it on with URUTAU_ENFORCE=on (see Defense).',
|
||||
'an.sv.title': 'Survival',
|
||||
'an.sv.lead': 'Half of the attack episodes end in a ban within {dur}',
|
||||
'an.sv.lead.unknown': 'Fewer than half of the attack episodes ended in a ban',
|
||||
@@ -41,6 +48,13 @@
|
||||
'an.sv.retry': 'Try again'
|
||||
},
|
||||
'pt-BR': {
|
||||
'an.sv.blk': 'Quem bloqueou, e com que rapidez',
|
||||
'an.sv.blk.hint': 'Bans aplicados pelo firewall do servidor (jails do fail2ban) e pelo segundo firewall do Urutau, com o tempo entre o início do episódio de ataque e o ban.',
|
||||
'an.sv.blk.fail2ban': 'Firewall do servidor (fail2ban)',
|
||||
'an.sv.blk.urutau': 'Segundo firewall do Urutau',
|
||||
'an.sv.blk.row': '{n} bans ({pct}) · mediana {p50} · 90% em até {p90}',
|
||||
'an.sv.blk.none': 'Nenhum ban neste recorte.',
|
||||
'an.sv.blk.off': 'O segundo firewall do Urutau não baniu ninguém neste recorte. Ligue com URUTAU_ENFORCE=on (veja Defesa).',
|
||||
'an.sv.title': 'Sobrevivência',
|
||||
'an.sv.lead': 'Metade dos episódios de ataque termina em ban em até {dur}',
|
||||
'an.sv.lead.unknown': 'Menos da metade dos episódios de ataque terminou em ban',
|
||||
@@ -148,16 +162,19 @@
|
||||
tip(curve, 'term.kaplan_meier');
|
||||
var fam = U.ui.panel({ title: t('an.sv.fam'), hint: t('an.sv.fam.hint'), loading: true });
|
||||
tip(fam, 'metric.mttb');
|
||||
var blk = U.ui.panel({ title: t('an.sv.blk'), hint: t('an.sv.blk.hint'), loading: true });
|
||||
tip(blk, 'term.second_firewall');
|
||||
var rec = U.ui.panel({ title: t('an.sv.rec'), hint: t('an.sv.rec.hint'), loading: true });
|
||||
tip(rec, 'term.recidivism');
|
||||
grid.appendChild(lead);
|
||||
grid.appendChild(curve); curve.classList.add('span-8');
|
||||
grid.appendChild(fam); fam.classList.add('span-4');
|
||||
grid.appendChild(blk); blk.classList.add('span-12');
|
||||
grid.appendChild(rec); rec.classList.add('span-12');
|
||||
root.appendChild(grid);
|
||||
|
||||
function paint() {
|
||||
clear(lead); [curve, fam, rec].forEach(function (p) { clear(p.body); });
|
||||
clear(lead); [curve, fam, blk, rec].forEach(function (p) { clear(p.body); });
|
||||
if (!data) return;
|
||||
var d = data, range = U.rangeLabel({ inline: true });
|
||||
if (!d.enabled) { lead.appendChild(U.ui.empty(t('an.sv.off'), t('an.sv.off.d'))); return; }
|
||||
@@ -166,6 +183,7 @@
|
||||
curve.body.appendChild(U.ui.empty(t('charts.empty')));
|
||||
fam.body.appendChild(U.ui.empty(t('charts.empty')));
|
||||
rec.body.appendChild(U.ui.empty(t('charts.empty')));
|
||||
blk.body.appendChild(U.ui.empty(t('charts.empty')));
|
||||
return;
|
||||
}
|
||||
var med = d.median_to_ban_s, p90 = d.p90_to_ban_s, recpct = U.fmt.pct(d.recidivism_pct / 100);
|
||||
@@ -174,6 +192,7 @@
|
||||
lead.appendChild(U.ui.lead(title, t(typeof p90 === 'number' ? 'an.sv.lead.body' : 'an.sv.lead.body.nop90', vars), typeof med === 'number' && med <= 3600 ? 'ok' : 'danger'));
|
||||
curve.body.appendChild(km(d.km || [], typeof med === 'number' ? med : null));
|
||||
fam.body.appendChild(boxes(d.by_family || []));
|
||||
blockers(d.by_blocker || []);
|
||||
if (!d.recidivists || !d.recidivists.length) { rec.body.appendChild(U.ui.empty(t('an.sv.rec.none'))); return; }
|
||||
var ul = el('ul', { class: 'an-list an-rec' });
|
||||
d.recidivists.forEach(function (r) {
|
||||
@@ -182,6 +201,28 @@
|
||||
});
|
||||
rec.body.appendChild(ul);
|
||||
}
|
||||
function blockers(list) {
|
||||
var total = 0, byB = {};
|
||||
list.forEach(function (b) { total += b.bans; byB[b.blocker] = b; });
|
||||
if (!total) { blk.body.appendChild(U.ui.empty(t('an.sv.blk.none'))); return; }
|
||||
var bar = el('div', { class: 'sv-blk-bar', role: 'img', 'aria-label': t('an.sv.blk') });
|
||||
var ul = el('ul', { class: 'an-list sv-blk' });
|
||||
['fail2ban', 'urutau'].forEach(function (k) {
|
||||
var b = byB[k];
|
||||
var row = el('li', null, el('span', { class: 'sv-blk-dot sv-blk-' + k }), el('strong', null, t('an.sv.blk.' + k)));
|
||||
if (b) {
|
||||
var share = b.bans / total;
|
||||
bar.appendChild(el('span', { class: 'sv-blk-seg sv-blk-' + k }));
|
||||
bar.lastChild.style.flexGrow = String(b.bans);
|
||||
row.appendChild(el('span', { class: 'an-n' }, t('an.sv.blk.row', { n: U.fmt.num(b.bans), pct: U.fmt.pct(share), p50: dur(b.median_s), p90: dur(b.p90_s) })));
|
||||
} else if (k === 'urutau') {
|
||||
row.appendChild(el('span', { class: 'an-n' }, t('an.sv.blk.off')));
|
||||
}
|
||||
ul.appendChild(row);
|
||||
});
|
||||
blk.body.appendChild(bar);
|
||||
blk.body.appendChild(ul);
|
||||
}
|
||||
function load() {
|
||||
var my = ++seq;
|
||||
var p = Object.assign({}, U.rangeParams());
|
||||
|
||||
Reference in new issue
Block a user