Match recovered passphrases to networks, not addresses #161

Merged
aluminum-ice merged 1 commit from recovered-per-network into main 2026-11-03 05:49:50 +00:00
Owner

What this PR does

Matches each recovered passphrase to the network it was recovered for, instead of to an address alone.

AngryOxide picks a random rogue MAC each time it starts. When a phone answers that address for a network it remembers, AngryOxide files the handshake under the rogue MAC with the name the phone asked for, and sets the AP-less bit (0x10) in the line's message-pair byte. So one address collects many unrelated names in a capture run. The recovered store kept one result per address (by_bssid.setdefault) and the Captured networks page joined on the address only, so one passphrase showed against every name under that address. The dashboard's "recovered N of M" count and the map's green markers used the same join.

  • Capture parsing (capture.py): HandshakeEvent gains station (the client MAC) and apless. CaptureInterface.handshake_keys() gives, from the existing cached parse, (bssid, essid) for handshakes with a real AP and (bssid, station, essid) for AP-less ones.
  • Matching (recovered.py): match_records() and RecoveredStore.capture_matches(capture).
    • A real AP's result matches on BSSID and name, whatever the client, so several wpa-sec lines for one network (different clients, repeated handshakes) still match. A result with no name matches each name captured at its address, as before.
    • An AP-less result matches only on rogue address, client and name. A result without a client never matches one.
    • Differing passphrases for one network are all kept.
    • recovered_bssids(capture) gives the captured real APs with a result. The dashboard count and the map use it, so AP-less matches never count as a recovered access point.
  • Records keep the client MAC: the store no longer collapses results that differ only by client, and imports write the real client instead of an all-zero one. Earlier imports keep matching real APs; their AP-less results need importing again, since the client was dropped.
  • Captured networks page: passphrases are labelled with the network they belong to. In the by-AP view that's the name when a radio has more than one, plus the client for an AP-less result (Cafe Guest · client 00:00:5E:00:53:E1). In the by-network view it's the BSSID, plus the client. A result under a name whose BSSID was never captured still shows there, as before; one whose BSSID was captured shows only where it matches.
  • Docs: the operator guide (GUIDE_MD), Working with your captures, the plugin developer guide (the new event fields, handshake_keys(), the recovered service's methods), and the deferred entry on unmatched records.

This fix is thanks to a community member who found the problem and sent in a patch for it following CONTRIBUTING.md.

lookup_bssid() and lookup_essid() are unchanged, for plugins that use them; the docstring and developer guide now say an address alone doesn't identify a network.

Checklist

  • Lint passes — make lint (ansible --syntax-check, yamllint, shellcheck --severity=error, and the real-data check). The Lint workflow runs this on the PR.
  • Tests pass — make test: 1668 passed locally, with the two tests that only fail off a device deselected (test_main_ignores_sighup, test_gps_serial_reader_recovers_from_a_stalled_link). The Test workflow runs it on the PR.
  • Nothing real: no secrets, no personal information, no real data. RFC 7042 MACs, placeholder names and made-up passphrases only.
  • Consent gates intact. Display only: nothing about capture, the acknowledgment or the whitelist changes. The passphrase gates (login, show_passphrases) are unchanged.
  • Docs updated in the same PR.
  • Commit messages are short and imperative.

Release impact

  • App-layer-safe — the kestrel_pi package and plugins/map.py only.
  • Reflash-class

Notes for review

  • New tests cover one rogue address with several names and clients, two clients under one name, results without a client, a real AP's result under another name, the dashboard count and the map marker. test_status_counts_neither_apless_captures_nor_other_names fails on main (it counts 2 recovered access points instead of 1).
  • The ghost-guide demo store still matches all five of its recovered networks, so the guide's screenshots are unchanged. The demo has no AP-less captures, so no new figure.
  • For 1.0.13-beta.3. The beta-check script needs an item for it: on a device with AP-less captures, no rogue address counts toward "recovered N of M".
  • The submitted patch matched each result to individual handshakes. This takes a narrower approach so results for networks captured more than once, and earlier imports, keep showing.

🤖 Generated with Claude Code

## What this PR does Matches each recovered passphrase to the network it was recovered for, instead of to an address alone. AngryOxide picks a random rogue MAC each time it starts. When a phone answers that address for a network it remembers, AngryOxide files the handshake under the rogue MAC with the name the phone asked for, and sets the AP-less bit (`0x10`) in the line's message-pair byte. So one address collects many unrelated names in a capture run. The recovered store kept one result per address (`by_bssid.setdefault`) and the Captured networks page joined on the address only, so one passphrase showed against every name under that address. The dashboard's "recovered N of M" count and the map's green markers used the same join. - **Capture parsing** (`capture.py`): `HandshakeEvent` gains `station` (the client MAC) and `apless`. `CaptureInterface.handshake_keys()` gives, from the existing cached parse, `(bssid, essid)` for handshakes with a real AP and `(bssid, station, essid)` for AP-less ones. - **Matching** (`recovered.py`): `match_records()` and `RecoveredStore.capture_matches(capture)`. - A real AP's result matches on BSSID and name, whatever the client, so several wpa-sec lines for one network (different clients, repeated handshakes) still match. A result with no name matches each name captured at its address, as before. - An AP-less result matches only on rogue address, client and name. A result without a client never matches one. - Differing passphrases for one network are all kept. - `recovered_bssids(capture)` gives the captured real APs with a result. The dashboard count and the map use it, so AP-less matches never count as a recovered access point. - **Records keep the client MAC**: the store no longer collapses results that differ only by client, and imports write the real client instead of an all-zero one. Earlier imports keep matching real APs; their AP-less results need importing again, since the client was dropped. - **Captured networks page**: passphrases are labelled with the network they belong to. In the by-AP view that's the name when a radio has more than one, plus the client for an AP-less result (`Cafe Guest · client 00:00:5E:00:53:E1`). In the by-network view it's the BSSID, plus the client. A result under a name whose BSSID was never captured still shows there, as before; one whose BSSID was captured shows only where it matches. - **Docs**: the operator guide (`GUIDE_MD`), *Working with your captures*, the plugin developer guide (the new event fields, `handshake_keys()`, the `recovered` service's methods), and the deferred entry on unmatched records. This fix is thanks to a community member who found the problem and sent in a patch for it following CONTRIBUTING.md. `lookup_bssid()` and `lookup_essid()` are unchanged, for plugins that use them; the docstring and developer guide now say an address alone doesn't identify a network. ## Checklist - [x] **Lint passes** — `make lint` (ansible `--syntax-check`, `yamllint`, `shellcheck --severity=error`, and the real-data check). The **Lint** workflow runs this on the PR. - [x] **Tests pass** — `make test`: 1668 passed locally, with the two tests that only fail off a device deselected (`test_main_ignores_sighup`, `test_gps_serial_reader_recovers_from_a_stalled_link`). The **Test** workflow runs it on the PR. - [x] **Nothing real: no secrets, no personal information, no real data.** RFC 7042 MACs, placeholder names and made-up passphrases only. - [x] **Consent gates intact.** Display only: nothing about capture, the acknowledgment or the whitelist changes. The passphrase gates (login, `show_passphrases`) are unchanged. - [x] **Docs updated in the same PR.** - [x] Commit messages are short and imperative. ## Release impact - [x] **App-layer-safe** — the `kestrel_pi` package and `plugins/map.py` only. - [ ] **Reflash-class** ## Notes for review - New tests cover one rogue address with several names and clients, two clients under one name, results without a client, a real AP's result under another name, the dashboard count and the map marker. `test_status_counts_neither_apless_captures_nor_other_names` fails on main (it counts 2 recovered access points instead of 1). - The ghost-guide demo store still matches all five of its recovered networks, so the guide's screenshots are unchanged. The demo has no AP-less captures, so no new figure. - For 1.0.13-beta.3. The beta-check script needs an item for it: on a device with AP-less captures, no rogue address counts toward "recovered N of M". - The submitted patch matched each result to individual handshakes. This takes a narrower approach so results for networks captured more than once, and earlier imports, keep showing. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Match recovered passphrases to networks, not addresses
All checks were successful
Test / test (pull_request) Successful in 33s
Lint / lint (pull_request) Successful in 34s
Lint / lint (push) Successful in 33s
Test / test (push) Successful in 32s
ad17791f7d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aluminum-ice deleted branch recovered-per-network 2026-11-03 05:49:50 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aluminum-ice/kestrel!161
No description provided.