feat: 1.4.1 pagination, network probes, survival by blocker, report polish
Release / Publish tags (push) Successful in 18s
Release / Plan (reuse the published image?) (push) Successful in 5s
Release / ci (push) Successful in 1m47s
Release / Build image (amd64) (push) Successful in 21s
Release / Build image (arm64) (push) Successful in 28s
CI / Format and vet (push) Successful in 23s
CI / Tests (Linux, race detector) (push) Successful in 1m24s
CI / Dependency audit (push) Successful in 24s
CI / Docker image (build and smoke test) (push) Skipped
Release / Gitea release (push) Successful in 5s

Backend pagination with one pager for sessions, IPs, campaigns and events;
network probe source (port-scan, T1046, second firewall reason port-scan);
host kit logs inbound probes; urutau call on the report cover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-15 00:21:43 -03:00
1 parent f27d8441a9
commit 432f521ed1
40 files changed
+927 -136

No files matched your search

+19 -17
View File
@@ -5,7 +5,7 @@
var CATS = ['notfound', 'scanner', 'bruteforce', 'exploit', 'ssh-fail', 'ssh-probe', 'ssh-ok', 'ban'];
var CAT_OK = {}; CATS.concat(['ok']).forEach(function (c) { CAT_OK[c] = 1; });
var ICON = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l5 5"/></svg>';
var PAGE = 100, MAXROWS = 5000;
var PAGE = 100;
function boot() {
var U = window.Urutau;
@@ -17,7 +17,7 @@
'sr.title': 'Event search',
'sr.lead.one': '{n} event found',
'sr.lead.other': '{n} events found',
'sr.lead.more': 'More events match; load more to continue.',
'sr.lead.more': 'More events match; use Next page to continue.',
'sr.lead.body': 'Events {range}, newest first.',
'sr.lead.empty': 'No event matches',
'sr.lead.emptyBody': 'Nothing {range} fits these filters, or the event registry is off.',
@@ -35,7 +35,6 @@
'sr.f.s5': '5xx',
'sr.search': 'Search',
'sr.clear': 'Clear',
'sr.more': 'Load more',
'sr.csv': 'Export CSV',
'sr.csv.done': 'CSV saved',
'sr.c.time': 'Time',
@@ -46,7 +45,6 @@
'sr.c.status': 'Status',
'sr.c.fam': 'Family',
'sr.statusnote': 'The status filter applies to the rows already loaded.',
'sr.cap': 'Row limit reached ({n}); narrow the search.',
'sr.err': 'Search failed.',
'sr.retry': 'Try again',
'sr.busy': 'The server is busy; try again in a few seconds.',
@@ -56,7 +54,7 @@
'sr.title': 'Busca de eventos',
'sr.lead.one': '{n} evento encontrado',
'sr.lead.other': '{n} eventos encontrados',
'sr.lead.more': 'Há mais eventos; carregue mais para continuar.',
'sr.lead.more': 'Há mais eventos; use Próxima página para continuar.',
'sr.lead.body': 'Eventos {range}, do mais novo ao mais antigo.',
'sr.lead.empty': 'Nenhum evento encontrado',
'sr.lead.emptyBody': 'Nada {range} combina com estes filtros, ou o registro de eventos está desligado.',
@@ -74,7 +72,6 @@
'sr.f.s5': '5xx',
'sr.search': 'Buscar',
'sr.clear': 'Limpar',
'sr.more': 'Carregar mais',
'sr.csv': 'Exportar CSV',
'sr.csv.done': 'CSV salvo',
'sr.c.time': 'Hora',
@@ -85,7 +82,6 @@
'sr.c.status': 'Status',
'sr.c.fam': 'Família',
'sr.statusnote': 'O filtro de status vale para as linhas já carregadas.',
'sr.cap': 'Limite de linhas atingido ({n}); restrinja a busca.',
'sr.err': 'A busca falhou.',
'sr.retry': 'Tentar de novo',
'sr.busy': 'O servidor está ocupado; tente de novo em alguns segundos.',
@@ -103,7 +99,7 @@
var inst = null;
function Page(root, ctx) {
var self = this, alive = true, seq = 0, rows = [], next = '', total = 0, loaded = false, busy = false, err = '', capped = false;
var self = this, alive = true, seq = 0, rows = [], next = '', total = 0, loaded = false, busy = false, err = '', stack = [''];
this.ctx = ctx;
var q0 = (ctx.params && ctx.params.query) || {};
var F = { ip: q0.ip || '', q: q0.q || '', fam: q0.fam || '', cat: CATS.indexOf(q0.cat) >= 0 ? q0.cat : '', status: '', host: '' };
@@ -141,20 +137,27 @@
if (cursor) p.cursor = cursor;
return p;
}
function run() { rows = []; next = ''; total = 0; loaded = false; err = ''; capped = false; fetchPage(''); }
function fetchPage(cursor) {
// stack[i] is the cursor that opens page i+1; going back is popping, going forward pushes the `next` of the page shown
function run() { rows = []; next = ''; total = 0; loaded = false; err = ''; stack = ['']; fetchPage(0); }
function fetchPage(idx) {
var my = ++seq; busy = true; paint();
U.api('/api/v1/events', params(cursor)).then(function (d) {
U.api('/api/v1/events', params(stack[idx])).then(function (d) {
if (!alive || my !== seq) return;
busy = false; loaded = true; err = '';
rows = rows.concat(d.events || []); total = d.total_estimate || rows.length; next = d.next || '';
if (rows.length >= MAXROWS) { capped = true; next = ''; }
rows = d.events || []; total = d.total_estimate || rows.length; next = (d.events || []).length ? d.next || '' : '';
stack.length = idx + 1; cur = idx;
paint();
}).catch(function (e) {
if (!alive || my !== seq) return;
busy = false; loaded = true; err = e && e.status === 503 ? 'sr.busy' : e && e.status === 400 ? 'sr.badq' : 'sr.err'; paint();
});
}
var cur = 0;
function goto(n) { // n is the 0-based index of the page asked for
if (n === cur + 1 && next) stack[n] = next;
if (n < 0 || !stack[n] && n > 0) return;
fetchPage(n);
}
function visible() { return rows.filter(function (r) { return statusOk(F.status, r.status); }); }
function exportCsv() {
var cols = ['t', 'ip', 'cat', 'host', 'domain', 'method', 'path', 'status', 'fam', 'cc'];
@@ -175,7 +178,7 @@
if (!loaded) { out.appendChild(h('div', 'skeleton')); return; }
leadBox.appendChild(vis.length ? U.ui.lead(U.pl('sr.lead', vis.length, { n: nf(vis.length) + (next ? '+' : '') }), t('sr.lead.body', { range: range }) + (next ? ' ' + t('sr.lead.more') : ''), 'ok')
: U.ui.lead(t('sr.lead.empty'), t('sr.lead.emptyBody', { range: range }), 'neutral'));
if (!vis.length) { if (next) out.appendChild(moreBtn()); return; }
if (!vis.length) { var pe = pagerNode(); if (pe) out.appendChild(pe); return; }
var tb = h('tbody');
vis.forEach(function (r) {
function td(l, k, c) { return h('td', { 'data-label': l, class: c || null }, k); }
@@ -192,10 +195,9 @@
var th = h('tr'); ['time', 'ip', 'cat', 'host', 'path', 'status', 'fam'].forEach(function (k) { th.appendChild(h('th', { text: t('sr.c.' + k) })); });
var csv = h('button', { type: 'button', class: 'btn', text: t('sr.csv') }); csv.addEventListener('click', exportCsv);
out.appendChild(U.ui.panel({ title: t('sr.title'), help: 'cat.scanner', actions: [csv] }, h('table', 'stack sr-table', h('thead', null, th), tb)));
if (capped) out.appendChild(h('p', { class: 'note', text: t('sr.cap', { n: nf(MAXROWS) }) }));
if (next) out.appendChild(moreBtn());
var pn = pagerNode(); if (pn) out.appendChild(pn);
}
function moreBtn() { var b = h('button', { type: 'button', class: 'btn sr-more', text: t('sr.more') }); b.disabled = busy; b.addEventListener('click', function () { fetchPage(next); }); return b; }
function pagerNode() { return U.ui.pager({ page: cur + 1, hasNext: !!next, onPage: function (n) { goto(n - 1); } }); }
buildForm();
this.update = function (c) {
var lang = self.ctx.lang; self.ctx = c;