feat: 1.3.0 thirteen new pages, charts, tooltips and error analysis
Release / Plan (reuse the published image?) (push) Successful in 3s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 28s
CI / Dependency audit (push) Successful in 20s
CI / Tests (Linux, race detector) (push) Successful in 1m10s
Release / ci (push) Successful in 1m10s
Release / Build image (arm64) (push) Successful in 55s
Release / Build image (amd64) (push) Successful in 1m16s
Release / Publish tags (push) Successful in 14s
Release / Gitea release (push) Skipped

New pages grouped in the rail (Monitor, Investigate, Analyze, Operate,
Reports): Services (SLO, Apdex, latency app vs proxy), Sessions (stage
funnel), Campaigns, Event search, MITRE ATT&CK matrix, Evolution,
Concentration (Pareto, Gini), Survival (Kaplan-Meier per attack
episode, recidivists), Where errors come from (application vs failed
attack vs proxy vs client), Protocols and TLS, Defense (fail2ban, SSH,
blocklist), Integrity, and a printable executive report.

Chart library (donut, radar, stacked area, bars, heatmap, gauge),
glossary with accessible "?" tooltips, self-explanatory category names
(nonexistent page 404), page loader through pages.json.

Unique visitors fixed: real browsers opening a page, one per IP per day,
deduplicated across domains, with non-human clients counted apart.
Anonymous legitimate visits on the Live page (?visits=1, no IP).
Traefik origin, service, protocol and TLS fields parsed. Paths and
Referer paths drop e-mail and token segments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-14 22:39:33 -03:00
1 parent b7462c14fa
commit 2ebda1e4d7
79 files changed
+9091 -171

No files matched your search

