# wifi_lab A WPA/WPA2 lab tool for Linux: scan the air, capture a 4-way handshake or PMKID, crack it on the GPU. Single Rust binary, GPUI interface. Everything in the screenshots below is the built-in mock backend (`--mock`) — fabricated networks, fabricated captures, nothing from a real radio. ## Screenshots ![Networks page](screenshots/networks.png) The scan view: APs with vendor (IEEE OUI), security, and a signal history; clients below; probe requests at the bottom. The `#1~ (2)` in the client ID column is one physical phone seen under two randomized MACs, paired by IE fingerprint. ![Attacks page](screenshots/attacks.png) The target card answers "which button do I press": handshake capture with live M1–M4 progress, targeted/broadcast deauth, clientless PMKID. WPA3 SAE-only targets are dead ends and the buttons say so instead of failing silently. ![Cracker page](screenshots/cracker.png) Cracking is a plain UI-process job — no root, no radio, runs while a capture is in flight. Wordlist, hashcat-style rules, hybrid, bruteforce with frequency ordering, and SSID-bound PMK rainbow tables. Live H/s, exact worst-case ETA, resume after a crash. ![Log page](screenshots/log.png) ## What it does - **Scan** — monitor-mode channel hopper feeding an AP table (OUI vendor, WPA2/WPA3-transition/OWE security, sortable `FLAGS` risk column, per-channel activity timeline in fixed-height side-by-side columns, signal sparklines), a client station list, and a probe request feed. Hidden SSIDs get correlated from association requests. - **Device correlation** — pairs the randomized MACs of one physical device into one ID using ordered-IE fingerprints plus sequence number / probed-SSID / WPS UUID witnesses. - **Situational alerts** — open/WEP flags, hidden SSIDs, rogue-AP suspicion (same SSID, different BSSID and security), and foreign deauth-storm detection. - **Attacks** — parked-channel handshake capture, deauth (targeted or broadcast), clientless PMKID. Ending a capture also yields *partial* M2+M3 material when a full M1+M2 pair never completed — labeled `[partial]` and crackable like a complete capture. Everything the tool sends is visible in the log. - **Cracker** — GPU (wgpu/Vulkan) with on-device MIC verification (HMAC-SHA1 / key_ver 2 handshakes; WPA1-TKIP and AES-CMAC targets run on CPU), CPU fallback. Per-SSID PMK cache and precomputed rainbow tables skip PBKDF2 entirely on repeat runs. - **Interchange** — exports hashcat `hc22000` (trailing message-pair field `*00` complete / `*02` partial) and pcap (radiotap spool for Wireshark); imports `.cap`/`.pcap`/`.hc22000` captures made elsewhere. - **Persistence** — captures, per-device labels, crack presets, and resume-after-crash sessions survive restarts (`~/wifi_lab/`). All writes are crash-safe (tmp file + fsync + rename + directory fsync); when `HOME` is unset the store falls back to `temp_dir()/wifi_lab` with a logged warning. An old `~/wifilab` directory is migrated in place. ## How it's put together The UI never needs root. Clicking **Start capture** respawns the same binary as a `pkexec`-elevated worker process (`--privileged-worker`, polkit asks once per session). All radio work — monitor mode, channel hopping, deauth/assoc TX, frame capture — happens in that worker; the two halves exchange JSON lines on stdio. The GPU cracker needs no privilege and runs as a thread in the UI process. On exit the worker stops the radio workers, restores managed mode, and restarts NetworkManager if it stopped it. ## Build and run ```sh cargo build --release ./target/release/wifi_lab ``` - `--iface wlp144s0` picks the wireless interface (default: first detected). - `--mock` (or `WIFI_LAB_MOCK=1`) runs the UI against fabricated events — no device access, no root. This is what development, CI screenshots and the images above use. - A found password raises a desktop notification in addition to the in-app banner. - Keyboard: **Ctrl-Q** quits; **Ctrl-1..4** switch the Networks / Attacks / Cracker / Log pages. CI runs on GitHub Actions (`.github/workflows/ci.yml`): fmt, clippy with `-D warnings`, tests, release build, plus an xvfb-driven `--mock`-mode smoke run on every push and PR against `main`. Headless cracking (no UI, no radio, no root): ```sh wifi_lab crack --capture capture.hc22000 --wordlist rockyou.txt wifi_lab crack --capture capture.hc22000 --mode rules --rules best64.rule \ --wordlist rockyou.txt --cpu ``` Modes: `wordlist` (default), `rules`, `bruteforce` (`--min/--max`, charset chips), plus `--hybrid`. Exit codes: `0` password found (`FOUND: …` on stdout), `1` keyspace exhausted, `2` usage/IO error. ## Hardware and platform notes - Linux only. Needs a Wi-Fi card that supports monitor mode; deauth and PMKID additionally need frame injection. lspci-class drivers behave differently here — check that your card injects before blaming the tool. - While NetworkManager is active it pins the card to the connected channel, so a "scan" sees mostly that one network. The app detects this at capture start and offers a **Stop NM** button (runs inside the elevated worker; `systemctl start NetworkManager` restores). - GPU cracking uses Vulkan compute and works headless (e.g. RADV on AMD). Without an adapter the run transparently falls back to CPU — the log says which backend is active. The GPU verifies only HMAC-SHA1 (key_ver 2) handshakes with EAPOL frames of 99..=183 bytes; everything else (WPA1-TKIP key_ver 1, AES-CMAC key_ver 3, imported captures with longer key-data) cracks on CPU. A backend failure — GPU device lost, a 30 s dispatch timeout, or a worker panic — aborts as `crack FAILED (backend): ` and *keeps* the resume session, instead of misreporting "keyspace exhausted". - WPA3-SAE-only APs have no offline-crackable handshake or PMKID; the attacks page disables those buttons for them. WPA2/WPA3 transition APs (PSK AKM present) are crackable as usual. ## Files | Path | Contents | | --- | --- | | `~/wifi_lab/captures.jsonl` | every handshake (complete and `[partial]`) and PMKID, restored at startup | | `~/wifi_lab/labels.json` | per-MAC user labels | | `~/wifi_lab/cache/.pmk` | per-SSID PMK cache (`wifi_lab-pmk v2` rainbow format, SHA-1 integrity footer) | | `~/wifi_lab/crack-session.json` | resume state (v2: exact raw stream positions), autosaved every ~2 s during a run | | `~/wifi_lab/profiles.json` | cracker presets + recent wordlists | | `~/wifi_lab/spool.pcap` | raw frames (radiotap) of the current capture session | Exports go to `./captures/wifi_lab-.hc22000` (or wherever you save them) in hashcat `-m 22000` format. ## Legal Deauthentication is an active attack: it forcibly disconnects other people's devices. Use this tool only on networks you own or have explicit written permission to test. In most jurisdictions running it against third-party networks is a crime regardless of intent. ## License MIT