feat(report): new cover and layout for the audit report
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a7505f4ff3
commit
1597b2fb63
5 files changed
+288
-52
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
+151
-52
@@ -35,6 +35,9 @@ pub struct ReportOptions {
|
||||
|
||||
const PAGED_MARKER: &str = "<!--SABIA_PAGEDJS-->";
|
||||
const LOGO_PNG: &[u8] = include_bytes!("../../../logo.png");
|
||||
/// 128 px copy of the logo for the running header, so the full-size PNG is
|
||||
/// embedded only once (on the cover).
|
||||
const LOGO_MARK_PNG: &[u8] = include_bytes!("../assets/logo-mark.png");
|
||||
const B64: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
/// Encodes the Sabiá logo as a `data:image/png;base64,...` URI so standalone
|
||||
@@ -340,6 +343,68 @@ fn audit_html(model: &ReportModel) -> String {
|
||||
)
|
||||
}
|
||||
|
||||
/// Security bucket used to colour a network on the cover motif.
|
||||
fn security_tone(security: Option<&str>) -> &'static str {
|
||||
match security.unwrap_or("") {
|
||||
"Open" | "" => "#ef4444",
|
||||
"WEP" => "#f97316",
|
||||
s if s.contains("WPA3") => "#5eead4",
|
||||
s if s.contains("EAP") => "#93c5fd",
|
||||
"WPA" => "#f59e0b",
|
||||
_ => "#fde68a",
|
||||
}
|
||||
}
|
||||
|
||||
/// Cover motif: concentric Wi-Fi arcs radiating from the logo, one dot per
|
||||
/// observed network. Distance from the logo follows the signal (stronger is
|
||||
/// nearer), colour follows the advertised security. Coordinates are in mm on
|
||||
/// the full A4 cover.
|
||||
fn cover_motif(model: &ReportModel) -> String {
|
||||
const CX: f32 = 137.0;
|
||||
const CY: f32 = 151.0;
|
||||
let mut out = String::new();
|
||||
for (i, r) in [72.0f32, 92.0, 112.0, 132.0, 152.0, 172.0]
|
||||
.iter()
|
||||
.enumerate()
|
||||
{
|
||||
let op = 0.30 - i as f32 * 0.04;
|
||||
out.push_str(&format!(
|
||||
"<circle cx=\"{CX}\" cy=\"{CY}\" r=\"{r}\" fill=\"none\" stroke=\"#f59e0b\" stroke-opacity=\"{op:.2}\" stroke-width=\".35\" stroke-dasharray=\"{}\"/>",
|
||||
if i % 2 == 0 { "none" } else { "1.2 2.4" }
|
||||
));
|
||||
}
|
||||
let aps: Vec<&AccessPoint> = model.access_points.iter().take(64).collect();
|
||||
let n = aps.len().max(1) as f32;
|
||||
for (i, ap) in aps.iter().enumerate() {
|
||||
let sig = ap.signal_dbm.unwrap_or(-80) as f32;
|
||||
let dist = 72.0 + (-sig - 35.0).clamp(0.0, 45.0) * 1.2;
|
||||
// Spread over the lower-left arc, away from the title block.
|
||||
let a = (150.0 + 55.0 * (i as f32 + 0.5) / n).to_radians();
|
||||
let x = CX + dist * a.cos();
|
||||
let y = CY + dist * a.sin();
|
||||
let tone = security_tone(ap.security.as_deref());
|
||||
let near_logo = x > 50.0;
|
||||
let label = ap
|
||||
.ssid
|
||||
.as_deref()
|
||||
.filter(|s| !s.is_empty())
|
||||
.unwrap_or("(oculta)");
|
||||
out.push_str(&format!(
|
||||
"<circle cx=\"{x:.1}\" cy=\"{y:.1}\" r=\"3.2\" fill=\"{tone}\" fill-opacity=\".16\"/><circle cx=\"{x:.1}\" cy=\"{y:.1}\" r=\"1.25\" fill=\"{tone}\"/><text x=\"{:.1}\" y=\"{:.1}\" class=\"m-l\"{}>{} · {}</text>",
|
||||
// The strongest networks sit close to the bird: their label goes to the
|
||||
// left of the dot so it never runs under the logo.
|
||||
if near_logo { x - 3.0 } else { x + 3.0 },
|
||||
y + 0.9,
|
||||
if near_logo { " text-anchor=\"end\"" } else { "" },
|
||||
esc(label),
|
||||
ap.signal_dbm.map(|s| format!("{s} dBm")).unwrap_or_else(|| "—".into()),
|
||||
));
|
||||
}
|
||||
format!(
|
||||
"<svg class=\"cover-motif\" viewBox=\"0 0 210 297\" preserveAspectRatio=\"none\" aria-hidden=\"true\">{out}</svg>"
|
||||
)
|
||||
}
|
||||
|
||||
const CSS: &str = r#"
|
||||
:root {
|
||||
--ink: #17211a;
|
||||
@@ -347,7 +412,7 @@ const CSS: &str = r#"
|
||||
--faint: #838f87;
|
||||
--line: #d8dfdb;
|
||||
--soft: #f3f6f3;
|
||||
--accent: #92400e;
|
||||
--accent: #b45309;
|
||||
--accent-soft: #fbe9d9;
|
||||
--deep: #241705;
|
||||
--deep2: #140d02;
|
||||
@@ -359,9 +424,9 @@ const CSS: &str = r#"
|
||||
--warn-soft: #fbe9d9;
|
||||
--info: #0e7490;
|
||||
--info-soft: #d9f0f3;
|
||||
--display: "Source Serif 4", Georgia, serif;
|
||||
--body: "Inter", "Segoe UI", system-ui, sans-serif;
|
||||
--mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
|
||||
--display: "Inter", "Segoe UI", system-ui, Roboto, sans-serif;
|
||||
--body: system-ui, "Inter", "Segoe UI", Roboto, sans-serif;
|
||||
--mono: ui-monospace, "JetBrains Mono", "IBM Plex Mono", monospace;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
html, body { margin: 0; padding: 0; }
|
||||
@@ -374,8 +439,8 @@ body {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.report { background: #fff; }
|
||||
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; }
|
||||
h2 { font-size: 18pt; letter-spacing: -0.01em; margin: 0 0 1mm; color: var(--deep); break-after: avoid; string-set: section content(); }
|
||||
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.15; margin: 0; }
|
||||
h2 { font-size: 18pt; letter-spacing: -0.01em; margin: 0 0 5mm; color: var(--deep); break-after: avoid; string-set: section content(); }
|
||||
h2::before { content: ""; display: block; width: 9mm; height: 1mm; background: var(--accent); margin-bottom: 3mm; border-radius: 1mm; }
|
||||
h3 { font-size: 12.5pt; margin: 0 0 6pt; break-after: avoid; color: var(--deep); }
|
||||
p { margin: 0 0 8pt; }
|
||||
@@ -392,28 +457,38 @@ section.chapter:first-of-type { break-before: avoid; }
|
||||
/* ---------- cover ---------- */
|
||||
.cover {
|
||||
page: cover;
|
||||
height: 297mm; width: 210mm; margin: 0;
|
||||
display: flex; flex-direction: column; justify-content: space-between;
|
||||
padding: 22mm 18mm; break-after: page; position: relative; overflow: hidden;
|
||||
background: radial-gradient(120% 120% at 100% 0%, #3a2409 0%, var(--deep) 45%, var(--deep2) 100%);
|
||||
color: #fff;
|
||||
height: 296mm; width: 210mm; margin: 0; padding: 0;
|
||||
break-after: page; position: relative; overflow: hidden; color: #fff;
|
||||
background:
|
||||
radial-gradient(70% 55% at 65% 51%, rgba(249,115,22,.30) 0%, rgba(249,115,22,.08) 45%, rgba(0,0,0,0) 70%),
|
||||
linear-gradient(160deg, #2a1806 0%, #1a0f04 48%, #0d0702 100%);
|
||||
}
|
||||
.cover .top { display: flex; justify-content: space-between; align-items: flex-start; }
|
||||
.cover .brand { display: flex; align-items: center; gap: 3mm; }
|
||||
.cover .brand img { width: 11mm; height: 11mm; border-radius: 3mm; display: block; }
|
||||
.cover .brand span { font-family: var(--display); font-size: 14pt; font-weight: 700; letter-spacing: -0.01em; }
|
||||
.cover, .cover * { break-inside: avoid; }
|
||||
.cover-motif { position: absolute; inset: 0; width: 210mm; height: 297mm; }
|
||||
.cover-motif .m-l { font: 500 2.1px var(--mono); fill: #e9cfa6; fill-opacity: .7; letter-spacing: .05px; }
|
||||
.cover .hero { position: absolute; left: 72mm; top: 86mm; width: 130mm; height: 130mm; display: block;
|
||||
filter: drop-shadow(0 0 9mm rgba(249,115,22,.35)); }
|
||||
.cover .top { position: absolute; left: 18mm; right: 18mm; top: 16mm; display: flex; justify-content: space-between; align-items: center; }
|
||||
.cover .wordmark { font: 800 11pt var(--body); letter-spacing: .42em; text-transform: uppercase; color: #fff; }
|
||||
.cover .badges { display: flex; align-items: center; gap: 2.5mm; }
|
||||
.cover .badge { font: 700 8pt var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #ffd38a; border: 1px solid #a66a2e; background: rgba(255,211,138,.08); padding: 2.5mm 4mm; border-radius: 1mm; white-space: nowrap; }
|
||||
.cover .badge { font: 700 7.5pt var(--mono); letter-spacing: .16em; text-transform: uppercase; color: #e9cfa6; border: 1px solid rgba(233,207,166,.45); padding: 1.8mm 3.2mm; border-radius: 1mm; white-space: nowrap; }
|
||||
/* FIRST.org TLP 2.0 brand color (amber), matching the sharing-classification badge the Ciberfauna report convention requires. */
|
||||
.cover .badge-tlp { color: #FFC000; border-color: #FFC000; background: rgba(255,192,0,.08); }
|
||||
.cover .mid { margin-top: auto; }
|
||||
.cover .eyebrow { color: #ffb963; margin-bottom: 4mm; }
|
||||
.cover h1 { font-size: 40pt; letter-spacing: -0.02em; max-width: 150mm; color: #fff; margin-bottom: 6mm; }
|
||||
.cover .lead { max-width: 125mm; font-size: 12.5pt; color: #e7d9c4; line-height: 1.6; }
|
||||
.cover .meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6mm; margin-top: 16mm; padding-top: 6mm; border-top: 1px solid rgba(255,255,255,.18); }
|
||||
.cover .meta dt { font: 500 7.5pt var(--mono); text-transform: uppercase; letter-spacing: .12em; color: #c9b599; margin-bottom: 1.5mm; }
|
||||
.cover .meta dd { margin: 0; font-size: 10.5pt; color: #fff; }
|
||||
.cover .foot { font-size: 8.3pt; color: #c9b599; margin-top: 10mm; max-width: 150mm; }
|
||||
.cover .badge-tlp { color: #FFC000; border-color: #FFC000; background: rgba(255,192,0,.07); }
|
||||
.cover .head { position: absolute; left: 18mm; top: 40mm; width: 128mm; }
|
||||
.cover .eyebrow { font: 600 8pt var(--mono); letter-spacing: .22em; color: #fb923c; margin: 0 0 5mm; }
|
||||
.cover h1 { font: 800 38pt/1.02 var(--body); letter-spacing: -0.025em; color: #fff; margin: 0 0 5mm; }
|
||||
.cover .lead { font-size: 11pt; color: #e7d3b6; line-height: 1.55; max-width: 108mm; margin: 0; }
|
||||
.cover .strip { position: absolute; left: 18mm; top: 224mm; display: flex; gap: 9mm; }
|
||||
.cover .strip div { border-top: .8mm solid #f59e0b; padding-top: 2mm; min-width: 22mm; }
|
||||
.cover .strip div.hot { border-top-color: #ef4444; }
|
||||
.cover .strip strong { display: block; font: 800 22pt/1 var(--body); color: #fff; letter-spacing: -0.02em; }
|
||||
.cover .strip span { font: 500 6.8pt var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #c9ad86; }
|
||||
.cover .meta { position: absolute; left: 18mm; right: 18mm; top: 244mm; display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 6mm; margin: 0; padding-top: 4.5mm; border-top: 1px solid rgba(251,146,60,.35); }
|
||||
.cover .meta dt { font: 500 7pt var(--mono); text-transform: uppercase; letter-spacing: .16em; color: #c9ad86; margin-bottom: 1.2mm; }
|
||||
.cover .meta dd { margin: 0; font-size: 9.5pt; color: #fff; white-space: nowrap; }
|
||||
/* Paged.js measures overflow against the default page's bottom margin even on the
|
||||
margin-less cover: anything below ~275mm spills onto a second sheet. */
|
||||
.cover .foot { position: absolute; left: 18mm; right: 18mm; top: 263mm; font-size: 6.8pt; color: #9c8466; margin: 0; }
|
||||
|
||||
/* ---------- table of contents ---------- */
|
||||
.toc { break-after: page; }
|
||||
@@ -456,7 +531,7 @@ tbody tr { break-inside: avoid; }
|
||||
tbody tr:nth-child(even) td { background: #f7f9f7; }
|
||||
.band { margin: 0 0 7mm; break-inside: avoid; }
|
||||
.band header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3mm; }
|
||||
.chan-row { display: grid; grid-template-columns: 11mm 1fr 12mm 30mm; gap: 2mm; align-items: center; font-size: 8.6pt; padding: 1mm 0; }
|
||||
.chan-row { display: grid; grid-template-columns: 19mm 1fr 12mm 30mm; gap: 2mm; align-items: center; font-size: 8.6pt; padding: 1mm 0; }
|
||||
.chan-n { font-weight: 600; }
|
||||
.chan-bar { height: 3.2mm; background: #eef2ef; border-radius: 999px; overflow: hidden; }
|
||||
.chan-bar i { display: block; height: 100%; background: #b8c8bf; border-radius: 999px; }
|
||||
@@ -485,14 +560,16 @@ tbody tr:nth-child(even) td { background: #f7f9f7; }
|
||||
size: A4;
|
||||
margin: 24mm 16mm 20mm 16mm;
|
||||
background: #fff;
|
||||
@top-left { content: "SABIÁ · AUDITORIA WI-FI"; font: 600 7.5pt var(--mono); letter-spacing: .1em; color: var(--faint); vertical-align: bottom; padding-bottom: 4mm; }
|
||||
@top-center { content: string(section); font: 500 7.5pt var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); vertical-align: bottom; padding-bottom: 4mm; text-align: center; }
|
||||
@top-left { content: __HEADER_LOGO__; vertical-align: bottom; padding-bottom: 3mm; width: 30%; }
|
||||
@top-center { content: "SABIÁ · " string(section); width: 40%; white-space: nowrap; font: 500 7.5pt var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); vertical-align: bottom; padding-bottom: 4mm; text-align: center; }
|
||||
@top-right { content: "TLP:AMBER \25CF USO AUTORIZADO"; font: 700 7.5pt var(--mono); letter-spacing: .1em; color: var(--accent); vertical-align: bottom; padding-bottom: 4mm; text-align: right; white-space: nowrap; }
|
||||
@bottom-left { content: string(footline); font: 400 7.5pt var(--mono); color: var(--faint); vertical-align: top; padding-top: 4mm; }
|
||||
@bottom-right { content: counter(page) " / " counter(pages); font: 700 8pt var(--mono); color: var(--ink); vertical-align: top; padding-top: 4mm; text-align: right; }
|
||||
}
|
||||
@page cover {
|
||||
size: A4;
|
||||
margin: 0;
|
||||
background: #0d0702;
|
||||
@top-left { content: none; } @top-center { content: none; } @top-right { content: none; }
|
||||
@bottom-left { content: none; } @bottom-right { content: none; }
|
||||
}
|
||||
@@ -528,6 +605,16 @@ pub fn render(model: &ReportModel, options: ReportOptions) -> String {
|
||||
model.title.clone()
|
||||
};
|
||||
let logo_data_uri = format!("data:image/png;base64,{}", base64(LOGO_PNG));
|
||||
// Margin boxes draw `content: url()` at intrinsic size; an SVG wrapper with
|
||||
// explicit dimensions lets the running header pick its own height.
|
||||
let mark_data_uri = format!("data:image/png;base64,{}", base64(LOGO_MARK_PNG));
|
||||
let header_svg = format!(
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"30\" height=\"30\" viewBox=\"0 0 30 30\"><image width=\"30\" height=\"30\" xlink:href=\"{mark_data_uri}\"/></svg>"
|
||||
);
|
||||
let header_logo = format!(
|
||||
"url(\"data:image/svg+xml;base64,{}\")",
|
||||
base64(header_svg.as_bytes())
|
||||
);
|
||||
let footline = format!("Uso autorizado · gerado em {date}");
|
||||
let overall = if critical > 0 {
|
||||
"bad"
|
||||
@@ -544,30 +631,37 @@ pub fn render(model: &ReportModel, options: ReportOptions) -> String {
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{title}</title>
|
||||
<style>{css}</style>
|
||||
<script>window.PagedConfig = {{ auto: false }};</script>
|
||||
{paged}
|
||||
</head>
|
||||
<body>
|
||||
<div class="doc-meta" data-footline="{footline}"></div>
|
||||
<main class="report">
|
||||
<section class="cover">
|
||||
<div class="doc-meta" data-footline="{footline}"></div>
|
||||
{motif}
|
||||
<img class="hero" src="{logo}" alt="Sabiá">
|
||||
<div class="top">
|
||||
<div class="brand"><img src="{logo}" alt=""><span>Sabiá</span></div>
|
||||
<span class="wordmark">Sabiá</span>
|
||||
<div class="badges"><span class="badge badge-tlp">TLP:AMBER</span><span class="badge">Uso autorizado</span></div>
|
||||
</div>
|
||||
<div class="mid">
|
||||
<p class="eyebrow">Relatório de auditoria · redes sem fio</p>
|
||||
<div class="head">
|
||||
<p class="eyebrow">CIBERFAUNA · AUDITORIA DE REDES WI-FI</p>
|
||||
<h1>{title}</h1>
|
||||
<p class="lead">Achados de configuração, canais, clientes, handshakes e trilha de auditoria da captura, com verificação criptográfica — nenhuma senha é inventada.</p>
|
||||
<p class="lead">Achados de configuração, canais, clientes, handshakes e trilha de auditoria da captura, com verificação criptográfica. Nenhuma senha é inventada.</p>
|
||||
</div>
|
||||
<div>
|
||||
<dl class="meta">
|
||||
<div><dt>Interface</dt><dd class="mono">{iface}</dd></div>
|
||||
<div><dt>Gerado em</dt><dd>{date}</dd></div>
|
||||
<div><dt>Versão do Sabiá</dt><dd>{version}</dd></div>
|
||||
<div><dt>Captura</dt><dd>{capture_state}</dd></div>
|
||||
</dl>
|
||||
<p class="foot">Documento gerado localmente. Use somente em redes próprias ou com autorização explícita do responsável. Cada ação ativa fica registrada na trilha de auditoria encadeada por hash (seção final).</p>
|
||||
<div class="strip">
|
||||
<div><strong>{n_aps}</strong><span>redes</span></div>
|
||||
<div><strong>{n_clients}</strong><span>clientes</span></div>
|
||||
<div><strong>{n_hs}</strong><span>handshakes</span></div>
|
||||
<div class="{crit_cls}"><strong>{critical}</strong><span>achados críticos</span></div>
|
||||
</div>
|
||||
<dl class="meta">
|
||||
<div><dt>Emissão</dt><dd>{date}</dd></div>
|
||||
<div><dt>Interface · captura</dt><dd><span class="mono">{iface}</span> · {capture_state}</dd></div>
|
||||
<div><dt>Achados</dt><dd>{critical} críticos · {warnings} atenção</dd></div>
|
||||
<div><dt>Classificação</dt><dd>TLP:AMBER</dd></div>
|
||||
</dl>
|
||||
<p class="foot">Sabiá {version}. Documento gerado localmente. Use somente em redes próprias ou com autorização explícita do responsável. Cada ação ativa fica registrada na trilha de auditoria encadeada por hash (seção final).</p>
|
||||
</section>
|
||||
|
||||
<section class="toc">
|
||||
@@ -585,7 +679,7 @@ pub fn render(model: &ReportModel, options: ReportOptions) -> String {
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section class="chapter" id="sec-exec">
|
||||
<section class="chapter chapter-open" id="sec-exec">
|
||||
<h2>Sumário executivo</h2>
|
||||
<div class="stats">
|
||||
{stat_aps}{stat_clients}{stat_hs}{stat_crackable}
|
||||
@@ -596,46 +690,46 @@ pub fn render(model: &ReportModel, options: ReportOptions) -> String {
|
||||
<p class="muted">Captura em {iface}, com {frames} quadros processados, {eapol} EAPOL e {deauth} quadros de desautenticação/desassociação. Os dados refletem apenas o que foi visto no ar durante a sessão; não há varredura ativa além das ações listadas na auditoria.</p>
|
||||
</section>
|
||||
|
||||
<section class="chapter" id="sec-findings">
|
||||
<section class="chapter chapter-open" id="sec-findings">
|
||||
<h2>Achados</h2>
|
||||
{findings}
|
||||
</section>
|
||||
|
||||
<section class="chapter" id="sec-channels">
|
||||
<section class="chapter chapter-open" id="sec-channels">
|
||||
<h2>Canais e interferência</h2>
|
||||
<p class="desc">Pontuação menor é melhor. O cálculo pondera sobreposição espectral e intensidade de cada AP; em 2,4 GHz a recomendação fica restrita a 1, 6 e 11.</p>
|
||||
{channels}
|
||||
</section>
|
||||
|
||||
<section class="chapter" id="sec-aps">
|
||||
<section class="chapter chapter-open" id="sec-aps">
|
||||
<h2>Redes observadas</h2>
|
||||
{aps}
|
||||
</section>
|
||||
|
||||
<section class="chapter" id="sec-clients">
|
||||
<section class="chapter chapter-open" id="sec-clients">
|
||||
<h2>Clientes</h2>
|
||||
<p class="desc">Exibindo até 120 estações ordenadas por volume de quadros.</p>
|
||||
{clients}
|
||||
</section>
|
||||
|
||||
<section class="chapter" id="sec-hs">
|
||||
<section class="chapter chapter-open" id="sec-hs">
|
||||
<h2>Handshakes e PMKID</h2>
|
||||
{handshakes}
|
||||
<p class="muted">Handshakes com senha encontrada aparecem com o valor em texto; os demais podem ser exportados em .pcap ou .hc22000 na interface.</p>
|
||||
</section>
|
||||
|
||||
<section class="chapter" id="sec-wpa3">
|
||||
<section class="chapter chapter-open" id="sec-wpa3">
|
||||
<h2>WPA3 e PMF</h2>
|
||||
{wpa3}
|
||||
</section>
|
||||
|
||||
<section class="chapter" id="sec-audit">
|
||||
<section class="chapter chapter-open" id="sec-audit">
|
||||
<h2>Trilha de auditoria</h2>
|
||||
<p class="desc">Últimas 60 entradas, com hash encadeado. A verificação completa fica disponível na interface.</p>
|
||||
{audit}
|
||||
</section>
|
||||
|
||||
<section class="chapter" id="sec-method">
|
||||
<section class="chapter chapter-open" id="sec-method">
|
||||
<h2>Metodologia e limites</h2>
|
||||
<p>O Sabiá opera em modo monitor, agrega beacons, respostas de probe, associação e EAPOL, e só injeta quadros quando uma ação é confirmada na interface. A análise de canais é uma estimativa de sobreposição, não uma medição de espectro por SDR. A detecção de evil twin é heurística: nomes iguais com seguranças diferentes e rajadas de gerenciamento merecem verificação manual.</p>
|
||||
<p>O teste de PMF observa reassociação após desautenticação; um resultado inconclusivo não prova que o PMF está ativo. O ataque WPS depende de reaver/bully instalados e de o AP aceitar PIN. Nenhuma senha é inventada: handshakes só aparecem como quebrados quando a verificação criptográfica local confirma a candidata.</p>
|
||||
@@ -662,7 +756,12 @@ pub fn render(model: &ReportModel, options: ReportOptions) -> String {
|
||||
</body>
|
||||
</html>"##,
|
||||
title = esc(&title),
|
||||
css = CSS,
|
||||
css = CSS.replace("__HEADER_LOGO__", &header_logo),
|
||||
motif = cover_motif(model),
|
||||
n_aps = stats.aps,
|
||||
n_clients = stats.clients,
|
||||
n_hs = stats.handshakes,
|
||||
crit_cls = if critical > 0 { "hot" } else { "" },
|
||||
paged = paged,
|
||||
logo = logo_data_uri,
|
||||
footline = esc(&footline),
|
||||
@@ -719,7 +818,7 @@ fn summary_html(model: &ReportModel) -> String {
|
||||
.count();
|
||||
let mut parts = Vec::new();
|
||||
parts.push(format!(
|
||||
"Foram observadas {} redes e {} estações.",
|
||||
"Foram observadas {} redes e {} estações",
|
||||
model.stats.aps, model.stats.clients
|
||||
));
|
||||
if open > 0 {
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
//! Renders the audit report from a realistic synthetic capture (7 networks,
|
||||
//! 9 clients, 1 handshake). Set `SABIA_REPORT_OUT=<file.html>` to save the
|
||||
//! HTML for visual inspection (e.g. `verificar-paginacao.mjs`).
|
||||
|
||||
mod common;
|
||||
|
||||
use sabia_core::analysis::analyze;
|
||||
use sabia_core::audit::AuditEntry;
|
||||
use sabia_core::report::{render, ReportModel, ReportOptions};
|
||||
use sabia_core::scan::ScanTable;
|
||||
|
||||
const NETS: &[(&str, u8, &str, i8)] = &[
|
||||
("Ciberfauna-Lab", 6, "WPA2", -38),
|
||||
("Cafe-Livre", 1, "Open", -52),
|
||||
("Vizinho-Antigo", 11, "WEP", -71),
|
||||
("Ciberfauna-6E", 36, "WPA3", -47),
|
||||
("Corp-Radius", 44, "WPA2-EAP", -63),
|
||||
("", 6, "WPA2", -79),
|
||||
("IoT-Casa", 1, "WPA2", -58),
|
||||
];
|
||||
|
||||
fn synthetic_model() -> ReportModel {
|
||||
let mut table = ScanTable::new();
|
||||
for (i, (ssid, ch, _, sig)) in NETS.iter().enumerate() {
|
||||
let mut mac = common::ap();
|
||||
mac[5] = mac[5].wrapping_add(i as u8 + 1);
|
||||
let freq = if *ch > 14 {
|
||||
5000 + 5 * *ch as u16
|
||||
} else {
|
||||
2407 + 5 * *ch as u16
|
||||
};
|
||||
let b = common::beacon_frame(mac, ssid, *ch, &[2]);
|
||||
table.ingest(&common::radiotap_wrap(&b, freq, *sig));
|
||||
}
|
||||
let probes = [
|
||||
"Ciberfauna-Lab",
|
||||
"Cafe-Livre",
|
||||
"Aeroporto-WiFi",
|
||||
"IoT-Casa",
|
||||
"Hotel-Guest",
|
||||
"Corp-Radius",
|
||||
"Ciberfauna-Lab",
|
||||
"Casa-Mae",
|
||||
"Cafe-Livre",
|
||||
];
|
||||
for (i, p) in probes.iter().enumerate() {
|
||||
let mut mac = common::sta();
|
||||
mac[5] = mac[5].wrapping_add(i as u8 + 1);
|
||||
let pr = common::probe_request(mac, p);
|
||||
table.ingest(&common::radiotap_wrap(&pr, 2437, -45 - 4 * i as i8));
|
||||
}
|
||||
let (f1, f2) = common::handshake_radiotap_frames("Ciberfauna-Lab", "senha-correta", 2, false);
|
||||
table.ingest_at(&f1, 10);
|
||||
table.ingest_at(&f2, 11);
|
||||
|
||||
let mut aps = table.access_points();
|
||||
aps.retain(|a| a.bssid != sabia_core::dot11::mac_to_string(&common::ap()));
|
||||
for ap in aps.iter_mut() {
|
||||
if let Some((_, _, sec, sig)) = NETS
|
||||
.iter()
|
||||
.find(|n| ap.ssid.as_deref().unwrap_or("") == n.0)
|
||||
{
|
||||
ap.security = Some(sec.to_string());
|
||||
ap.signal_dbm = Some(*sig);
|
||||
ap.cipher = Some(
|
||||
match *sec {
|
||||
"Open" => "—",
|
||||
"WEP" => "WEP-104",
|
||||
_ => "CCMP",
|
||||
}
|
||||
.into(),
|
||||
);
|
||||
ap.pmf = *sec == "WPA3";
|
||||
ap.pmf_required = *sec == "WPA3";
|
||||
ap.wps = ap.ssid.as_deref() == Some("IoT-Casa");
|
||||
}
|
||||
}
|
||||
let mut clients = table.clients();
|
||||
for (i, c) in clients.iter_mut().enumerate() {
|
||||
c.packets = 900 - 80 * i as u64;
|
||||
c.vendor = Some(["Apple", "Samsung", "Intel", "Espressif", "Xiaomi"][i % 5].into());
|
||||
}
|
||||
let mut handshakes = table.handshakes();
|
||||
handshakes.truncate(1);
|
||||
let now = 1_793_700_000;
|
||||
let analysis = analyze(&aps, 14, now);
|
||||
let mut stats = table.stats();
|
||||
stats.aps = aps.len();
|
||||
stats.frames = 48_213;
|
||||
stats.deauth_frames = 14;
|
||||
let audit = (0..6)
|
||||
.map(|i| AuditEntry {
|
||||
timestamp: format!("2026-11-03T14:{:02}:10Z", 10 + i * 3),
|
||||
action: [
|
||||
"scan.start",
|
||||
"channel.hop",
|
||||
"deauth",
|
||||
"handshake.capture",
|
||||
"crack.verify",
|
||||
"report.export",
|
||||
][i]
|
||||
.into(),
|
||||
target: "Ciberfauna-Lab".into(),
|
||||
detail: "ação confirmada na interface pelo operador".into(),
|
||||
prev_hash: "0".repeat(64),
|
||||
hash: format!("{:064x}", 0x9a3f_11c2_u64 * (i as u64 + 7)),
|
||||
})
|
||||
.collect();
|
||||
ReportModel {
|
||||
title: "Auditoria Wi-Fi do laboratório".into(),
|
||||
version: "1.0.7".into(),
|
||||
iface: "wlan0mon".into(),
|
||||
running: false,
|
||||
generated_unix: now,
|
||||
stats,
|
||||
access_points: aps,
|
||||
clients,
|
||||
handshakes,
|
||||
analysis,
|
||||
audit,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn renders_synthetic_capture_report() {
|
||||
let model = synthetic_model();
|
||||
assert_eq!(model.access_points.len(), 7);
|
||||
let html = render(&model, ReportOptions::default());
|
||||
assert!(html.contains("Ciberfauna-Lab"));
|
||||
assert!(html.contains("TLP:AMBER"));
|
||||
assert!(html.contains("class=\"cover-motif\""));
|
||||
if let Ok(out) = std::env::var("SABIA_REPORT_OUT") {
|
||||
std::fs::write(out, html).unwrap();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user