+218
View File
@@ -0,0 +1,218 @@
/* Urutau - SOBREVIVENCIA page: how long until the ban, and who comes back?
Kaplan-Meier curve (attackers never banned are censored), time-to-ban range
per family (p25-p75 bar with the median) and the list of repeat offenders.
Data: /api/v1/survival. Log data is hostile: textContent only. */
(function () {
'use strict';
var U = window.Urutau;
if (!U || !U.registerPage) return;
var el = U.el, t = U.t;
U.registerI18n({
en: {
'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',
'an.sv.lead.empty': 'No attackers to follow',
'an.sv.lead.body': '{banned} of {n} attackers banned {range}; {rec} of the banned came back and were banned again. 90% banned within {p90}.',
'an.sv.lead.body.nop90': '{banned} of {n} attackers banned {range}; {rec} of the banned came back and were banned again.',
'an.sv.lead.empty.body': 'Nothing was recorded {range}.',
'an.sv.km': 'Share still unbanned over time',
'an.sv.km.hint': 'Kaplan-Meier curve per attack episode, from its first malicious event. Episodes that ended without a ban only count as time observed.',
'an.sv.x': 'Time since the start of the episode',
'an.sv.y': 'Not banned yet',
'an.sv.median': 'median {dur}',
'an.sv.fam': 'Time to ban by family',
'an.sv.fam.hint': 'The bar spans the 25th to the 75th percentile; the mark is the median.',
'an.sv.fam.row': '{fam}: median {p50}, from {p25} to {p75} ({n} banned)',
'an.sv.rec': 'Repeat offenders',
'an.sv.rec.hint': 'Addresses banned more than once. Open one to see its history.',
'an.sv.rec.none': 'Nobody was banned twice in this slice.',
'an.sv.rec.row': '{bans} bans, last {ago}',
'an.sv.recpct': 'Recidivism',
'an.sv.none': 'No banned attackers with a known family in this slice.',
'an.sv.dur.s': '{n} s',
'an.sv.dur.m': '{n} min',
'an.sv.dur.h': '{n} h',
'an.sv.dur.d': '{n} d',
'an.sv.off': 'The event registry is off',
'an.sv.off.d': 'This analysis reads the event registry, which is not enabled on this instance.',
'an.sv.err': 'Could not load this analysis.',
'an.sv.retry': 'Try again'
},
'pt-BR': {
'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',
'an.sv.lead.empty': 'Nenhum atacante para acompanhar',
'an.sv.lead.body': '{banned} de {n} atacantes banidos {range}; {rec} dos banidos voltaram e foram banidos de novo. 90% banidos em até {p90}.',
'an.sv.lead.body.nop90': '{banned} de {n} atacantes banidos {range}; {rec} dos banidos voltaram e foram banidos de novo.',
'an.sv.lead.empty.body': 'Nada foi registrado {range}.',
'an.sv.km': 'Parcela ainda sem ban ao longo do tempo',
'an.sv.km.hint': 'Curva de Kaplan-Meier por episódio de ataque, desde o primeiro evento malicioso. Episódios que terminaram sem ban contam só como tempo observado.',
'an.sv.x': 'Tempo desde o início do episódio',
'an.sv.y': 'Ainda não banido',
'an.sv.median': 'mediana {dur}',
'an.sv.fam': 'Tempo até o ban por família',
'an.sv.fam.hint': 'A barra vai do percentil 25 ao 75; a marca é a mediana.',
'an.sv.fam.row': '{fam}: mediana {p50}, de {p25} a {p75} ({n} banidos)',
'an.sv.rec': 'Reincidentes',
'an.sv.rec.hint': 'Endereços banidos mais de uma vez. Abra um para ver o histórico.',
'an.sv.rec.none': 'Ninguém foi banido duas vezes neste recorte.',
'an.sv.rec.row': '{bans} bans, último {ago}',
'an.sv.recpct': 'Reincidência',
'an.sv.none': 'Nenhum atacante banido com família conhecida neste recorte.',
'an.sv.dur.s': '{n} s',
'an.sv.dur.m': '{n} min',
'an.sv.dur.h': '{n} h',
'an.sv.dur.d': '{n} d',
'an.sv.off': 'O registro de eventos está desligado',
'an.sv.off.d': 'Esta análise lê o registro de eventos, que não está ativo nesta instância.',
'an.sv.err': 'Não foi possível carregar esta análise.',
'an.sv.retry': 'Tentar de novo'
}
});
function tip(p, key) { var h2 = p.querySelector('.panel-h h2'); if (h2 && U.help) U.help(h2, key); return p; }
function clear(n) { while (n.firstChild) n.removeChild(n.firstChild); }
function one(x) { return U.fmt.num(Math.round(x * 10) / 10); }
function dur(sec) {
if (sec < 90) return t('an.sv.dur.s', { n: Math.round(sec) });
if (sec < 5400) return t('an.sv.dur.m', { n: Math.round(sec / 60) });
if (sec < 129600) return t('an.sv.dur.h', { n: one(sec / 3600) });
return t('an.sv.dur.d', { n: one(sec / 86400) });
}
// step curve of the survival function; x linear in time
function km(points, median) {
var W = 640, H = 280, L = 44, R = 14, T = 12, B = 34, w = W - L - R, h = H - T - B;
var tmax = points.length ? points[points.length - 1].t_s : 0;
if (tmax <= 0) tmax = 1;
var svg = el('svg', { viewBox: '0 0 ' + W + ' ' + H, class: 'an-svg', role: 'img', 'aria-label': t('an.sv.km'), preserveAspectRatio: 'xMidYMid meet' });
function X(v) { return L + v / tmax * w; }
function Y(v) { return T + (1 - v) * h; }
[0, 0.25, 0.5, 0.75, 1].forEach(function (v) {
svg.appendChild(el('line', { class: 'an-grid', x1: L, x2: W - R, y1: Y(v), y2: Y(v) }));
svg.appendChild(el('text', { class: 'an-tick', x: L - 6, y: Y(v) + 4, 'text-anchor': 'end' }, Math.round(v * 100) + '%'));
});
[0, 0.5, 1].forEach(function (f) {
svg.appendChild(el('text', { class: 'an-tick', x: X(f * tmax), y: H - 16, 'text-anchor': f === 0 ? 'start' : f === 1 ? 'end' : 'middle' }, dur(f * tmax)));
});
svg.appendChild(el('text', { class: 'an-tick', x: L + w / 2, y: H - 2, 'text-anchor': 'middle' }, t('an.sv.x')));
var d = '';
points.forEach(function (p, i) {
d += (i ? 'H' + X(p.t_s).toFixed(1) + 'V' : 'M' + X(p.t_s).toFixed(1) + ',') + Y(p.survival).toFixed(1);
if (!i) d += '';
});
if (points.length) {
svg.appendChild(el('path', { class: 'an-fill', d: d + 'V' + Y(0) + 'H' + X(0) + 'Z' }));
svg.appendChild(el('path', { class: 'an-line', d: d }));
}
if (typeof median === 'number') {
svg.appendChild(el('line', { class: 'an-guide', x1: X(median), x2: X(median), y1: T, y2: T + h }));
svg.appendChild(el('line', { class: 'an-guide', x1: L, x2: X(median), y1: Y(0.5), y2: Y(0.5) }));
svg.appendChild(el('text', { class: 'an-tick an-strong', x: Math.min(X(median) + 6, W - R), y: T + 12, 'text-anchor': X(median) > W - 120 ? 'end' : 'start' }, t('an.sv.median', { dur: dur(median) })));
}
points.forEach(function (p) {
if (points.length > 60) return;
svg.appendChild(el('circle', { class: 'an-dot', cx: X(p.t_s), cy: Y(p.survival), r: 3 }, el('title', null, dur(p.t_s) + ': ' + Math.round(p.survival * 1000) / 10 + '%')));
});
return el('div', { class: 'an-chart' }, svg);
}
function boxes(rows) {
if (!rows.length) return U.ui.empty(t('an.sv.none'));
var max = 1;
rows.forEach(function (r) { if (r.p75 > max) max = r.p75; });
max *= 1.08;
var box = el('div', { class: 'an-boxes' });
rows.forEach(function (r) {
var left = r.p25 / max * 100, width = Math.max((r.p75 - r.p25) / max * 100, 1.2), med = r.p50 / max * 100;
var track = el('div', { class: 'an-track' },
el('div', { class: 'an-box', style: { left: left + '%', width: width + '%' } }),
el('div', { class: 'an-med', style: { left: med + '%' } }));
var row = el('div', { class: 'an-boxrow', role: 'img', 'aria-label': t('an.sv.fam.row', { fam: r.fam, p50: dur(r.p50), p25: dur(r.p25), p75: dur(r.p75), n: r.n }) },
el('span', { class: 'an-fam mono' }, r.fam), track, el('span', { class: 'an-val' }, dur(r.p50)));
row.setAttribute('title', t('an.sv.fam.row', { fam: r.fam, p50: dur(r.p50), p25: dur(r.p25), p75: dur(r.p75), n: r.n }));
box.appendChild(row);
});
return box;
}
var inst = null;
function create(root, ctx) {
var seq = 0, alive = true, data = null, c = ctx;
var grid = el('div', { class: 'grid-12 an-page' });
var lead = el('div', { class: 'span-12' });
var curve = U.ui.panel({ title: t('an.sv.km'), hint: t('an.sv.km.hint'), variant: 'chart', loading: true });
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 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(rec); rec.classList.add('span-12');
root.appendChild(grid);
function paint() {
clear(lead); [curve, fam, 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; }
if (!d.attackers) {
lead.appendChild(U.ui.lead(t('an.sv.lead.empty'), t('an.sv.lead.empty.body', { range: range }), 'neutral'));
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')));
return;
}
var med = d.median_to_ban_s, p90 = d.p90_to_ban_s, recpct = U.fmt.pct(d.recidivism_pct / 100);
var vars = { banned: U.fmt.num(d.banned), n: U.fmt.num(d.attackers), range: range, rec: recpct, p90: typeof p90 === 'number' ? dur(p90) : '' };
var title = typeof med === 'number' ? t('an.sv.lead', { dur: dur(med) }) : t('an.sv.lead.unknown');
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 || []));
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) {
var a = el('a', { class: 'mono', href: '#/ip/' + encodeURIComponent(r.ip) }, r.ip);
ul.appendChild(el('li', null, a, el('span', { class: 'an-n' }, t('an.sv.rec.row', { bans: r.bans, ago: U.fmt.ago(r.last) }))));
});
rec.body.appendChild(ul);
}
function load() {
var my = ++seq;
var p = Object.assign({}, U.rangeParams());
if (c.host && c.host !== 'all') p.host = c.host;
U.api('/api/v1/survival', p).then(function (r) {
if (!alive || my !== seq) return;
data = r; paint();
}, function () {
if (!alive || my !== seq || data) return;
clear(lead);
var b = el('button', { type: 'button', class: 'btn' }, t('an.sv.retry'));
b.addEventListener('click', load);
lead.appendChild(el('div', { class: 'state-error' }, el('strong', null, t('an.sv.err')), b));
});
}
load();
return {
root: root, lang: ctx.lang,
update: function (cx) { c = cx; load(); },
destroy: function () { alive = false; seq++; clear(root); }
};
}
U.registerPage({
id: 'survival', group: 'analyze', titleKey: 'an.sv.title',
icon: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><path d="M4 20V4"/><path d="M4 20h16"/><path d="M4 6h4v4h4v5h4v3h4"/></svg>',
mount: function (el, ctx) { if (inst) inst.destroy(); inst = create(el, ctx || {}); },
update: function (ctx) {
ctx = ctx || {};
if (inst && ctx.lang !== inst.lang) { var r = inst.root; inst.destroy(); inst = create(r, ctx); } else if (inst) inst.update(ctx);
},
unmount: function () { if (inst) { inst.destroy(); inst = null; } }
});
})();