Files
sabia/docs/architecture.md
T
Lucas RayanandClaude Opus 5.5 791538c9d9 v0.1.0: logo, i18n pt/en, CI com caches, testes e documentação
- Logo oficial (sabia.png) e conjunto de ícones do app desktop.
- Interface em português e inglês: tradutor por observação do DOM, seletor
  de idioma e checagem de cobertura de tradução no CI.
- CI/CD com caches (rust-cache, .deb do Tauri em cache) e pipeline de release
  multiplataforma (CLI em 5 alvos + app desktop via tauri-action), templates
  de issue/PR.
- Suíte de testes de integração do sabia-core (scan e2e, handshake/crack
  4-way e PMKID, pcap, trilha de auditoria) — 46 testes verdes.
- Documentação completa pt/en: README, ROADMAP, SECURITY, CONTRIBUTING,
  CHANGELOG e docs/ (cli, interface, arquitetura), com enquadramento de uso
  autorizado.
- Correções de clippy (-D warnings) e formatação em toda a árvore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:46:19 -03:00

41 lines
2.0 KiB
Markdown

# Architecture
**English** · [Português](pt-BR/arquitetura.md)
Two crates and one app:
```
crates/sabia-core all the logic (library)
crates/sabia-cli the `sabia` binary (CLI + local UI server)
apps/gui interface (ui/ = HTML/CSS/JS; src-tauri/ = desktop app)
```
The CLI and the desktop app are thin clients: both call the core's `Engine`. The browser UI (`sabia ui`) and the Tauri one load the same `apps/gui/ui/`.
## `sabia-core`
| Module | Role |
|---|---|
| `engine.rs` | Orchestrates everything and exposes the API the CLI and GUI consume. |
| `iface.rs`, `netlink.rs` | Discovers interfaces and channels; toggles monitor mode via netlink/`iw`. |
| `radiotap.rs` | Radiotap header parsing; band and channel. |
| `dot11.rs` | 802.11 frame parsing (management: beacon, probe). |
| `eapol.rs` | EAPOL and 4-way handshake field parsing. |
| `handshake.rs` | Assembles the handshake (ANonce, SNonce, MIC, PMKID) from frames. |
| `crack.rs` | Derives PMK (PBKDF2-HMAC-SHA1) and PTK, checks MIC and PMKID. |
| `scan.rs` | Hops channels and aggregates APs and clients seen. |
| `capture.rs`, `inject.rs` | Raw AF_PACKET capture; frame injection (deauth). |
| `pcapreader.rs`, `pcapwriter.rs` | `.pcap` read and write. |
| `audit.rs` | Local hash-chained audit trail. |
| `doctor.rs` | Diagnostics of privileges, tools and interfaces. |
| `update.rs` | Self-update from GitHub releases (curl + SHA-256). |
| `error.rs`, `testutil.rs` | Shared error type; test helpers. |
## Platform
Capture and monitor mode are **Linux** (`AF_PACKET` + netlink). Parsing (`radiotap`, `dot11`, `eapol`, `handshake`), cracking (`crack`) and `.pcap` are cross-platform, being offline — which is why the tests run on Linux, Windows and macOS in CI.
## UI transport
`sabia ui` starts a server on `127.0.0.1` protected by a token generated on the spot; it serves `index.html`/`app.css`/`app.js`/`sabia.png` embedded in the binary plus a JSON API. The Tauri app uses the same files, calling the `Engine` directly via Tauri commands instead of HTTP.