CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 27s
CI / Dependency audit (push) Successful in 18s
CI / Tests (Linux, race detector) (push) Successful in 58s
Release / Plan (reuse the published image?) (push) Successful in 4s
Release / ci (push) Skipped
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Successful in 13s
Release / Gitea release (push) Successful in 5s
Intelligence: attack families mapped to MITRE ATT&CK, network type from
ASN/rDNS without external APIs, request cadence, sessions with
recon/probe/exploit/access/banned stages, campaigns across IPs, verdict
with reasons, recommended actions, exposure detection (2xx with a body
on sensitive paths), STIX 2.1 export, FCrDNS for search engine bots,
optional Tor exit list.
Data: 30-day retention, twelve ranges plus custom from/to, an on-disk
event log (daily files, hourly gzip members, size cap, corruption and
disk-full tolerant), /events, /period, /metrics with stable per-hour
metrics, an extended /ip/{ip}, and peer /period merged on the hub.
Interface: layout system with fixed card sizes, range picker in the
URL, IP analysis page, Replay page, Geography down to state and city
(Natural Earth admin-1), Live page redesigned with stable metrics and a
reusable attack map. Demo data and documentation screenshots.
Security: bounded and deadline-limited period computations, linear
campaign clustering, singleflight caches, sanitized peer studies, event
query budgets, gzip bomb guard.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
94 lines
5.3 KiB
JavaScript
94 lines
5.3 KiB
JavaScript
// Captures the Urutau dashboard for docs/img.
|
|
// Usage (called by scripts/screenshots.sh): node shots.mjs <hub-url> <login-url> <out-dir>
|
|
//
|
|
// Desktop 1440x900 in the dark theme (English, plus Portuguese for the pages the
|
|
// pt-BR docs show), a few pages in the light theme, and a few at 390x844 (phone).
|
|
// File names: <page>-dark.png, <page>-dark-pt.png, <page>-light.png, <page>-mobile.png.
|
|
import { execFileSync } from "node:child_process";
|
|
import { homedir } from "node:os";
|
|
|
|
const [hub, login, out] = process.argv.slice(2);
|
|
const core = process.env.PUPPETEER_CORE || `${homedir()}/.claude/tools/node_modules/puppeteer-core/lib/esm/puppeteer/puppeteer-core.js`;
|
|
const { default: puppeteer } = await import(core);
|
|
const chrome = process.env.CHROME || execFileSync("bash", ["-c", `ls -1d "$HOME"/.cache/puppeteer/chrome/*/chrome-linux64/chrome | sort -V | tail -1`], { encoding: "utf8" }).trim();
|
|
|
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
const DESKTOP = { width: 1440, height: 900, deviceScaleFactor: 1 };
|
|
const PHONE = { width: 390, height: 844, deviceScaleFactor: 2, isMobile: true, hasTouch: true };
|
|
const ATTACKER = "203.0.113.45"; // the multi-vector attacker of the demo data
|
|
|
|
// pages: id (file name), hash, settle time, optional prepare(page)
|
|
const pages = [
|
|
{ id: "overview", hash: "#/overview?r=7d", wait: 3500 },
|
|
{ id: "threats", hash: "#/threats?r=24h", wait: 3500 },
|
|
{ id: "geo-world", hash: "#/geo?r=30d", wait: 3500 },
|
|
{ id: "geo-brazil", hash: "#/geo/BR?r=30d", wait: 3500 },
|
|
{ id: "geo-pernambuco", hash: "#/geo/BR/Pernambuco?r=30d", wait: 3500 },
|
|
{ id: "live-flat", hash: "#/live?r=24h", wait: 14000, prepare: (p) => liveMode(p, "flat") },
|
|
{ id: "live-globe", hash: "#/live?r=24h", wait: 14000, prepare: (p) => liveMode(p, "globe") },
|
|
{ id: "traffic", hash: "#/traffic?r=30d", wait: 3500 },
|
|
{ id: "ips", hash: "#/ips?r=7d", wait: 3500 },
|
|
{ id: "ip-analysis", hash: `#/ip/${ATTACKER}?r=7d`, wait: 4500 },
|
|
// starts in the middle of the escalation of the demo attacker (about 25 h ago) and plays on
|
|
{ id: "replay", hash: () => `#/replay?r=2d&speed=300&t=${encodeURIComponent(new Date(Date.now() - (25 * 60 + 50) * 60e3).toISOString())}`, wait: 3500 },
|
|
{ id: "sources", hash: "#/sources?r=24h", wait: 3500 },
|
|
];
|
|
const darkEN = pages.map((p) => p.id);
|
|
const darkPT = ["overview", "threats", "geo-world", "live-globe", "traffic", "ips", "ip-analysis", "replay", "sources"];
|
|
const light = ["overview", "geo-world", "live-flat", "ip-analysis"];
|
|
const mobile = ["overview", "threats", "live-flat", "ips"];
|
|
|
|
async function liveMode(page, mode) {
|
|
try { await page.evaluate((m) => localStorage.setItem("urutau.live.mode", m), mode); } catch {}
|
|
}
|
|
|
|
async function replayPlay(page) {
|
|
// press play, let the replay run for a while so the map shows arcs and the list is mid-way
|
|
const btn = await page.evaluateHandle(() => [...document.querySelectorAll("button")].find((b) => /play|reproduzir/i.test((b.getAttribute("aria-label") || "") + " " + (b.title || "") + " " + b.textContent)));
|
|
if (btn && btn.asElement()) await btn.asElement().click();
|
|
await sleep(9000);
|
|
}
|
|
|
|
const browser = await puppeteer.launch({ executablePath: chrome, args: ["--no-sandbox", "--use-gl=angle", "--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--ignore-gpu-blocklist"], defaultViewport: DESKTOP });
|
|
|
|
async function shoot(p, { theme, lang, viewport, suffix }) {
|
|
const page = await browser.newPage();
|
|
await page.setViewport(viewport);
|
|
await page.evaluateOnNewDocument((th, lg) => {
|
|
try { localStorage.setItem("urutau.theme", th); localStorage.setItem("urutau.lang", lg); localStorage.setItem("urutau.range", "24h"); localStorage.setItem("urutau.host", "all"); } catch {}
|
|
}, theme, lang);
|
|
await page.goto(hub + "/", { waitUntil: "domcontentloaded" });
|
|
if (p.prepare) await p.prepare(page);
|
|
const hash = typeof p.hash === "function" ? p.hash() : p.hash;
|
|
await page.goto(hub + "/" + hash, { waitUntil: "domcontentloaded" });
|
|
await page.evaluate((h) => { location.hash = h; }, hash);
|
|
await sleep(p.wait);
|
|
if (p.id === "replay") await replayPlay(page);
|
|
const name = `${p.id}-${suffix}`;
|
|
await page.screenshot({ path: `${out}/${name}.png` });
|
|
console.log("ok", name);
|
|
await page.close();
|
|
}
|
|
|
|
try {
|
|
for (const p of pages) {
|
|
if (darkEN.includes(p.id)) await shoot(p, { theme: "dark", lang: "en", viewport: DESKTOP, suffix: "dark" });
|
|
if (darkPT.includes(p.id)) await shoot(p, { theme: "dark", lang: "pt-BR", viewport: DESKTOP, suffix: "dark-pt" });
|
|
if (light.includes(p.id)) await shoot(p, { theme: "light", lang: "en", viewport: DESKTOP, suffix: "light" });
|
|
if (mobile.includes(p.id)) await shoot(p, { theme: "dark", lang: "en", viewport: PHONE, suffix: "mobile" });
|
|
}
|
|
// login (a separate instance with authentication on)
|
|
for (const [lang, suffix, theme] of [["en", "dark", "dark"], ["pt-BR", "dark-pt", "dark"], ["en", "light", "light"]]) {
|
|
const page = await browser.newPage();
|
|
await page.setViewport(DESKTOP);
|
|
await page.evaluateOnNewDocument((th, lg) => { try { localStorage.setItem("urutau.theme", th); localStorage.setItem("urutau.lang", lg); } catch {} }, theme, lang);
|
|
await page.goto(login + "/login", { waitUntil: "domcontentloaded" });
|
|
await sleep(1500);
|
|
await page.screenshot({ path: `${out}/login-${suffix}.png` });
|
|
console.log("ok", `login-${suffix}`);
|
|
await page.close();
|
|
}
|
|
} finally {
|
|
await browser.close();
|
|
}
|