forge
Explore
Log in

Don't you dare go Hollow

Sync local working tree

Browse files at this commit

b26599893f688a08a2ecec703e34bc2b3d60303fAhmet Kaan GümüşParent: 6a4a1fd
  • chore
    • sync local working tree
Show full message
🔧 chore: sync local working tree

42 changed files +40659 -36580

.github/workflows/ci.ymladded+125 -0
@@ -0,0 +1,125 @@
1+name: CI
2+
3+on:
4+ push:
5+ branches: [main]
6+ pull_request:
7+ branches: [main]
8+
9+concurrency:
10+ group: ${{ github.workflow }}-${{ github.ref }}
11+ cancel-in-progress: true
12+
13+env:
14+ CARGO_TERM_COLOR: always
15+
16+jobs:
17+ fmt:
18+ name: fmt
19+ runs-on: ubuntu-latest
20+ steps:
21+ - uses: actions/checkout@v4
22+ - name: Install Rust (stable + rustfmt)
23+ uses: dtolnay/rust-toolchain@stable
24+ with:
25+ components: rustfmt
26+ - name: cargo fmt --check
27+ run: cargo fmt --check
28+
29+ clippy:
30+ name: clippy
31+ runs-on: ubuntu-latest
32+ steps:
33+ - uses: actions/checkout@v4
34+ - name: Install Rust (stable + clippy)
35+ uses: dtolnay/rust-toolchain@stable
36+ with:
37+ components: clippy
38+ - name: Install system dependencies
39+ run: |
40+ sudo apt-get update
41+ sudo apt-get install -y --no-install-recommends \
42+ libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev
43+ - uses: Swatinem/rust-cache@v2
44+ - name: cargo clippy
45+ run: cargo clippy --all-targets -- -D warnings
46+
47+ test:
48+ name: test
49+ runs-on: ubuntu-latest
50+ steps:
51+ - uses: actions/checkout@v4
52+ - name: Install Rust (stable)
53+ uses: dtolnay/rust-toolchain@stable
54+ - name: Install system dependencies
55+ run: |
56+ sudo apt-get update
57+ sudo apt-get install -y --no-install-recommends \
58+ libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev
59+ - uses: Swatinem/rust-cache@v2
60+ - name: cargo test --release
61+ run: cargo test --release
62+
63+ build:
64+ name: build
65+ runs-on: ubuntu-latest
66+ steps:
67+ - uses: actions/checkout@v4
68+ - name: Install Rust (stable)
69+ uses: dtolnay/rust-toolchain@stable
70+ - name: Install system dependencies
71+ run: |
72+ sudo apt-get update
73+ sudo apt-get install -y --no-install-recommends \
74+ libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev
75+ - uses: Swatinem/rust-cache@v2
76+ - name: cargo build --release
77+ run: cargo build --release
78+ - name: Upload release binary
79+ uses: actions/upload-artifact@v4
80+ with:
81+ name: wifi_lab-release
82+ path: target/release/wifi_lab
83+ retention-days: 7
84+
85+ smoke:
86+ name: smoke (mock UI under xvfb)
87+ needs: build
88+ runs-on: ubuntu-latest
89+ steps:
90+ - uses: actions/checkout@v4
91+ - name: Install Rust (stable)
92+ uses: dtolnay/rust-toolchain@stable
93+ - name: Install system dependencies (incl. xvfb)
94+ run: |
95+ sudo apt-get update
96+ sudo apt-get install -y --no-install-recommends \
97+ xvfb libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev \
98+ libxkbcommon-x11-0 libxcb-xkb1 libegl1 libgl1
99+ - uses: Swatinem/rust-cache@v2
100+ - name: cargo build --release
101+ run: cargo build --release
102+ - name: Run --mock under xvfb for 25s
103+ id: smoke
104+ run: |
105+ set +e
106+ xvfb-run -a timeout 25 ./target/release/wifi_lab --mock >smoke.log 2>&1
107+ status=$?
108+ set -e
109+ cat smoke.log
110+ echo "exit_status=$status" >> "$GITHUB_OUTPUT"
111+ # Success criteria:
112+ # - 124: killed by timeout (still alive, no early crash), AND no panic
113+ # - 0: exited cleanly on its own
114+ # - any other status with no panic in the log is still treated as
115+ # failure to be explicit about the process dying abnormally.
116+ if grep -q "panicked" smoke.log; then
117+ echo "::error::panic detected in mock-mode output"
118+ exit 1
119+ fi
120+ if [ "$status" -eq 124 ] || [ "$status" -eq 0 ]; then
121+ echo "smoke OK (status $status)"
122+ exit 0
123+ fi
124+ echo "::error::mock-mode exited abnormally with status $status"
125+ exit 1
.gitignoremodified+1 -0
@@ -1 +1,2 @@
1 /target1 /target
2+/docs
Cargo.lockmodified+127 -205
@@ -344,18 +344,6 @@ dependencies = [
344 "pin-project-lite",344 "pin-project-lite",
345 ]345 ]
346 346
347-[[package]]
348-name = "async-compression"
349-version = "0.4.50"
350-source = "registry+https://github.com/rust-lang/crates.io-index"
351-checksum = "ee19bd99b43e3691acbad4e840420a4881cea6c0b66a208125a824f8fd53f5a1"
352-dependencies = [
353- "compression-codecs",
354- "compression-core",
355- "futures-io",
356- "pin-project-lite",
357-]
358-
359 [[package]]347 [[package]]
360 name = "async-executor"348 name = "async-executor"
361 version = "1.14.0"349 version = "1.14.0"
@@ -447,7 +435,7 @@ checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451"
447 dependencies = [435 dependencies = [
448 "proc-macro2",436 "proc-macro2",
449 "quote",437 "quote",
450- "syn 3.0.8",438+ "syn 3.0.9",
451 ]439 ]
452 440
453 [[package]]441 [[package]]
@@ -482,7 +470,7 @@ checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
482 dependencies = [470 dependencies = [
483 "proc-macro2",471 "proc-macro2",
484 "quote",472 "quote",
485- "syn 3.0.8",473+ "syn 3.0.9",
486 ]474 ]
487 475
488 [[package]]476 [[package]]
@@ -759,16 +747,6 @@ dependencies = [
759 "piper",747 "piper",
760 ]748 ]
761 749
762-[[package]]
763-name = "borsh"
764-version = "1.8.1"
765-source = "registry+https://github.com/rust-lang/crates.io-index"
766-checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a"
767-dependencies = [
768- "bytes",
769- "cfg_aliases",
770-]
771-
772 [[package]]750 [[package]]
773 name = "built"751 name = "built"
774 version = "0.8.1"752 version = "0.8.1"
@@ -798,7 +776,7 @@ checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c"
798 dependencies = [776 dependencies = [
799 "proc-macro2",777 "proc-macro2",
800 "quote",778 "quote",
801- "syn 3.0.8",779+ "syn 3.0.9",
802 ]780 ]
803 781
804 [[package]]782 [[package]]
@@ -819,15 +797,6 @@ version = "1.12.1"
819 source = "registry+https://github.com/rust-lang/crates.io-index"797 source = "registry+https://github.com/rust-lang/crates.io-index"
820 checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"798 checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
821 799
822-[[package]]
823-name = "bzip2"
824-version = "0.6.1"
825-source = "registry+https://github.com/rust-lang/crates.io-index"
826-checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
827-dependencies = [
828- "libbz2-rs-sys",
829-]
830-
831 [[package]]800 [[package]]
832 name = "calloop"801 name = "calloop"
833 version = "0.14.5"802 version = "0.14.5"
@@ -881,9 +850,9 @@ dependencies = [
881 850
882 [[package]]851 [[package]]
883 name = "cc"852 name = "cc"
884-version = "1.8.0"853+version = "1.10.0"
885 source = "registry+https://github.com/rust-lang/crates.io-index"854 source = "registry+https://github.com/rust-lang/crates.io-index"
886-checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838"855+checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0"
887 dependencies = [856 dependencies = [
888 "find-msvc-tools",857 "find-msvc-tools",
889 "jobserver",858 "jobserver",
@@ -988,7 +957,7 @@ dependencies = [
988 "heck 0.5.0",957 "heck 0.5.0",
989 "proc-macro2",958 "proc-macro2",
990 "quote",959 "quote",
991- "syn 3.0.8",960+ "syn 3.0.9",
992 ]961 ]
993 962
994 [[package]]963 [[package]]
@@ -1076,9 +1045,9 @@ dependencies = [
1076 1045
1077 [[package]]1046 [[package]]
1078 name = "collections-gpui-unofficial"1047 name = "collections-gpui-unofficial"
1079-version = "1.23.2"1048+version = "1.25.3"
1080 source = "registry+https://github.com/rust-lang/crates.io-index"1049 source = "registry+https://github.com/rust-lang/crates.io-index"
1081-checksum = "2a7664443e4e4b91f28b500d779b12883edf32a80f61a963bda2ce32c2be3e66"1050+checksum = "5b5d6e357c31d899381903a5a666e6e04f293a7a01fd7f89de83e930115d01ae"
1082 dependencies = [1051 dependencies = [
1083 "gpui-util-gpui-unofficial",1052 "gpui-util-gpui-unofficial",
1084 "indexmap",1053 "indexmap",
@@ -1097,24 +1066,6 @@ version = "1.0.5"
1097 source = "registry+https://github.com/rust-lang/crates.io-index"1066 source = "registry+https://github.com/rust-lang/crates.io-index"
1098 checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"1067 checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
1099 1068
1100-[[package]]
1101-name = "compression-codecs"
1102-version = "0.4.45"
1103-source = "registry+https://github.com/rust-lang/crates.io-index"
1104-checksum = "98fc98460ba0ad5317075d3632b8dfc45d0be8c4a49347c2a38272019717614a"
1105-dependencies = [
1106- "bzip2",
1107- "compression-core",
1108- "flate2",
1109- "memchr",
1110-]
1111-
1112-[[package]]
1113-name = "compression-core"
1114-version = "0.4.33"
1115-source = "registry+https://github.com/rust-lang/crates.io-index"
1116-checksum = "6e8ccc4ea9f6acc32d102c0f6d471d11d913ad15f20c04de743374861fa1d414"
1117-
1118 [[package]]1069 [[package]]
1119 name = "concurrent-queue"1070 name = "concurrent-queue"
1120 version = "2.5.0"1071 version = "2.5.0"
@@ -1354,9 +1305,9 @@ dependencies = [
1354 1305
1355 [[package]]1306 [[package]]
1356 name = "crc32fast"1307 name = "crc32fast"
1357-version = "1.5.2"1308+version = "1.5.3"
1358 source = "registry+https://github.com/rust-lang/crates.io-index"1309 source = "registry+https://github.com/rust-lang/crates.io-index"
1359-checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78"1310+checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055"
1360 dependencies = [1311 dependencies = [
1361 "cfg-if",1312 "cfg-if",
1362 ]1313 ]
@@ -1441,9 +1392,9 @@ dependencies = [
1441 1392
1442 [[package]]1393 [[package]]
1443 name = "ctutils"1394 name = "ctutils"
1444-version = "0.4.3"1395+version = "0.4.5"
1445 source = "registry+https://github.com/rust-lang/crates.io-index"1396 source = "registry+https://github.com/rust-lang/crates.io-index"
1446-checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574"1397+checksum = "38d28fb6aa7dd680b3ffd1a3e64e115c177bdba63c0ae7f9cd48129ff05c4fa0"
1447 dependencies = [1398 dependencies = [
1448 "cmov",1399 "cmov",
1449 ]1400 ]
@@ -1456,15 +1407,15 @@ checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376"
1456 1407
1457 [[package]]1408 [[package]]
1458 name = "deranged"1409 name = "deranged"
1459-version = "0.5.8"1410+version = "0.5.9"
1460 source = "registry+https://github.com/rust-lang/crates.io-index"1411 source = "registry+https://github.com/rust-lang/crates.io-index"
1461-checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"1412+checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e"
1462 1413
1463 [[package]]1414 [[package]]
1464 name = "derive-refineable-gpui-unofficial"1415 name = "derive-refineable-gpui-unofficial"
1465-version = "1.23.2"1416+version = "1.25.3"
1466 source = "registry+https://github.com/rust-lang/crates.io-index"1417 source = "registry+https://github.com/rust-lang/crates.io-index"
1467-checksum = "caa6793408e5558ee316f4a7c97aa6dbb0b2e76559b7d89af4bf94036ddcdacb"1418+checksum = "cf9b2751c7958adf2a48be89d46a963ba5fff798bcd6f15b5cd5847190de38e5"
1468 dependencies = [1419 dependencies = [
1469 "proc-macro2",1420 "proc-macro2",
1470 "quote",1421 "quote",
@@ -1564,7 +1515,7 @@ checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
1564 dependencies = [1515 dependencies = [
1565 "proc-macro2",1516 "proc-macro2",
1566 "quote",1517 "quote",
1567- "syn 3.0.8",1518+ "syn 3.0.9",
1568 ]1519 ]
1569 1520
1570 [[package]]1521 [[package]]
@@ -1709,9 +1660,9 @@ dependencies = [
1709 1660
1710 [[package]]1661 [[package]]
1711 name = "equivalent"1662 name = "equivalent"
1712-version = "1.0.2"1663+version = "1.0.3"
1713 source = "registry+https://github.com/rust-lang/crates.io-index"1664 source = "registry+https://github.com/rust-lang/crates.io-index"
1714-checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"1665+checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
1715 1666
1716 [[package]]1667 [[package]]
1717 name = "erased-serde"1668 name = "erased-serde"
@@ -1795,9 +1746,6 @@ name = "fastrand"
1795 version = "2.5.0"1746 version = "2.5.0"
1796 source = "registry+https://github.com/rust-lang/crates.io-index"1747 source = "registry+https://github.com/rust-lang/crates.io-index"
1797 checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"1748 checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
1798-dependencies = [
1799- "getrandom 0.4.3",
1800-]
1801 1749
1802 [[package]]1750 [[package]]
1803 name = "fax"1751 name = "fax"
@@ -1827,9 +1775,9 @@ dependencies = [
1827 1775
1828 [[package]]1776 [[package]]
1829 name = "find-msvc-tools"1777 name = "find-msvc-tools"
1830-version = "0.1.14"1778+version = "0.1.15"
1831 source = "registry+https://github.com/rust-lang/crates.io-index"1779 source = "registry+https://github.com/rust-lang/crates.io-index"
1832-checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"1780+checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
1833 1781
1834 [[package]]1782 [[package]]
1835 name = "fixedbitset"1783 name = "fixedbitset"
@@ -1872,7 +1820,6 @@ version = "0.12.0"
1872 source = "registry+https://github.com/rust-lang/crates.io-index"1820 source = "registry+https://github.com/rust-lang/crates.io-index"
1873 checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be"1821 checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be"
1874 dependencies = [1822 dependencies = [
1875- "fastrand",
1876 "futures-core",1823 "futures-core",
1877 "futures-sink",1824 "futures-sink",
1878 "spin 0.9.9",1825 "spin 0.9.9",
@@ -1901,9 +1848,9 @@ dependencies = [
1901 1848
1902 [[package]]1849 [[package]]
1903 name = "font-types"1850 name = "font-types"
1904-version = "0.12.6"1851+version = "0.12.7"
1905 source = "registry+https://github.com/rust-lang/crates.io-index"1852 source = "registry+https://github.com/rust-lang/crates.io-index"
1906-checksum = "6c92d9081c7ab3bd83ef1eecdfad090f3d966e3ce74106779664114cfe1a6274"1853+checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d"
1907 dependencies = [1854 dependencies = [
1908 "bytemuck",1855 "bytemuck",
1909 ]1856 ]
@@ -1949,7 +1896,7 @@ checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225"
1949 dependencies = [1896 dependencies = [
1950 "proc-macro2",1897 "proc-macro2",
1951 "quote",1898 "quote",
1952- "syn 3.0.8",1899+ "syn 3.0.9",
1953 ]1900 ]
1954 1901
1955 [[package]]1902 [[package]]
@@ -2060,7 +2007,7 @@ checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"
2060 dependencies = [2007 dependencies = [
2061 "proc-macro2",2008 "proc-macro2",
2062 "quote",2009 "quote",
2063- "syn 3.0.8",2010+ "syn 3.0.9",
2064 ]2011 ]
2065 2012
2066 [[package]]2013 [[package]]
@@ -2144,10 +2091,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2144 checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"2091 checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
2145 dependencies = [2092 dependencies = [
2146 "cfg-if",2093 "cfg-if",
2147- "js-sys",
2148 "libc",2094 "libc",
2149 "r-efi 6.0.0",2095 "r-efi 6.0.0",
2150- "wasm-bindgen",
2151 ]2096 ]
2152 2097
2153 [[package]]2098 [[package]]
@@ -2343,9 +2288,9 @@ dependencies = [
2343 2288
2344 [[package]]2289 [[package]]
2345 name = "gpui-macros-gpui-unofficial"2290 name = "gpui-macros-gpui-unofficial"
2346-version = "1.23.2"2291+version = "1.25.3"
2347 source = "registry+https://github.com/rust-lang/crates.io-index"2292 source = "registry+https://github.com/rust-lang/crates.io-index"
2348-checksum = "90e2d319cffc9babae40310150a402e0dfc5b75f4a6af516d18a3bbb4458dc26"2293+checksum = "9542a87925e57092a37f5c11f8dc95e3331db4d5ae5eeb267df55b6e229aa7fd"
2349 dependencies = [2294 dependencies = [
2350 "heck 0.5.0",2295 "heck 0.5.0",
2351 "proc-macro2",2296 "proc-macro2",
@@ -2369,9 +2314,9 @@ dependencies = [
2369 2314
2370 [[package]]2315 [[package]]
2371 name = "gpui-shared-string-gpui-unofficial"2316 name = "gpui-shared-string-gpui-unofficial"
2372-version = "1.23.2"2317+version = "1.25.3"
2373 source = "registry+https://github.com/rust-lang/crates.io-index"2318 source = "registry+https://github.com/rust-lang/crates.io-index"
2374-checksum = "6f373a7f4e4ceb3d6cce9303b7fd9d2d446b53ecb0975c8fb2c5f015a52a73cf"2319+checksum = "7d629df59c750fbd02165d27d2bdf46cde67de046ae5740767699bf9b89644be"
2375 dependencies = [2320 dependencies = [
2376 "schemars",2321 "schemars",
2377 "serde",2322 "serde",
@@ -2463,9 +2408,9 @@ dependencies = [
2463 2408
2464 [[package]]2409 [[package]]
2465 name = "gpui-util-gpui-unofficial"2410 name = "gpui-util-gpui-unofficial"
2466-version = "1.23.2"2411+version = "1.25.3"
2467 source = "registry+https://github.com/rust-lang/crates.io-index"2412 source = "registry+https://github.com/rust-lang/crates.io-index"
2468-checksum = "4d7d4f349a6ccc2dc7714e306431ec0b6f152f15fc2cb7e9b577e2e5c7f8157f"2413+checksum = "83144a0527682b3bad75a909c45fa5d3cfc8b720f2177fccdff7fb77e2ba1084"
2469 dependencies = [2414 dependencies = [
2470 "anyhow",2415 "anyhow",
2471 "log",2416 "log",
@@ -2739,14 +2684,12 @@ dependencies = [
2739 2684
2740 [[package]]2685 [[package]]
2741 name = "http-client-gpui-unofficial"2686 name = "http-client-gpui-unofficial"
2742-version = "1.23.2"2687+version = "1.25.3"
2743 source = "registry+https://github.com/rust-lang/crates.io-index"2688 source = "registry+https://github.com/rust-lang/crates.io-index"
2744-checksum = "da36ebcf08ddb51e4c1def7a90f5d6a25bbc73ed119580080254b500bf67dfe7"2689+checksum = "e8f10b52ef3654657cdfe16ee820b52fa8bcff051488e964f7b746d5840e35ff"
2745 dependencies = [2690 dependencies = [
2746 "anyhow",2691 "anyhow",
2747- "async-compression",
2748 "bytes",2692 "bytes",
2749- "derive_more",
2750 "futures",2693 "futures",
2751 "http",2694 "http",
2752 "http-body",2695 "http-body",
@@ -2793,9 +2736,9 @@ dependencies = [
2793 2736
2794 [[package]]2737 [[package]]
2795 name = "icu_collections"2738 name = "icu_collections"
2796-version = "2.3.0"2739+version = "2.4.0"
2797 source = "registry+https://github.com/rust-lang/crates.io-index"2740 source = "registry+https://github.com/rust-lang/crates.io-index"
2798-checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513"2741+checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd"
2799 dependencies = [2742 dependencies = [
2800 "displaydoc",2743 "displaydoc",
2801 "potential_utf",2744 "potential_utf",
@@ -2807,9 +2750,9 @@ dependencies = [
2807 2750
2808 [[package]]2751 [[package]]
2809 name = "icu_locale_core"2752 name = "icu_locale_core"
2810-version = "2.3.0"2753+version = "2.4.0"
2811 source = "registry+https://github.com/rust-lang/crates.io-index"2754 source = "registry+https://github.com/rust-lang/crates.io-index"
2812-checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb"2755+checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0"
2813 dependencies = [2756 dependencies = [
2814 "displaydoc",2757 "displaydoc",
2815 "litemap",2758 "litemap",
@@ -2820,9 +2763,9 @@ dependencies = [
2820 2763
2821 [[package]]2764 [[package]]
2822 name = "icu_normalizer"2765 name = "icu_normalizer"
2823-version = "2.3.0"2766+version = "2.4.0"
2824 source = "registry+https://github.com/rust-lang/crates.io-index"2767 source = "registry+https://github.com/rust-lang/crates.io-index"
2825-checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f"2768+checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599"
2826 dependencies = [2769 dependencies = [
2827 "icu_collections",2770 "icu_collections",
2828 "icu_normalizer_data",2771 "icu_normalizer_data",
@@ -2834,15 +2777,15 @@ dependencies = [
2834 2777
2835 [[package]]2778 [[package]]
2836 name = "icu_normalizer_data"2779 name = "icu_normalizer_data"
2837-version = "2.3.0"2780+version = "2.4.0"
2838 source = "registry+https://github.com/rust-lang/crates.io-index"2781 source = "registry+https://github.com/rust-lang/crates.io-index"
2839-checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0"2782+checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc"
2840 2783
2841 [[package]]2784 [[package]]
2842 name = "icu_properties"2785 name = "icu_properties"
2843-version = "2.3.0"2786+version = "2.4.0"
2844 source = "registry+https://github.com/rust-lang/crates.io-index"2787 source = "registry+https://github.com/rust-lang/crates.io-index"
2845-checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148"2788+checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f"
2846 dependencies = [2789 dependencies = [
2847 "displaydoc",2790 "displaydoc",
2848 "icu_collections",2791 "icu_collections",
@@ -2855,15 +2798,15 @@ dependencies = [
2855 2798
2856 [[package]]2799 [[package]]
2857 name = "icu_properties_data"2800 name = "icu_properties_data"
2858-version = "2.3.0"2801+version = "2.4.0"
2859 source = "registry+https://github.com/rust-lang/crates.io-index"2802 source = "registry+https://github.com/rust-lang/crates.io-index"
2860-checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa"2803+checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf"
2861 2804
2862 [[package]]2805 [[package]]
2863 name = "icu_provider"2806 name = "icu_provider"
2864-version = "2.3.1"2807+version = "2.4.0"
2865 source = "registry+https://github.com/rust-lang/crates.io-index"2808 source = "registry+https://github.com/rust-lang/crates.io-index"
2866-checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73"2809+checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514"
2867 dependencies = [2810 dependencies = [
2868 "displaydoc",2811 "displaydoc",
2869 "icu_locale_core",2812 "icu_locale_core",
@@ -3148,17 +3091,11 @@ version = "0.5.3"
3148 source = "registry+https://github.com/rust-lang/crates.io-index"3091 source = "registry+https://github.com/rust-lang/crates.io-index"
3149 checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"3092 checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"
3150 3093
3151-[[package]]
3152-name = "libbz2-rs-sys"
3153-version = "0.2.5"
3154-source = "registry+https://github.com/rust-lang/crates.io-index"
3155-checksum = "34b357333733e8260735ba5894eb928c02ecc69c78715f01a8019e7fa7f2db4c"
3156-
3157 [[package]]3094 [[package]]
3158 name = "libc"3095 name = "libc"
3159-version = "0.2.190"3096+version = "0.2.191"
3160 source = "registry+https://github.com/rust-lang/crates.io-index"3097 source = "registry+https://github.com/rust-lang/crates.io-index"
3161-checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"3098+checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
3162 3099
3163 [[package]]3100 [[package]]
3164 name = "libfuzzer-sys"3101 name = "libfuzzer-sys"
@@ -3271,9 +3208,9 @@ dependencies = [
3271 3208
3272 [[package]]3209 [[package]]
3273 name = "lyon_algorithms"3210 name = "lyon_algorithms"
3274-version = "1.0.21"3211+version = "1.0.22"
3275 source = "registry+https://github.com/rust-lang/crates.io-index"3212 source = "registry+https://github.com/rust-lang/crates.io-index"
3276-checksum = "cdfa8785f95e57914ddb35e3b59994aeba6f5e79e9cfd03da1c269f010f36009"3213+checksum = "f3a6b9d4e8b48acd531fbf1241ad9b270df6e60b6b92bdea1469f4f40899d805"
3277 dependencies = [3214 dependencies = [
3278 "lyon_path",3215 "lyon_path",
3279 "num-traits",3216 "num-traits",
@@ -3281,9 +3218,9 @@ dependencies = [
3281 3218
3282 [[package]]3219 [[package]]
3283 name = "lyon_geom"3220 name = "lyon_geom"
3284-version = "1.0.19"3221+version = "1.0.20"
3285 source = "registry+https://github.com/rust-lang/crates.io-index"3222 source = "registry+https://github.com/rust-lang/crates.io-index"
3286-checksum = "4336502e29e32af93cf2dad2214ed6003c17ceb5bd499df77b1de663b9042b92"3223+checksum = "d82dd26aa4dc0b5b70b9115de59824842bcb43cf4a28e1b1e6d0ad148c93f93e"
3287 dependencies = [3224 dependencies = [
3288 "arrayvec",3225 "arrayvec",
3289 "euclid",3226 "euclid",
@@ -3302,9 +3239,9 @@ dependencies = [
3302 3239
3303 [[package]]3240 [[package]]
3304 name = "lyon_tessellation"3241 name = "lyon_tessellation"
3305-version = "1.0.22"3242+version = "1.0.23"
3306 source = "registry+https://github.com/rust-lang/crates.io-index"3243 source = "registry+https://github.com/rust-lang/crates.io-index"
3307-checksum = "43b8dcf906637ecef61b3c0740c7a4e7f27caeb31257cfac0cc579ce15be6005"3244+checksum = "fd4872650e70dc907dd4f7ebc449d7d657a0d2658e423b2e724970870bbbf75b"
3308 dependencies = [3245 dependencies = [
3309 "float_next_after",3246 "float_next_after",
3310 "lyon_path",3247 "lyon_path",
@@ -3386,9 +3323,9 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
3386 3323
3387 [[package]]3324 [[package]]
3388 name = "memmap2"3325 name = "memmap2"
3389-version = "0.9.11"3326+version = "0.9.12"
3390 source = "registry+https://github.com/rust-lang/crates.io-index"3327 source = "registry+https://github.com/rust-lang/crates.io-index"
3391-checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0"3328+checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157"
3392 dependencies = [3329 dependencies = [
3393 "libc",3330 "libc",
3394 ]3331 ]
@@ -4060,9 +3997,9 @@ dependencies = [
4060 3997
4061 [[package]]3998 [[package]]
4062 name = "open"3999 name = "open"
4063-version = "5.4.4"4000+version = "5.4.5"
4064 source = "registry+https://github.com/rust-lang/crates.io-index"4001 source = "registry+https://github.com/rust-lang/crates.io-index"
4065-checksum = "aa576c76302b7b808eecc68061e67336c47833ef9d22caa74dda10fa9675eebc"4002+checksum = "8d8c8b8e725ad26404d6896eb2f064294a0a7b4f1d9120210d85544684c4ca95"
4066 dependencies = [4003 dependencies = [
4067 "is-wsl",4004 "is-wsl",
4068 "libc",4005 "libc",
@@ -4181,9 +4118,9 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
4181 4118
4182 [[package]]4119 [[package]]
4183 name = "perf-gpui-unofficial"4120 name = "perf-gpui-unofficial"
4184-version = "1.23.2"4121+version = "1.25.3"
4185 source = "registry+https://github.com/rust-lang/crates.io-index"4122 source = "registry+https://github.com/rust-lang/crates.io-index"
4186-checksum = "fd431e83e1d8c4e643e4ba2597c27dc6662df7991d5476bd255087b056ea4552"4123+checksum = "23990b43e7973ce3ec93db6e4a7fd83b3109c0fddaf0a376bd54a4b32bb8a822"
4187 dependencies = [4124 dependencies = [
4188 "collections-gpui-unofficial",4125 "collections-gpui-unofficial",
4189 "serde",4126 "serde",
@@ -4486,9 +4423,9 @@ dependencies = [
4486 4423
4487 [[package]]4424 [[package]]
4488 name = "pulldown-cmark"4425 name = "pulldown-cmark"
4489-version = "0.13.4"4426+version = "0.13.5"
4490 source = "registry+https://github.com/rust-lang/crates.io-index"4427 source = "registry+https://github.com/rust-lang/crates.io-index"
4491-checksum = "e9f068eba8e7071c5f9511831b44f32c740d5adf574e990f946ddb53db2f314e"4428+checksum = "278e9268c93b9e498a2da46c34d90ba93a3255eb99009646398f34bc73ab36eb"
4492 dependencies = [4429 dependencies = [
4493 "bitflags 2.13.2",4430 "bitflags 2.13.2",
4494 "memchr",4431 "memchr",
@@ -4762,7 +4699,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
4762 checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709"4699 checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709"
4763 dependencies = [4700 dependencies = [
4764 "bytemuck",4701 "bytemuck",
4765- "font-types 0.12.6",4702+ "font-types 0.12.7",
4766 "once_cell",4703 "once_cell",
4767 ]4704 ]
4768 4705
@@ -4809,14 +4746,14 @@ checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a"
4809 dependencies = [4746 dependencies = [
4810 "proc-macro2",4747 "proc-macro2",
4811 "quote",4748 "quote",
4812- "syn 3.0.8",4749+ "syn 3.0.9",
4813 ]4750 ]
4814 4751
4815 [[package]]4752 [[package]]
4816 name = "refineable-gpui-unofficial"4753 name = "refineable-gpui-unofficial"
4817-version = "1.23.2"4754+version = "1.25.3"
4818 source = "registry+https://github.com/rust-lang/crates.io-index"4755 source = "registry+https://github.com/rust-lang/crates.io-index"
4819-checksum = "1c8cebb23363014b3845efa4c892a43d063b0e2bc5f0a4aacdc392318b1d8caf"4756+checksum = "7bc1bc9f980cae3b7194693251e00b823870d2d396fc6c400dde6e622fd1897c"
4820 dependencies = [4757 dependencies = [
4821 "derive-refineable-gpui-unofficial",4758 "derive-refineable-gpui-unofficial",
4822 ]4759 ]
@@ -4928,7 +4865,7 @@ version = "8.13.0"
4928 source = "registry+https://github.com/rust-lang/crates.io-index"4865 source = "registry+https://github.com/rust-lang/crates.io-index"
4929 checksum = "0d84e8ba78bd384263e5922f084cbe1b081c3b7e69add59c8fb097b879ba968a"4866 checksum = "0d84e8ba78bd384263e5922f084cbe1b081c3b7e69add59c8fb097b879ba968a"
4930 dependencies = [4867 dependencies = [
4931- "sha2 0.11.0",4868+ "sha2 0.11.1",
4932 "walkdir",4869 "walkdir",
4933 ]4870 ]
4934 4871
@@ -5013,9 +4950,9 @@ dependencies = [
5013 4950
5014 [[package]]4951 [[package]]
5015 name = "scheduler-gpui-unofficial"4952 name = "scheduler-gpui-unofficial"
5016-version = "1.23.2"4953+version = "1.25.3"
5017 source = "registry+https://github.com/rust-lang/crates.io-index"4954 source = "registry+https://github.com/rust-lang/crates.io-index"
5018-checksum = "417d5b0a1d87057b31dc99053b1d8bc22d628d623c9aea47e6f3b9bdcc17f744"4955+checksum = "2b2ecfb36ff68af3e89ddc5202e93565835f1b0cccb8ef40f09b0384eba1fac1"
5019 dependencies = [4956 dependencies = [
5020 "async-task",4957 "async-task",
5021 "backtrace",4958 "backtrace",
@@ -5029,9 +4966,9 @@ dependencies = [
5029 4966
5030 [[package]]4967 [[package]]
5031 name = "schemars"4968 name = "schemars"
5032-version = "1.2.2"4969+version = "1.2.3"
5033 source = "registry+https://github.com/rust-lang/crates.io-index"4970 source = "registry+https://github.com/rust-lang/crates.io-index"
5034-checksum = "687274d293b6cdc6e73e0fee520bf2049650090d7164f87672d212a3c530cf4a"4971+checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e"
5035 dependencies = [4972 dependencies = [
5036 "dyn-clone",4973 "dyn-clone",
5037 "indexmap",4974 "indexmap",
@@ -5043,14 +4980,14 @@ dependencies = [
5043 4980
5044 [[package]]4981 [[package]]
5045 name = "schemars_derive"4982 name = "schemars_derive"
5046-version = "1.2.2"4983+version = "1.2.3"
5047 source = "registry+https://github.com/rust-lang/crates.io-index"4984 source = "registry+https://github.com/rust-lang/crates.io-index"
5048-checksum = "d98c67716b46af2f0b8cf752abc930f6f9aecfbf671ecfb531db8a31dbe4e2ba"4985+checksum = "e1c3a92094fa7d61aa124645844facb6b554dfc797136d0f5fd1f890e2bffc69"
5049 dependencies = [4986 dependencies = [
5050 "proc-macro2",4987 "proc-macro2",
5051 "quote",4988 "quote",
5052 "serde_derive_internals",4989 "serde_derive_internals",
5053- "syn 3.0.8",4990+ "syn 3.0.9",
5054 ]4991 ]
5055 4992
5056 [[package]]4993 [[package]]
@@ -5147,7 +5084,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
5147 dependencies = [5084 dependencies = [
5148 "proc-macro2",5085 "proc-macro2",
5149 "quote",5086 "quote",
5150- "syn 3.0.8",5087+ "syn 3.0.9",
5151 ]5088 ]
5152 5089
5153 [[package]]5090 [[package]]
@@ -5158,7 +5095,7 @@ checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd"
5158 dependencies = [5095 dependencies = [
5159 "proc-macro2",5096 "proc-macro2",
5160 "quote",5097 "quote",
5161- "syn 3.0.8",5098+ "syn 3.0.9",
5162 ]5099 ]
5163 5100
5164 [[package]]5101 [[package]]
@@ -5193,7 +5130,7 @@ checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906"
5193 dependencies = [5130 dependencies = [
5194 "proc-macro2",5131 "proc-macro2",
5195 "quote",5132 "quote",
5196- "syn 3.0.8",5133+ "syn 3.0.9",
5197 ]5134 ]
5198 5135
5199 [[package]]5136 [[package]]
@@ -5256,9 +5193,9 @@ dependencies = [
5256 5193
5257 [[package]]5194 [[package]]
5258 name = "sha2"5195 name = "sha2"
5259-version = "0.11.0"5196+version = "0.11.1"
5260 source = "registry+https://github.com/rust-lang/crates.io-index"5197 source = "registry+https://github.com/rust-lang/crates.io-index"
5261-checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4"5198+checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
5262 dependencies = [5199 dependencies = [
5263 "cfg-if",5200 "cfg-if",
5264 "cpufeatures 0.3.1",5201 "cpufeatures 0.3.1",
@@ -5369,9 +5306,9 @@ dependencies = [
5369 5306
5370 [[package]]5307 [[package]]
5371 name = "smallvec"5308 name = "smallvec"
5372-version = "1.16.3"5309+version = "1.16.4"
5373 source = "registry+https://github.com/rust-lang/crates.io-index"5310 source = "registry+https://github.com/rust-lang/crates.io-index"
5374-checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b"5311+checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8"
5375 5312
5376 [[package]]5313 [[package]]
5377 name = "smol"5314 name = "smol"
@@ -5392,11 +5329,10 @@ dependencies = [
5392 5329
5393 [[package]]5330 [[package]]
5394 name = "smol_str"5331 name = "smol_str"
5395-version = "0.3.6"5332+version = "0.3.7"
5396 source = "registry+https://github.com/rust-lang/crates.io-index"5333 source = "registry+https://github.com/rust-lang/crates.io-index"
5397-checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523"5334+checksum = "eeb7109d23f319619d4cc0de5464613c8b7b1a09db2774a58101459cf6be2f10"
5398 dependencies = [5335 dependencies = [
5399- "borsh",
5400 "serde_core",5336 "serde_core",
5401 ]5337 ]
5402 5338
@@ -5517,12 +5453,11 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
5517 5453
5518 [[package]]5454 [[package]]
5519 name = "sum-tree-gpui-unofficial"5455 name = "sum-tree-gpui-unofficial"
5520-version = "1.23.2"5456+version = "1.25.3"
5521 source = "registry+https://github.com/rust-lang/crates.io-index"5457 source = "registry+https://github.com/rust-lang/crates.io-index"
5522-checksum = "a1f1cc1ad612eb9f91f692c8368cd2cd9dba3e90142d0863f09802ac4b093153"5458+checksum = "8629fc7d97660cdc69bdbf66417fadecf44b7161ff34a8d5791dbcc92ccb2120"
5523 dependencies = [5459 dependencies = [
5524 "heapless",5460 "heapless",
5525- "log",
5526 "rayon",5461 "rayon",
5527 "tracing",5462 "tracing",
5528 "ztracing-gpui-unofficial",5463 "ztracing-gpui-unofficial",
@@ -5647,9 +5582,9 @@ dependencies = [
5647 5582
5648 [[package]]5583 [[package]]
5649 name = "syn"5584 name = "syn"
5650-version = "3.0.8"5585+version = "3.0.9"
5651 source = "registry+https://github.com/rust-lang/crates.io-index"5586 source = "registry+https://github.com/rust-lang/crates.io-index"
5652-checksum = "01016da373cd8f7ef12624f796309f5c31ba8d646dd08856c02cd741d823c622"5587+checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
5653 dependencies = [5588 dependencies = [
5654 "proc-macro2",5589 "proc-macro2",
5655 "quote",5590 "quote",
@@ -5664,7 +5599,7 @@ checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02"
5664 dependencies = [5599 dependencies = [
5665 "proc-macro2",5600 "proc-macro2",
5666 "quote",5601 "quote",
5667- "syn 3.0.8",5602+ "syn 3.0.9",
5668 ]5603 ]
5669 5604
5670 [[package]]5605 [[package]]
@@ -5784,7 +5719,7 @@ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
5784 dependencies = [5719 dependencies = [
5785 "proc-macro2",5720 "proc-macro2",
5786 "quote",5721 "quote",
5787- "syn 3.0.8",5722+ "syn 3.0.9",
5788 ]5723 ]
5789 5724
5790 [[package]]5725 [[package]]
@@ -5866,9 +5801,9 @@ dependencies = [
5866 5801
5867 [[package]]5802 [[package]]
5868 name = "tinystr"5803 name = "tinystr"
5869-version = "0.8.4"5804+version = "0.8.5"
5870 source = "registry+https://github.com/rust-lang/crates.io-index"5805 source = "registry+https://github.com/rust-lang/crates.io-index"
5871-checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643"5806+checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a"
5872 dependencies = [5807 dependencies = [
5873 "displaydoc",5808 "displaydoc",
5874 "zerovec",5809 "zerovec",
@@ -5882,9 +5817,9 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
5882 5817
5883 [[package]]5818 [[package]]
5884 name = "tokio"5819 name = "tokio"
5885-version = "1.53.2"5820+version = "1.54.1"
5886 source = "registry+https://github.com/rust-lang/crates.io-index"5821 source = "registry+https://github.com/rust-lang/crates.io-index"
5887-checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044"5822+checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3"
5888 dependencies = [5823 dependencies = [
5889 "pin-project-lite",5824 "pin-project-lite",
5890 ]5825 ]
@@ -6196,9 +6131,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
6196 6131
6197 [[package]]6132 [[package]]
6198 name = "util-macros-gpui-unofficial"6133 name = "util-macros-gpui-unofficial"
6199-version = "1.23.2"6134+version = "1.25.3"
6200 source = "registry+https://github.com/rust-lang/crates.io-index"6135 source = "registry+https://github.com/rust-lang/crates.io-index"
6201-checksum = "af60a3313d69a8b82f142bb02661cfd7e2456a7e7654a753ea9df755401f9707"6136+checksum = "9b96b59a96ca6e319ddb0c1086e4d5b3ca8474eb21397782d72d1f5a9dff9a12"
6202 dependencies = [6137 dependencies = [
6203 "perf-gpui-unofficial",6138 "perf-gpui-unofficial",
6204 "quote",6139 "quote",
@@ -6207,9 +6142,9 @@ dependencies = [
6207 6142
6208 [[package]]6143 [[package]]
6209 name = "uuid"6144 name = "uuid"
6210-version = "1.28.0"6145+version = "1.29.0"
6211 source = "registry+https://github.com/rust-lang/crates.io-index"6146 source = "registry+https://github.com/rust-lang/crates.io-index"
6212-checksum = "7cc1186384beb7dd8eedea376413fd654937285ea6c9cfbb928dc3043ea4b606"6147+checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514"
6213 dependencies = [6148 dependencies = [
6214 "getrandom 0.4.3",6149 "getrandom 0.4.3",
6215 "js-sys",6150 "js-sys",
@@ -6371,7 +6306,7 @@ dependencies = [
6371 "bumpalo",6306 "bumpalo",
6372 "proc-macro2",6307 "proc-macro2",
6373 "quote",6308 "quote",
6374- "syn 3.0.8",6309+ "syn 3.0.9",
6375 "wasm-bindgen-shared",6310 "wasm-bindgen-shared",
6376 ]6311 ]
6377 6312
@@ -6871,7 +6806,7 @@ dependencies = [
6871 ]6806 ]
6872 6807
6873 [[package]]6808 [[package]]
6874-name = "wifilab"6809+name = "wifi_lab"
6875 version = "0.1.0"6810 version = "0.1.0"
6876 dependencies = [6811 dependencies = [
6877 "anyhow",6812 "anyhow",
@@ -6883,6 +6818,7 @@ dependencies = [
6883 "gpuikit",6818 "gpuikit",
6884 "hmac 0.12.1",6819 "hmac 0.12.1",
6885 "libc",6820 "libc",
6821+ "md-5",
6886 "notify-rust",6822 "notify-rust",
6887 "pbkdf2 0.13.0",6823 "pbkdf2 0.13.0",
6888 "pollster 0.4.0",6824 "pollster 0.4.0",
@@ -7530,9 +7466,9 @@ dependencies = [
7530 7466
7531 [[package]]7467 [[package]]
7532 name = "yoke"7468 name = "yoke"
7533-version = "0.8.3"7469+version = "0.8.4"
7534 source = "registry+https://github.com/rust-lang/crates.io-index"7470 source = "registry+https://github.com/rust-lang/crates.io-index"
7535-checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"7471+checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3"
7536 dependencies = [7472 dependencies = [
7537 "stable_deref_trait",7473 "stable_deref_trait",
7538 "yoke-derive",7474 "yoke-derive",
@@ -7547,7 +7483,7 @@ checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71"
7547 dependencies = [7483 dependencies = [
7548 "proc-macro2",7484 "proc-macro2",
7549 "quote",7485 "quote",
7550- "syn 3.0.8",7486+ "syn 3.0.9",
7551 "synstructure",7487 "synstructure",
7552 ]7488 ]
7553 7489
@@ -7619,7 +7555,7 @@ dependencies = [
7619 "proc-macro-crate",7555 "proc-macro-crate",
7620 "proc-macro2",7556 "proc-macro2",
7621 "quote",7557 "quote",
7622- "syn 3.0.8",7558+ "syn 3.0.9",
7623 "zbus_names",7559 "zbus_names",
7624 "zvariant",7560 "zvariant",
7625 "zvariant_utils",7561 "zvariant_utils",
@@ -7627,9 +7563,9 @@ dependencies = [
7627 7563
7628 [[package]]7564 [[package]]
7629 name = "zbus_names"7565 name = "zbus_names"
7630-version = "4.3.4"7566+version = "4.3.5"
7631 source = "registry+https://github.com/rust-lang/crates.io-index"7567 source = "registry+https://github.com/rust-lang/crates.io-index"
7632-checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e"7568+checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd"
7633 dependencies = [7569 dependencies = [
7634 "serde",7570 "serde",
7635 "winnow 1.0.4",7571 "winnow 1.0.4",
@@ -7726,18 +7662,18 @@ checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"
7726 7662
7727 [[package]]7663 [[package]]
7728 name = "zerocopy"7664 name = "zerocopy"
7729-version = "0.8.62"7665+version = "0.8.63"
7730 source = "registry+https://github.com/rust-lang/crates.io-index"7666 source = "registry+https://github.com/rust-lang/crates.io-index"
7731-checksum = "86502bf56ac7c77571a32e2647bb2a15894565e981fb2a48d7bde2d91c965a9d"7667+checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8"
7732 dependencies = [7668 dependencies = [
7733 "zerocopy-derive",7669 "zerocopy-derive",
7734 ]7670 ]
7735 7671
7736 [[package]]7672 [[package]]
7737 name = "zerocopy-derive"7673 name = "zerocopy-derive"
7738-version = "0.8.62"7674+version = "0.8.63"
7739 source = "registry+https://github.com/rust-lang/crates.io-index"7675 source = "registry+https://github.com/rust-lang/crates.io-index"
7740-checksum = "5457206954b06561e2608c7e19cf58b1926586d999c246eebe4502f7e2039d1a"7676+checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f"
7741 dependencies = [7677 dependencies = [
7742 "proc-macro2",7678 "proc-macro2",
7743 "quote",7679 "quote",
@@ -7761,7 +7697,7 @@ checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a"
7761 dependencies = [7697 dependencies = [
7762 "proc-macro2",7698 "proc-macro2",
7763 "quote",7699 "quote",
7764- "syn 3.0.8",7700+ "syn 3.0.9",
7765 "synstructure",7701 "synstructure",
7766 ]7702 ]
7767 7703
@@ -7798,9 +7734,9 @@ dependencies = [
7798 7734
7799 [[package]]7735 [[package]]
7800 name = "zerovec"7736 name = "zerovec"
7801-version = "0.11.8"7737+version = "0.11.9"
7802 source = "registry+https://github.com/rust-lang/crates.io-index"7738 source = "registry+https://github.com/rust-lang/crates.io-index"
7803-checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"7739+checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40"
7804 dependencies = [7740 dependencies = [
7805 "yoke",7741 "yoke",
7806 "zerofrom",7742 "zerofrom",
@@ -7809,13 +7745,13 @@ dependencies = [
7809 7745
7810 [[package]]7746 [[package]]
7811 name = "zerovec-derive"7747 name = "zerovec-derive"
7812-version = "0.11.6"7748+version = "0.11.7"
7813 source = "registry+https://github.com/rust-lang/crates.io-index"7749 source = "registry+https://github.com/rust-lang/crates.io-index"
7814-checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"7750+checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a"
7815 dependencies = [7751 dependencies = [
7816 "proc-macro2",7752 "proc-macro2",
7817 "quote",7753 "quote",
7818- "syn 3.0.8",7754+ "syn 3.0.9",
7819 ]7755 ]
7820 7756
7821 [[package]]7757 [[package]]
@@ -7824,18 +7760,6 @@ version = "0.6.8"
7824 source = "registry+https://github.com/rust-lang/crates.io-index"7760 source = "registry+https://github.com/rust-lang/crates.io-index"
7825 checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"7761 checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
7826 7762
7827-[[package]]
7828-name = "zlog-gpui-unofficial"
7829-version = "1.23.2"
7830-source = "registry+https://github.com/rust-lang/crates.io-index"
7831-checksum = "5b525ad57b32e2c03714a93dbb803c9ed70f22c571894b23862c1b824402b78f"
7832-dependencies = [
7833- "anyhow",
7834- "chrono",
7835- "collections-gpui-unofficial",
7836- "log",
7837-]
7838-
7839 [[package]]7763 [[package]]
7840 name = "zmij"7764 name = "zmij"
7841 version = "1.0.23"7765 version = "1.0.23"
@@ -7844,21 +7768,19 @@ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
7844 7768
7845 [[package]]7769 [[package]]
7846 name = "ztracing-gpui-unofficial"7770 name = "ztracing-gpui-unofficial"
7847-version = "1.23.2"7771+version = "1.25.3"
7848 source = "registry+https://github.com/rust-lang/crates.io-index"7772 source = "registry+https://github.com/rust-lang/crates.io-index"
7849-checksum = "3d6a6658e7fd7d698b2ba33afc7c5e431bd5e85a90acef1baf7dbc31aa20a73a"7773+checksum = "c72dc65ba0389a3ea6e98a58b07480c8266a4693ad33b70d275fcd6fbab5f677"
7850 dependencies = [7774 dependencies = [
7851 "tracing",7775 "tracing",
7852- "tracing-subscriber",
7853- "zlog-gpui-unofficial",
7854 "ztracing-macro-gpui-unofficial",7776 "ztracing-macro-gpui-unofficial",
7855 ]7777 ]
7856 7778
7857 [[package]]7779 [[package]]
7858 name = "ztracing-macro-gpui-unofficial"7780 name = "ztracing-macro-gpui-unofficial"
7859-version = "1.23.2"7781+version = "1.25.3"
7860 source = "registry+https://github.com/rust-lang/crates.io-index"7782 source = "registry+https://github.com/rust-lang/crates.io-index"
7861-checksum = "543092cbf6836c0c8d36f3321e35b3a87718dd21c99ca4ff11ae3e82f15e8f1a"7783+checksum = "d6d363c7896499fa637c8adb52dcfbf3cca048787fa743a16a540e66ea9418a8"
7862 7784
7863 [[package]]7785 [[package]]
7864 name = "zune-core"7786 name = "zune-core"
@@ -7886,9 +7808,9 @@ dependencies = [
7886 7808
7887 [[package]]7809 [[package]]
7888 name = "zvariant"7810 name = "zvariant"
7889-version = "5.15.0"7811+version = "5.15.1"
7890 source = "registry+https://github.com/rust-lang/crates.io-index"7812 source = "registry+https://github.com/rust-lang/crates.io-index"
7891-checksum = "c1d34c27cc6cdd1f458427519dd6b8612f7b7e3f7b9a0b2355d041dda9869147"7813+checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7"
7892 dependencies = [7814 dependencies = [
7893 "endi",7815 "endi",
7894 "enumflags2",7816 "enumflags2",
@@ -7902,14 +7824,14 @@ dependencies = [
7902 7824
7903 [[package]]7825 [[package]]
7904 name = "zvariant_derive"7826 name = "zvariant_derive"
7905-version = "5.15.0"7827+version = "5.15.1"
7906 source = "registry+https://github.com/rust-lang/crates.io-index"7828 source = "registry+https://github.com/rust-lang/crates.io-index"
7907-checksum = "864155e69b4352db0c7f374917bf45d1e0c8d17659c8b3dbf9795f3673f8c497"7829+checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d"
7908 dependencies = [7830 dependencies = [
7909 "proc-macro-crate",7831 "proc-macro-crate",
7910 "proc-macro2",7832 "proc-macro2",
7911 "quote",7833 "quote",
7912- "syn 3.0.8",7834+ "syn 3.0.9",
7913 "zvariant_utils",7835 "zvariant_utils",
7914 ]7836 ]
7915 7837
@@ -7922,6 +7844,6 @@ dependencies = [
7922 "proc-macro2",7844 "proc-macro2",
7923 "quote",7845 "quote",
7924 "serde",7846 "serde",
7925- "syn 3.0.8",7847+ "syn 3.0.9",
7926 "winnow 1.0.4",7848 "winnow 1.0.4",
7927 ]7849 ]
Cargo.tomlmodified+2 -1
@@ -19,6 +19,7 @@ pollster = "0.4"
19 sha1 = "0.10"19 sha1 = "0.10"
20 hmac = "0.12"20 hmac = "0.12"
21 pbkdf2 = "0.13"21 pbkdf2 = "0.13"
22+md-5 = "0.10"
22 23
23 # Backend plumbing24 # Backend plumbing
24 crossbeam-channel = "0.5"25 crossbeam-channel = "0.5"
@@ -37,5 +38,5 @@ notify-rust = "4"
37 debug = true38 debug = true
38 39
39 [[bin]]40 [[bin]]
40-name = "wifilab"41+name = "wifi_lab"
41 path = "src/main.rs"42 path = "src/main.rs"
README.mdadded+159 -0
@@ -0,0 +1,159 @@
1+# wifi_lab
2+
3+A WPA/WPA2 lab tool for Linux: scan the air, capture a 4-way handshake
4+or PMKID, crack it on the GPU. Single Rust binary, GPUI interface.
5+
6+Everything in the screenshots below is the built-in mock backend
7+(`--mock`) — fabricated networks, fabricated captures, nothing from a
8+real radio.
9+
10+## Screenshots
11+
12+![Networks page](screenshots/networks.png)
13+
14+The scan view: APs with vendor (IEEE OUI), security, and a signal
15+history; clients below; probe requests at the bottom. The `#1~ (2)`
16+in the client ID column is one physical phone seen under two
17+randomized MACs, paired by IE fingerprint.
18+
19+![Attacks page](screenshots/attacks.png)
20+
21+The target card answers "which button do I press": handshake capture
22+with live M1–M4 progress, targeted/broadcast deauth, clientless PMKID.
23+WPA3 SAE-only targets are dead ends and the buttons say so instead of
24+failing silently.
25+
26+![Cracker page](screenshots/cracker.png)
27+
28+Cracking is a plain UI-process job — no root, no radio, runs while a
29+capture is in flight. Wordlist, hashcat-style rules, hybrid,
30+bruteforce with frequency ordering, and SSID-bound PMK rainbow tables.
31+Live H/s, exact worst-case ETA, resume after a crash.
32+
33+![Log page](screenshots/log.png)
34+
35+## What it does
36+
37+- **Scan** — monitor-mode channel hopper feeding an AP table (OUI
38+ vendor, WPA2/WPA3-transition/OWE security, sortable `FLAGS` risk
39+ column, per-channel activity timeline in fixed-height side-by-side
40+ columns, signal sparklines), a client station
41+ list, and a probe
42+ request feed. Hidden SSIDs get correlated from association requests.
43+- **Device correlation** — pairs the randomized MACs of one physical
44+ device into one ID using ordered-IE fingerprints plus sequence
45+ number / probed-SSID / WPS UUID witnesses.
46+- **Situational alerts** — open/WEP flags, hidden SSIDs, rogue-AP
47+ suspicion (same SSID, different BSSID and security), and foreign
48+ deauth-storm detection.
49+- **Attacks** — parked-channel handshake capture, deauth (targeted or
50+ broadcast), clientless PMKID. Ending a capture also yields *partial*
51+ M2+M3 material when a full M1+M2 pair never completed — labeled
52+ `[partial]` and crackable like a complete capture. Everything the
53+ tool sends is visible in the log.
54+- **Cracker** — GPU (wgpu/Vulkan) with on-device MIC verification
55+ (HMAC-SHA1 / key_ver 2 handshakes; WPA1-TKIP and AES-CMAC targets
56+ run on CPU), CPU fallback. Per-SSID PMK cache and precomputed
57+ rainbow tables skip PBKDF2 entirely on repeat runs.
58+- **Interchange** — exports hashcat `hc22000` (trailing message-pair
59+ field `*00` complete / `*02` partial) and pcap (radiotap spool for
60+ Wireshark); imports `.cap`/`.pcap`/`.hc22000` captures made
61+ elsewhere.
62+- **Persistence** — captures, per-device labels, crack presets, and
63+ resume-after-crash sessions survive restarts (`~/wifi_lab/`). All
64+ writes are crash-safe (tmp file + fsync + rename + directory fsync);
65+ when `HOME` is unset the store falls back to `temp_dir()/wifi_lab`
66+ with a logged warning. An old `~/wifilab` directory is migrated in
67+ place.
68+
69+## How it's put together
70+
71+The UI never needs root. Clicking **Start capture** respawns the same
72+binary as a `pkexec`-elevated worker process (`--privileged-worker`,
73+polkit asks once per session). All radio work — monitor mode, channel
74+hopping, deauth/assoc TX, frame capture — happens in that worker; the
75+two halves exchange JSON lines on stdio. The GPU cracker needs no
76+privilege and runs as a thread in the UI process. On exit the worker
77+stops the radio workers, restores managed mode, and restarts
78+NetworkManager if it stopped it.
79+
80+## Build and run
81+
82+```sh
83+cargo build --release
84+./target/release/wifi_lab
85+```
86+
87+- `--iface wlp144s0` picks the wireless interface (default: first
88+ detected).
89+- `--mock` (or `WIFI_LAB_MOCK=1`) runs the UI against fabricated
90+ events — no device access, no root. This is what development,
91+ CI screenshots and the images above use.
92+- A found password raises a desktop notification in addition to the
93+ in-app banner.
94+- Keyboard: **Ctrl-Q** quits; **Ctrl-1..4** switch the Networks /
95+ Attacks / Cracker / Log pages.
96+
97+CI runs on GitHub Actions (`.github/workflows/ci.yml`): fmt, clippy
98+with `-D warnings`, tests, release build, plus an xvfb-driven
99+`--mock`-mode smoke run on every push and PR against `main`.
100+
101+Headless cracking (no UI, no radio, no root):
102+
103+```sh
104+wifi_lab crack --capture capture.hc22000 --wordlist rockyou.txt
105+wifi_lab crack --capture capture.hc22000 --mode rules --rules best64.rule \
106+ --wordlist rockyou.txt --cpu
107+```
108+
109+Modes: `wordlist` (default), `rules`, `bruteforce` (`--min/--max`,
110+charset chips), plus `--hybrid`. Exit codes: `0` password found
111+(`FOUND: …` on stdout), `1` keyspace exhausted, `2` usage/IO error.
112+
113+## Hardware and platform notes
114+
115+- Linux only. Needs a Wi-Fi card that supports monitor mode; deauth
116+ and PMKID additionally need frame injection. lspci-class drivers
117+ behave differently here — check that your card injects before
118+ blaming the tool.
119+- While NetworkManager is active it pins the card to the connected
120+ channel, so a "scan" sees mostly that one network. The app detects
121+ this at capture start and offers a **Stop NM** button (runs inside
122+ the elevated worker; `systemctl start NetworkManager` restores).
123+- GPU cracking uses Vulkan compute and works headless (e.g. RADV on
124+ AMD). Without an adapter the run transparently falls back to CPU —
125+ the log says which backend is active. The GPU verifies only
126+ HMAC-SHA1 (key_ver 2) handshakes with EAPOL frames of 99..=183
127+ bytes; everything else (WPA1-TKIP key_ver 1, AES-CMAC key_ver 3,
128+ imported captures with longer key-data) cracks on CPU. A backend
129+ failure — GPU device lost, a 30 s dispatch timeout, or a worker
130+ panic — aborts as `crack FAILED (backend): <reason>` and *keeps*
131+ the resume session, instead of misreporting "keyspace exhausted".
132+- WPA3-SAE-only APs have no offline-crackable handshake or PMKID; the
133+ attacks page disables those buttons for them. WPA2/WPA3 transition
134+ APs (PSK AKM present) are crackable as usual.
135+
136+## Files
137+
138+| Path | Contents |
139+| --- | --- |
140+| `~/wifi_lab/captures.jsonl` | every handshake (complete and `[partial]`) and PMKID, restored at startup |
141+| `~/wifi_lab/labels.json` | per-MAC user labels |
142+| `~/wifi_lab/cache/<ssid-hex>.pmk` | per-SSID PMK cache (`wifi_lab-pmk v2` rainbow format, SHA-1 integrity footer) |
143+| `~/wifi_lab/crack-session.json` | resume state (v2: exact raw stream positions), autosaved every ~2 s during a run |
144+| `~/wifi_lab/profiles.json` | cracker presets + recent wordlists |
145+| `~/wifi_lab/spool.pcap` | raw frames (radiotap) of the current capture session |
146+
147+Exports go to `./captures/wifi_lab-<ts>.hc22000` (or wherever you
148+save them) in hashcat `-m 22000` format.
149+
150+## Legal
151+
152+Deauthentication is an active attack: it forcibly disconnects other
153+people's devices. Use this tool only on networks you own or have
154+explicit written permission to test. In most jurisdictions running it
155+against third-party networks is a crime regardless of intent.
156+
157+## License
158+
159+MIT
docs/CONTRACT.mddeleted+0 -678
@@ -1,678 +0,0 @@
1-# wifilab — module contract
2-
3-Single bin crate `wifilab`. All modules live flat under `src/`. Shared domain
4-types are in `src/common.rs` (MacAddr, Security, Akm, AccessPoint, ClientInfo,
5-HandshakeCapture, PmkidCapture, ChannelStat, ProbeInfo, ImportedCapture,
6-Event, Cmd, channel lists). The wire format evolves ADDITIVELY ONLY: new enum
7-variants may be appended (externally-tagged serde, ordering free) and new
8-struct/enum fields must carry `#[serde(default)]` so older records
9-deserialize losslessly (precedent: `ClientInfo.connected`,
10-`Cmd::StartScan.spool`/`fresh_spool`, `AccessPoint.akms`). Never rename,
11-remove, or change the meaning of existing variants/fields.
12-
13-## imported-capture (common.rs)
14-`Event::CaptureImported(ImportedCapture)` carries a capture recovered from an
15-external file (pcap/hc22000 import): `ImportedCapture::Handshake(Box<
16-HandshakeCapture>) | Pmkid(PmkidCapture)`. `store::StoredCapture` stays in
17-store.rs (common must not depend on store); the UI converts at the boundary.
18-Other wire additions: `Event::ChannelStats(Vec<ChannelStat>)` (cumulative
19-per-channel frame/beacon counters), `Event::ProbeObserved(ProbeInfo)` (novel
20-probe request), `Event::DeauthAlert { source, target, count }` (≥10 deauths
21-per (src,dst) pair per 10 s from a source we did not cause),
22-`Event::BenchmarkDone { gpu_hps: Option<f64>, cpu_hps: f64 }`, and
23-`Cmd::DeauthAll { ap, channel, targets, count }` (pin `channel`, blast
24-`count` rounds at each target then one broadcast blast).
25-`AccessPoint.akms` lists the RSN/WPA AKM suites (empty = unknown; deduped
26-in first-seen order); `Akm` labels: Psk→"PSK", Sae→"SAE", Owe→"OWE",
27-FtPsk→"FT-PSK", PskSha256→"PSK-SHA256", OneX→"802.1X", Other(_)→"other".
28-
29-## device-correlation (common.rs)
30-`Event::ClientIdent { mac, group, confidence }`: `mac` was correlated by
31-the scanner into device group `group` (u64, 1-based, process-lifetime
32-stable) — the MAC-randomization pairing: all MACs witnessed on one physical
33-radio share the group id. `IdentConfidence` = `Probable` ("?": ordered-IE
34-fingerprint match only) < `Strong` ("~": fingerprint + shared probed SSID
35-or uninterrupted 802.11 sequence numbers) < `Exact` ("=": WPS UUID-E
36-match). Emitted once per pairing decision (first assignment, or re-entry
37-after the 15-minute scanner-side group TTL). `ClientInfo` gains
38-`ident_group`/`ident_conf` (serde-default mirrors of the last decision).
39-
40-Everything must compile with `cargo check` on stable Rust 1.99, edition 2024.
41-Errors: `anyhow::Result` at module boundaries. No new dependencies beyond
42-`Cargo.toml` (which already includes `notify-rust` for the desktop
43-notification on password found — best-effort, headless/no-D-Bus drops the
44-error). No `unsafe` outside `rawsock.rs`.
45-
46-## radiotap.rs (owner: radio-core)
47-Zero-copy radiotap parser + TX injection header.
48-
49-```rust
50-/// Parsed metadata from an RX radiotap header.
51-pub struct RxMeta {
52- pub rssi_dbm: i8, // antenna signal, 0 if absent
53- pub freq_mhz: u16, // channel frequency, 0 if absent
54-}
55-pub const INJECT_HDR: [u8; 8]; // version 0, pad 0, len 8, present 0
56-/// Parse radiotap; returns (meta, remaining 802.11 frame bytes).
57-/// Returns None if the buffer is not a well-formed radiotap header.
58-pub fn strip(frame: &[u8]) -> Option<(RxMeta, &[u8])>;
59-```
60-Must handle: length bounds, field alignment, present bitmap order
61-(tsft/flags/rate/channel/antenna-signal). Unknown present bits: skip per
62-alignment rules of the known ones; if an unknown extension appears, degrade
63-gracefully (still return header end via it_len).
64-
65-## dot11.rs (owner: radio-core)
66-802.11 MAC frame parsing/building. Zero-copy where possible. Little work on
67-QoS/data frames beyond finding BSSID/STA and EAPOL payloads.
68-
69-```rust
70-pub struct MgmtInfo {
71- pub bssid: MacAddr,
72- pub transmitter: MacAddr, // addr2
73- pub ssid: Option<String>, // None if hidden/zero-len
74- pub channel: Option<u8>, // DS parameter set IE
75- pub security: Security, // from RSN/WPA IEs + capability privacy bit
76- pub akms: Vec<Akm>, // AKM suites from RSN/WPA IE; empty for open/WEP
77-}
78-/// Parse beacon OR probe-response; None for other/broken frames.
79-pub fn parse_beacon_or_probe(f: &[u8]) -> Option<MgmtInfo>;
80-/// Parse probe-request → Some(ssid of probe) — used to discover clients.
81-pub fn parse_probe_req(f: &[u8]) -> Option<(MacAddr /*sta*/, Option<String>)>;
82-/// Association/reassociation request → (station, bssid, ssid).
83-/// ssid None for hidden (empty / NUL-padded SSID IE). Subtype 0 = assoc,
84-/// subtype 1 = reassoc.
85-pub fn parse_assoc_req(f: &[u8]) -> Option<(MacAddr, MacAddr, Option<String>)>;
86-
87-// -- device correlation (MAC-randomization pairing; scanner.rs::GroupBook
88-// consumes these, one event per frame, scanner decides identity) -------
89-/// 12-bit per-transmitter sequence number (bytes 22-24, seq<<4|frag).
90-pub fn seq_of(f: &[u8]) -> Option<u16>;
91-/// Ordered-IE fingerprint: FNV-1a over (tag,len) pairs + full rate-tag
92-/// payloads + vendor-IE OUI+type tuples. The SSID tag's LENGTH is excluded
93-/// (directed vs wildcard probes of one radio must hash equal).
94-pub fn ie_fingerprint(f: &[u8], ie_off: usize) -> Option<u32>;
95-/// WPS UUID-E (vendor IE 00:50:f2:04, attribute 0x1047) if present.
96-pub fn wps_uuid_e(f: &[u8], ie_off: usize) -> Option<[u8; 16]>;
97-
98-pub struct ProbeIdent { pub sta: MacAddr, pub ssid: Option<String>, pub fingerprint: u32, pub uuid: Option<[u8; 16]> }
99-pub struct AssocIdent { pub sta: MacAddr, pub bssid: MacAddr, pub ssid: Option<String>, pub fingerprint: u32, pub uuid: Option<[u8; 16]> }
100-/// Probe request with correlation material; None when the IE chain can't
101-/// be fingerprinted (or it's not a probe request). IEs walk from 24.
102-pub fn parse_probe_ident(f: &[u8]) -> Option<ProbeIdent>;
103-/// Assoc/reassoc with correlation material (same offsets as
104-/// `parse_assoc_req`). Hidden/NUL-padded SSID → None.
105-pub fn parse_assoc_ident(f: &[u8]) -> Option<AssocIdent>;
106-/// Parse deauth/disassoc → (from-ap MacAddr as transmitter, target addr1).
107-pub fn parse_deauth(f: &[u8]) -> Option<(MacAddr, MacAddr)>;
108-/// Extract (bssid, station) that best describes a data frame's endpoints
109-/// using ToDS/FromDS bits. None for mgmt/ctrl frames.
110-pub fn data_endpoints(f: &[u8]) -> Option<(MacAddr, MacAddr)>;
111-/// If frame carries an EAPOL-Key payload (LLC/SNAP 88-8e in data frame),
112-/// return (bssid, station_is_ap_sender, eapol_bytes).
113-pub fn parse_eapol(f: &[u8]) -> Option<(MacAddr, bool, &[u8])>;
114-
115-pub struct EapolKey<'a> {
116- pub key_info: u16, // raw key info field (BE order as on wire)
117- pub key_ver: u8, // bits 0..3 of key_info (descriptor version)
118- pub install: bool, // bit6
119- pub key_ack: bool, // bit7
120- pub key_mic: bool, // bit8
121- pub secure: bool, // bit9
122- pub replay_counter: u64,
123- pub nonce: [u8; 32],
124- pub mic: [u8; 16], // raw mic field (or RSN IE scan for pmkid)
125- pub key_data: &'a [u8], // for PMKID extraction (RSN IE, KDE 00-0f-ac:4)
126- pub raw: &'a [u8], // full eapol frame starting at version byte
127-}
128-/// 1..=4 4way message number derived from flags, 0 if not an EAPOL-Key.
129-pub fn parse_eapol_key(eapol: &[u8]) -> Option<EapolKey<'_>>;
130-pub fn eapol_4way_msg(k: &EapolKey) -> u8; // classic heuristics (M1..M4)
131-
132-// frame builders (return full 802.11 frame, NO radiotap — caller prepends INJECT_HDR)
133-pub fn build_deauth(ap: &MacAddr, target: &MacAddr, reason: u16) -> Vec<u8>;
134-pub fn build_disassoc(ap: &MacAddr, target: &MacAddr, reason: u16) -> Vec<u8>;
135-pub fn build_auth_open(ap: &MacAddr, sta: &MacAddr, seq: u16) -> Vec<u8>;
136-pub fn build_assoc_req(ap: &MacAddr, sta: &MacAddr, ssid: &[u8]) -> Vec<u8>;
137-```
138-Wire details: deauth FC = 0x00c0, assoc FC = 0x0000, auth FC = 0x00b0.
139-Sequence control may be left 0. Duration 314. FCS omitted (driver appends).
140-Unit tests must cover parse↔build roundtrips and the classic 4way M1..M4 flag
141-matrices.
142-
143-AKM parsing (`MgmtInfo.akms`): in the RSN IE body the AKM suite list sits at
144-`8 + 4×pairwise_count` (after version(2) group(4) pairwise_cnt(2)
145-pairwise[4n] akm_cnt(2)); each suite is OUI 00:0f:ac + type byte. Only the
146-type byte is inspected:
147-
148-| type | Akm | label |
149-|------|---------------|--------------|
150-| 1 | `OneX` | 802.1X |
151-| 2 | `Psk` | PSK |
152-| 4 | `FtPsk` | FT-PSK |
153-| 6 | `PskSha256` | PSK-SHA256 |
154-| 8 | `Sae` | SAE |
155-| 18 | `Owe` | OWE |
156-| any other | `Other(t)` | other |
157-
158-The vendor WPA IE (tag 221, OUI+type 00:50:f2:01) implies WPA1, which only
159-ever used PSK key management, so a single `Akm::Psk` is pushed. The
160-`Security` label (WPA3 iff SAE present) is independent of this list. The
161-final list is DEDUPED (first-seen order kept): a mixed WPA+WPA2 AP must
162-not surface `PSK+PSK`.
163-
164-`parse_assoc_req` frame offsets (receivers check `f.len() < ie_off` first):
165-addr1 (bssid) at 4, addr2 (station) at 10; fixed params capability(2) +
166-listen interval(2) at 24; IEs walk from 28 for subtype 0, from 34 for
167-subtype 1 (reassoc inserts the 6-byte current-AP address). SSID IE (tag 0)
168-is taken if non-empty and not NUL-padded.
169-
170-## rawsock.rs (owner: radio-core)
171-Only module allowed to use `unsafe` (libc AF_PACKET).
172-
173-```rust
174-pub struct RawSocket { /* fd + ifindex */ }
175-impl RawSocket {
176- /// AF_PACKET SOCK_RAW ETH_P_ALL bound to ifname. Requires CAP_NET_RAW.
177- pub fn open(ifname: &str) -> std::io::Result<Self>;
178- pub fn ifname(&self) -> String;
179- /// Blocking receive of one L2 frame (radiotap + 802.11 in monitor mode).
180- pub fn recv(&self, buf: &mut [u8]) -> std::io::Result<usize>;
181- /// Transmit an 802.11 frame prefixed with radiotap INJECT_HDR (len arg
182- /// includes the header).
183- pub fn send(&self, frame_with_radiotap: &[u8]) -> std::io::Result<usize>;
184- /// Receive timeout toggle for poll-style loops.
185- pub fn set_timeout(&self, ms: u32) -> std::io::Result<()>;
186-}
187-```
188-Implement with raw `libc` calls (no socket2). Handle EINTR on recv (retry).
189-
190-## iface.rs (owner: attacks)
191-System interface control via `ip`/`iw` subprocess (boring + portable).
192-
193-```rust
194-/// Switch ifname to monitor mode (down → set type monitor → up). Idempotent.
195-pub fn to_monitor(ifname: &str) -> anyhow::Result<()>;
196-pub fn to_managed(ifname: &str) -> anyhow::Result<()>;
197-pub fn set_channel(ifname: &str, ch: u8) -> anyhow::Result<()>;
198-/// Parse `iw dev` for the current channel; Err if not determinable.
199-pub fn current_channel(ifname: &str) -> anyhow::Result<u8>;
200-/// Reload the driver bound to ifname's device (mt76 monitor-TX wedge
201-/// recovery); waits for re-enumeration, leaves the managed vif DOWN.
202-/// Destroys ALL vifs on the phy — recreate the monitor vif afterwards.
203-pub fn reset_driver(ifname: &str) -> anyhow::Result<()>;
204-/// Wireless interfaces present (from /sys/class/net/*/wireless).
205-pub fn list_wifi_ifaces() -> Vec<String>;
206-/// Our own MAC on ifname.
207-pub fn mac_of(ifname: &str) -> anyhow::Result<crate::common::MacAddr>;
208-/// True when running with euid 0; UI surfaces a warning otherwise.
209-pub fn is_root() -> bool;
210-/// Stop NetworkManager (systemctl stop). Requires root.
211-pub fn stop_networkmanager() -> anyhow::Result<()>;
212-/// Start NetworkManager again (systemctl start); best-effort restore on exit.
213-pub fn start_networkmanager() -> anyhow::Result<()>;
214-/// True when the monitor vif `<ifname>mon` no longer exists (post-scan
215-/// restore check: remaining monitor vif → interface left in monitor mode).
216-pub fn monitor_gone(ifname: &str) -> bool;
217-// note: NetworkManager/wpa_supplicant interference is the caller's concern;
218-// expose `kill_interferers()` that runs NM radio off like airmon does NOT —
219-// instead just document required state.
220-```
221-
222-## oui.rs (owner: ui)
223-MAC prefix → vendor lookup backed by CHECKED-IN snapshot files, one line
224-per entry: `HEX|Vendor` (uppercase hex prefix, `|`, vendor name truncated
225-to 32 chars; sorted ascending LC_ALL=C byte order, deduplicated BY PREFIX —
226-first vendor wins for historical re-registrations, e.g. 0001C8, 080030):
227-- `src/data/oui.txt` — MA-L 24-bit (6 hex chars), IEEE MA-L registry
228- (`https://standards-oui.ieee.org/oui/oui.txt`, lines `XX-XX-XX (hex)`)
229-- `src/data/oui28.txt` — MA-M 28-bit (7 hex chars), IEEE MA-M registry
230- (`.../oui28/mam.txt`: base `XX-XX-XX (hex)` line + `(base 16)` range
231- line; key = base<<4 | range-top-nibble)
232-- `src/data/oui36.txt` — MA-S 36-bit (9 hex chars), IEEE MA-S registry
233- (`.../oui36/oui36.txt`, same pairing; key = base<<12 | range-top-12-bits)
234-Refresh by re-downloading and re-normalizing, never hand-edit rows.
235-Lookup is LONGEST-PREFIX-FIRST (MA-S → MA-M → MA-L): the sub-assignment
236-vendors sit under someone else's MA-L base, so specificity wins. Files are
237-compile-time data: `include_str!` + parsed once into sorted `LazyLock`
238-vecs, binary-searched — the binary
239-has no network or runtime-file dependency for lookups, and vendor strings
240-reflect the snapshot date, not live registrations.
241-
242-```rust
243-/// Locally administered = first-byte U/L bit set (mac.0[0] & 0x02): the
244-/// randomized/rotated MACs modern stations send. These have no IEEE vendor;
245-/// the UI shows them as "random", not "unknown".
246-pub fn is_locally_administered(mac: &crate::common::MacAddr) -> bool;
247-/// Vendor for a MAC's prefix (longest-first MA-S → MA-M → MA-L); None for
248-/// locally-administered or unknown prefixes.
249-pub fn lookup(mac: &crate::common::MacAddr) -> Option<&'static str>;
250-```
251-
252-## scanner.rs (owner: attacks)
253-```rust
254-pub struct ScannerConfig {
255- pub ifname: String, pub freqs: Vec<u16>, pub dwell_ms: u32, pub rssi_floor: i8,
256- pub pin: std::sync::Arc<crate::iface::ChannelPin>,
257- /// Monitor interface's own MAC — deauth TX never trips the storm detector.
258- pub own_mac: crate::common::MacAddr,
259- /// BSSIDs of APs being user-deauthed right now (suppressed like own_mac).
260- pub deauth_suppress: std::sync::Arc<std::sync::Mutex<std::collections::HashSet<crate::common::MacAddr>>>,
261- /// Shared pcap spool writer (linktype 127; raw frames WITH radiotap header).
262- pub spool: Option<std::sync::Arc<std::sync::Mutex<crate::pcapout::PcapWriter>>>,
263-}
264-/// Blocking channel-hop passive scan. Sends Event::{ApUpdated,ApLost,
265-/// ClientUpdated,ChannelStats,ProbeObserved,DeauthAlert,Log} into `tx`;
266-/// returns when `stop` flips true.
267-pub fn run(cfg: ScannerConfig, tx: crossbeam_channel::Sender<Event>, stop: std::sync::Arc<std::sync::atomic::AtomicBool>) -> anyhow::Result<()>;
268-```
269-APs expire (ApLost) after 30 s silent; clients after 60 s. Clients learned
270-from data frames + probe requests; an observed deauth/disassoc flags the
271-target `connected=false` (any later frame flips it back). Deduplicate by
272-BSSID; keep best RSSI.
273-
274-New SCANNER behaviors (W2):
275-- **Channel stats**: cumulative per-channel `(frames, beacons)` histogram,
276- attributed by radiotap carrier freq (fallback: last-tuned freq), emitted
277- as ONE `Event::ChannelStats` every 2 s.
278-- **Probe panel**: novel (client, ssid) probe requests emit
279- `Event::ProbeObserved`; repeats within 60 s are deduped (state reaped on
280- the expire pass).
281-- **Hidden SSID / AKM**: assoc/reassoc-req frames (`dot11::parse_assoc_req`)
282- bind client→AP AND fill in an AP's empty ssid (emit-on-change ApUpdated);
283- beacon/probe-resp `MgmtInfo.akms` populate `AccessPoint.akms` (changes are
284- emit-on-change too).
285-- **Device correlation (MAC-randomization pairing)**: probe/assoc frames
286- feed `GroupBook` (fingerprint + WPS UUID-E + probed-SSID set + sequence
287- numbers — the same frame's `dot11::parse_probe_ident`/`parse_assoc_ident`
288- + `seq_of` products). One `Event::ClientIdent { mac, group, confidence }`
289- per pairing decision; groups live 15 min (outliving the 60 s client-row
290- TTL so a rotated MAC that appears after the old row expired still lands
291- in the same group). Key witness rules: UUID-E equal → Exact; fingerprint
292- + shared probed SSID or seq continuation (delta 1..=32 within the 12-bit
293- wrap) → Strong; fingerprint alone → Probable; fingerprint mismatch →
294- never paired (except via UUID-E, which is matched before fingerprints so
295- it survives a chain change). A MAC joins at most one live group and
296- groups never merge post-hoc: a later-arriving bridge fingerprint does
297- not rejoin groups that split early. Pairing runs BEFORE client creation
298- so the creation event already carries `ident_group`/`ident_conf`.
299-- **Foreign-deauth detection**: ≥10 deauth/disassoc frames per
300- (source, target) pair within a 10 s sliding window → one
301- `Event::DeauthAlert`, then a 30 s per-pair cooldown. Frames sourced from
302- `own_mac` or a BSSID in `deauth_suppress` (our own blasts carry the
303- victim AP as transmitter) never count. Window logic is the pure
304- `pub(crate) fn deauth_alert(&mut VecDeque<u64>, now)`.
305-- **Pcap spool**: when `cfg.spool` is set, every raw frame straight off the
306- socket (radiotap included, linktype 127) is appended via the shared
307- writer. The service (service.rs) picks the writer on `Cmd::StartScan`:
308- `fresh_spool` → `pcapout::create` (truncate), else a NEW path →
309- `pcapout::from_path_append`; same path + non-fresh REUSES the open
310- writer. Open failure → one error log, scan runs spool-less. At runtime,
311- 3 consecutive append errors → one `Event::Log("pcap spool disabled: …")`
312- and the spool is latched off for that scan.
313-
314-Service-side `start_scan` runs an injection CANARY (wildcard probes →
315-expect probe responses) before spawning workers: mt76/mt7921e wedges its
316-monitor-TX path silently (send() succeeds, RX healthy, nothing radiates);
317-on failure the service reloads the driver via `iface::reset_driver` and
318-recreates the monitor vif, logging loudly either way. The UI additionally
319-marks deauth targets down optimistically (monitor TX never loops back to
320-the scanner socket) and sweeps client rows silent > 60 s as a backstop for
321-scanner restarts.
322-
323-Service exit hygiene (W2): `Cmd::Deauth`/`Cmd::DeauthAll` workers register
324-their victim BSSIDs in `deauth_suppress` for their lifetime (scanner storm
325-detector suppression). `Cmd::StopNetworkManager` sets a flag; `stop_scan`
326-(and thus the shutdown tail) runs the restore-check — a surviving
327-`<if>mon` vif yields `Event::Error` with the exact `iw dev <if>mon del`
328-fix — and best-effort restarts NetworkManager (`Event::Log` on success)
329-when that flag is set.
330-
331-## handshake.rs (owner: attacks)
332-4-way tracker + hc22000/hashcat-22000 export.
333-```rust
334-pub struct Tracker { /* per (ap,sta) partial state; anonce/snonce/mics */ }
335-impl Tracker {
336- pub fn new() -> Self;
337- /// Feed a parsed EapolKey (+ endpoints + current essid for ap).
338- /// Emits HandshakeProgress events; returns Some(capture) once a crackable
339- /// pair (M1+M2, or M2+M3 with replay check) is complete.
340- pub fn ingest(&mut self, ap: MacAddr, sta: MacAddr, essid: &str,
341- key: &crate::dot11::EapolKey, tx: &crossbeam_channel::Sender<Event>)
342- -> Option<HandshakeCapture>;
343-}
344-/// hashcat -m 22000 WPA-PBKDF2-PMKID+EAPOL line for a handshake (type 02).
345-pub fn handshake_hc22000(h: &HandshakeCapture) -> String;
346-/// hashcat -m 22000 PMKID line (type 01).
347-pub fn pmkid_hc22000(p: &PmkidCapture) -> String;
348-/// Parse one hc22000 line back into a CrackTarget (for loading captures).
349-```
350-M1+M2 must verify replay counters consistent (rc(M2) == rc(M1)) and nonces
351-nonzero. ESSID comes from the last seen beacon for that BSSID — supply param.
352-AP-less ESSID unknown → skip capture (cannot crack without salt).
353-
354-## deauth.rs (owner: attacks)
355-```rust
356-/// Send `count` deauth frames ap→target and target→ap (both directions),
357-/// rate-limited to ~64 pps, plus Event::DeauthSent every 32 frames.
358-/// If target is BROADCAST: broadcast deauth from AP side only.
359-/// `stop` is checked per round and breaks the blast cleanly.
360-/// Returns frames actually sent.
361-pub fn blast(sock: &RawSocket, ap: &MacAddr, target: &MacAddr,
362- count: u32, tx: &crossbeam_channel::Sender<Event>,
363- stop: &std::sync::atomic::AtomicBool) -> anyhow::Result<u64>;
364-pub const REASON_UNSPECIFIED: u16 = 1;
365-pub const REASON_CLASS2: u16 = 6;
366-pub const REASON_CLASS3: u16 = 7;
367-```
368-
369-## pmkid.rs (owner: attacks)
370-```rust
371-/// Clientless PMKID grab: auth (open) + assoc to `ap` impersonating our
372-/// station MAC `sta`, watch the wire for EAPOL M1 carrying RSN PMKID KDE
373-/// (type 00-0f-ac, subtype 4) for ~3 s. Idempotent-ish: single attempt.
374-/// Returns Some(capture) with essid filled from `essid`.
375-pub fn grab(sock: &RawSocket, ap: &MacAddr, sta: &MacAddr, essid: &str)
376- -> anyhow::Result<Option<PmkidCapture>>;
377-```
378-
379-## crypto.rs (owner: cracker) — CPU reference implementation
380-```rust
381-pub enum CrackTarget { Handshake(HandshakeCapture), Pmkid(PmkidCapture) }
382-impl CrackTarget { pub fn essid(&self)->&str; pub fn describe(&self)->String; /* from hc22000 parse */ }
383-pub fn pmk(pass: &[u8], ssid: &[u8]) -> [u8; 32];
384-pub fn ptk(pmk: &[u8; 32], ap: &MacAddr, sta: &MacAddr,
385- anonce: &[u8; 32], snonce: &[u8; 32]) -> [u8; 64]; // PRF-512
386-pub fn mic(ptk: &[u8; 64], eapol: &[u8], key_ver: u8) -> [u8; 16]; // ver1/2: HMAC-SHA1-128; ver3: AES-CMAC
387-pub fn pmkid_hash(pmk: &[u8; 32], ap: &MacAddr, sta: &MacAddr) -> [u8; 16]; // HMAC-SHA1-128("PMK Name", ap||sta)
388-pub fn verify(target: &CrackTarget, pass: &[u8]) -> bool;
389-pub fn parse_hc22000(line: &str) -> anyhow::Result<CrackTarget>;
390-```
391-PRF per 802.11-2016 §12.7.1.2: "Pairwise key expansion" counter loop, A =
392-min(ap,sta)||max(ap,sta), B = min(anonce,snonce)||max(anonce,snonce).
393-MIC: zero bytes 81..97 of the EAPOL frame before hashing. AES-CMAC via
394-hand-rolled AES-128 (no new deps) or constant util — key_ver 3 rare for
395-WPA2-PSK; implement anyway.
396-Tests: RFC 6070 PBKDF2 vectors + roundtrip: build synthetic handshake from
397-known (ssid,pass), verify() == true, tampered pass == false, hc22000
398-export→parse→verify == true.
399-
400-## gpu.rs + pbkdf2.wgsl (owner: cracker)
401-wgpu compute cracker. Must run on Vulkan (radv) headless, fall back to CPU
402-(on `GpuCracker::try_new() -> Option`). FULL-PIPELINE kernel: the shader
403-does per candidate the HMAC key midstates (2 compressions), U1/U2 from
404-host-precomputed padded salt messages, the 4095-iteration chained HMAC
405-loop (registers only), and the verify EPILOGUE on-device (PTK-KCK HMAC +
406-EAPOL MIC compare, or PMKID compare — everything SHA1-family). The host
407-packs raw candidate bytes only (BE u32 words ×16) and reads back a
408-16-byte hit slot per batch — midstate upload + CPU MIC phases were the
409-pipeline's throughput ceiling (effective had run at ~1/3 of kernel-only).
410-Verify messages arrive PRE-PADDED in params (constant per run; padding
411-follows the implicit 64-byte HMAC pad prefix, bitlen = (64+len)*8).
412-Targets with AES-CMAC MIC (key_ver 3), frames < 99 B, or ESSIDs > 51 B
413-are NOT expressible in the shader: `gpu_verifiable()` routes them to
414-cpu_crack even when a GPU adapter exists (attack.rs). Fast path:
415-`create_shader_module_trusted(..., ShaderRuntimeChecks::unchecked())`
416-(static module; the tail guard `idx >= params.n` clamps partial batches).
417-Dispatch buffers + bind group live in a persistent 2-slot pool
418-(`KernelPool`); uploads are zero-copy (native-LE u32 slice, BE hosts fail
419-at compile time). The `pmk_out` entry point (same module) writes PMK rows
420-for the rainbow-table build. Measured on radv (RX 9060 XT, 108 VGPRs,
421-no spills): ~320k H/s effective ≈ kernel-only (was 135–190k pipelined /
422-240k kernel-only before the epilogue; hashcat on the same card: ~1.09
423-MH/s — remaining gap is shader codegen, benchmarked and documented in
424-dev/research; a 2-candidates/thread ILP interleave measured −9% and was
425-rejected: 144 VGPR cost outweighed dual-issue gains).
426-```rust
427-pub struct GpuCracker;
428-impl GpuCracker {
429- /// None when no suitable adapter (caller falls back to cpu::crack).
430- pub fn try_new() -> Option<Self>;
431- pub fn device_name(&self) -> String;
432- /// Stream wordlist (any bytes iterator of \n-trimmed candidates 8..=63),
433- /// batch through the GPU, call `progress(batch_done, hps_estimate)`
434- /// periodically; Some(pass) on MIC match. Honors `stop`.
435- pub fn crack(&self, target: &CrackTarget,
436- words: &mut dyn Iterator<Item = Vec<u8>>,
437- progress: &mut dyn FnMut(u64, f64),
438- stop: &std::sync::Arc<std::sync::atomic::AtomicBool>)
439- -> Option<String>;
440-}
441-/// PMK sink for pure-CPU runs: every tried candidate's PMK is pushed to
442-/// the per-SSID cache (attack.rs supplies it; GPU runs NEVER get one —
443-/// no PMK readback is plumbed through the verify pipeline). The first
444-/// push error logs ONCE via the callback, then the sink self-disables.
445-pub struct CpuPmkSink;
446-impl CpuPmkSink {
447- pub fn new(w: rainbow::TableWriter, log: Box<dyn FnMut(String) + Send>) -> Self;
448- pub fn push(&mut self, pmk: &[u8; 32], word: &[u8]);
449- /// Flush; entries appended by THIS sink.
450- pub fn finish(self) -> std::io::Result<u64>;
451-}
452-/// cache_sink receives (pmk, word) per tried candidate (pure-CPU pmk
453-/// cache population; None anywhere else).
454-pub fn cpu_crack(target: &CrackTarget, words: &mut dyn Iterator<Item = Vec<u8>>,
455- progress: &mut dyn FnMut(u64, f64),
456- stop: &std::sync::Arc<std::sync::atomic::AtomicBool>,
457- cache_sink: Option<&mut CpuPmkSink>) -> Option<String>;
458-```
459-Benchmark note (attack.rs): `benchmark(seconds) -> (Option<f64>, f64)`
460-measures raw PBKDF2 throughput — GPU half batches 4096 fixed words
461-through `pmk_batch_gpu`, CPU half times `crypto::pmk` over 512-word
462-batches; the numbers feed the cracker-page crack-time estimator and
463-`Event::BenchmarkDone`.
464-Kernel algorithm: candidate wire format = password bytes packed BE into
465-16 u32 (zero pad; WPA passphrases ≤ 63 B never spill the HMAC key block).
466-U1/U2 message blocks (salt||INT32BE(1|2), padded) are constant per run
467-and precomputed host-side into params. SHA1 uses hashcat's minimal-op
468-round forms (Ch: `d ^ (b & (c ^ d))`; Maj: `(b & c) ^ (d & (b ^ c))`) and
469-the doubled-step (rotl-2) message schedule for t ≥ 32 — bit-identical,
470-shorter serial depth. t2[3]/t2[4] XOR accumulation is dropped (PMK needs
471-only t2[0..12] bytes). Batch 65536 candidates, workgroup 256 (swept
472-64/128/256; 256 consistently ~2% faster), 30 s dispatch timeout guard.
473-Correctness tests: GPU crack finds planted passphrases (handshake kv2 and
474-PMKID), rejects wrong candidates, PMK rows bit-exact vs crypto::pmk
475-(RFC 6070-anchored), key_ver 3 and >51 B ESSIDs route to CPU. GPU tests
476-run un-ignored; with no adapter they early-return Ok.
477-
478-## wordlist.rs (owner: cracker)
479-```rust
480-/// Streaming iterator over a wordlist file (mmap not required; BufReader),
481-/// yielding trimmed 8..=63-byte candidates, counting progress.
482-pub fn open(path: &std::path::Path) -> anyhow::Result<Box<dyn Iterator<Item = Vec<u8>> + Send>>;
483-```
484-
485-## attack.rs (owner: cracker) — attack modes + UI-side workers
486-Cracking is a **UI-process job, fully independent of the radio/capture
487-state**: candidates and the GPU need no privileges, so no capture
488-start/stop (or even service spawn) precondition exists. The UI selects an
489-`Attack`, `validate()`s it (fail-fast, no zombie run), then `spawn_crack`
490-starts the worker thread and returns its stop flag. Worker event contract
491-(one terminator always): progress via `CrackProgress`, then
492-`CrackFound`+`CrackStopped{found:true}` or `CrackStopped{found:false}`.
493-```rust
494-pub enum Attack { Wordlist(PathBuf), Rules { wordlist: PathBuf, rules: PathBuf },
495- Hybrid { wordlist: PathBuf, charset: Vec<u8>, min: usize, max: usize },
496- Bruteforce { charset: Vec<u8>, min: usize, max: usize, #[serde(default)] freq_order: bool }, Rainbow(PathBuf) }
497-impl Attack { pub fn describe(&self) -> String; pub fn validate(&self) -> anyhow::Result<()>; }
498-/// Charset presets unioned with the custom field (UI chips). SPECIAL is
499-/// only the common symbols; exotic bytes go into the custom field.
500-pub mod charset { pub const LOWER/UPPER/DIGITS/SPECIAL: &[u8]; pub fn compose(...) -> Vec<u8>; }
501-/// Odometer-order charset^len generator, clamped to WPA 8..=63; `space()` = total candidates.
502-/// freq_order permutes the charset by a password-frequency rank literal
503-/// (bijection: space size and seek indices unchanged).
504-pub struct BruteForce;
505-impl BruteForce { pub fn new(charset: Vec<u8>, min: usize, max: usize, freq_order: bool) -> anyhow::Result<Self>; pub fn space(&self) -> u128;
506- /// O(1) jump to candidate index n (little-endian odometer math) — the resume path.
507- pub fn seek(&mut self, n: u64); }
508-/// Hashcat-subset rules (`: l u c C t r d $X ^X [ ] sXY`; spaces separate ops,
509-/// `#` comments, blank lines skipped). Rule outputs outside 8..=63 are
510-/// filtered but STILL CONSUME their flattened index — resume stays exact.
511-pub fn parse_rules(path: &Path) -> anyhow::Result<Vec<Rule>>;
512-pub fn rule_count(path: &Path) -> anyhow::Result<u64>;
513-/// wordlist × rules, WORD-MAJOR/rule-minor: flattened index = word_idx*rules_len
514-/// + rule_idx, so resume is a plain skip_n over the stream.
515-pub struct RuleIter;
516-/// wordlist × append-charset ("hybrid"): word + charset^k for k in min..=max
517-/// (clamped 1..=4), rightmost-fastest odometer; candidates >63 B skipped after
518-/// consuming their index. Flattened index = word_idx*per_word + inner with
519-/// per_word = Σ|charset|^k; total = line_count(wordlist) × per_word (upper bound).
520-pub struct HybridIter;
521-impl HybridIter {
522- pub fn new(words: Box<dyn Iterator<Item = Vec<u8>> + Send>, charset: Vec<u8>, min: usize, max: usize) -> anyhow::Result<Self>;
523- pub fn validate(charset: &[u8], min: usize, max: usize) -> anyhow::Result<()>;
524- pub fn per_word(&self) -> u64;
525- /// Exact flattened-index resume (skip words + prime the odometer).
526- pub fn seek_flat(&mut self, n: u64);
527-}
528-/// Drops candidates covered by the PMK cache consult (a miss proves they
529-/// are not the password); resume indices still refer to the RAW stream.
530-pub struct CacheSkipIter<I: Iterator<Item = Vec<u8>>>;
531-/// Rainbow run: precomputed PMKs, one PTK+MIC compare each, no PBKDF2.
532-pub fn rainbow_crack(target: &CrackTarget, entries: &mut dyn Iterator<Item = ([u8; 32], Vec<u8>)>,
533- progress: &mut dyn FnMut(u64, f64), stop: &Arc<AtomicBool>) -> Option<String>;
534-/// resume_from: skip/seek past that many leading candidates (flattened
535-/// index for rules/hybrid); progress events still count against the FULL
536-/// space (ETA stays meaningful). force_cpu pins the CPU backend and
537-/// DISABLES PMK-cache writes (headless CLI `--cpu`, side-effect-free).
538-/// Wordlist-family runs first consult the per-SSID PMK cache
539-/// (store::cache_file): hit → CrackFound+found-terminator with NO main run;
540-/// miss → Log "pmk cache: N entries, no hit — continuing …" and the main
541-/// iterator is CacheSkipIter-wrapped; unreadable cache → ONE Log, full run.
542-/// Pure-CPU main runs POPULATE the cache (gpu::CpuPmkSink via
543-/// rainbow::append_open); GPU runs never do.
544-pub fn spawn_crack(target_desc: String, target: CrackTarget, attack: Attack, resume_from: u64, tx: Sender<Event>, force_cpu: bool) -> Arc<AtomicBool>;
545-/// Build job: PMK-table from wordlist (GPU when available). Progress via
546-/// RainbowProgress; ALWAYS ends with exactly one RainbowBuilt (entries written).
547-pub fn spawn_rainbow_build(ssid: String, wordlist: PathBuf, out: PathBuf, tx: Sender<Event>) -> Arc<AtomicBool>;
548-/// Measured H/s for the crack-time estimator: GPU batches of 4096 via
549-/// pmk_batch_gpu (None without an adapter), CPU via crypto::pmk loop.
550-pub fn benchmark(seconds: u32) -> (Option<f64>, f64);
551-/// Background benchmark thread; exactly one Event::BenchmarkDone terminator
552-/// (a zeroed one follows the Error on spawn failure). Honors stop between batches.
553-pub fn spawn_benchmark(seconds: u32, tx: Sender<Event>) -> Arc<AtomicBool>;
554-```
555-
556-## rainbow.rs (owner: cracker) — SSID-scoped PMK tables
557-"Rainbow" for WPA: PMK = PBKDF2(pass, essid) is SSID-bound, so a table is
558-reusable for every capture of one SSID. Text format, one entry per line:
559-`# wifilab-pmk v1 ssid=<essid>` header, then `<64-hex-pmk> <pass>`.
560-```rust
561-/// Returns header SSID (None when absent — MUST be refused by the caller
562-/// via check_ssid, PMKs compare-fail silently on the wrong SSID).
563-pub fn open(path: &Path) -> anyhow::Result<(Option<String>, Box<dyn Iterator<Item = ([u8; 32], Vec<u8>)> + Send>)>;
564-/// Fresh table with header; truncates. Parent directories are created
565-/// (the per-SSID cache lives in ~/wifilab/cache/, created on use).
566-pub fn create(path: &Path, ssid: &str) -> anyhow::Result<TableWriter>;
567-/// Per-SSID cache writer: missing/zero-length file → create-with-header;
568-/// existing file → header SSID MUST pass check_ssid (mismatch = Err, the
569-/// table is never poisoned by appends for another SSID), then open append.
570-pub fn append_open(path: &Path, ssid: &str) -> anyhow::Result<TableWriter>;
571-pub fn check_ssid(table_ssid: Option<&str>, target_ssid: &str) -> anyhow::Result<()>;
572-```
573-
574-## store.rs — persistence (labels, captures, session, PMK cache, profiles)
575-PMK cache: `~/wifilab/cache/<ssid-hex>.pmk` (rainbow text format) —
576-`pub fn cache_dir() -> PathBuf` (data_dir()/cache, create_dir_all on use),
577-`pub fn cache_file(ssid: &str) -> PathBuf` (filename = lowercase hex of the
578-SSID bytes + `.pmk`). Profiles: `~/wifilab/profiles.json` —
579-```rust
580-pub struct CrackProfile { pub name: String, pub mode: String, pub wordlist: String, pub rules: Option<String> }
581-pub struct Profiles { pub profiles: Vec<CrackProfile>, pub recent_wordlists: Vec<String> }
582-pub fn load_profiles() -> anyhow::Result<Profiles>; // missing/parse-err -> default (eprintln log, then fresh)
583-pub fn save_profiles(&Profiles) -> anyhow::Result<()>; // tmp+rename
584-pub fn remember_wordlist(&mut Profiles, path: &str); // front-insert dedup, cap 5
585-```
586-
587-## Crack session (store.rs) — resume after stop/crash
588-`~/wifilab/crack-session.json`: `{capture: StoredCapture, attack, done,
589-total}` — autosaved by the UI every ~2 s of progress (atomic tmp+rename,
590-so a crash cannot tear it), finalized on Stop, deleted on found/exhausted,
591-restored at startup and matched back to a loaded capture by value
592-equality. Wordlist/table resume re-opens and skips `done` candidates;
593-bruteforce `seek`s in O(1).
594-```rust
595-pub struct CrackSession { pub capture: StoredCapture, pub attack: Attack, pub done: u64, pub total: Option<u64> }
596-pub fn save_session(&CrackSession) -> anyhow::Result<()>;
597-pub fn load_session() -> anyhow::Result<Option<CrackSession>>;
598-pub fn clear_session() -> anyhow::Result<()>;
599-```
600-
601-## pcapout.rs — libpcap capture-file writer (spool + export)
602-Standard libpcap (DLT) file. Global header and every per-packet record are
603-little-endian; recorded timestamps are wall-clock (`SystemTime`), lengths
604-are `incl_len == orig_len == frame.len()` (spool frames are the raw socket
605-read incl. radiotap header).
606-```rust
607-pub struct PcapWriter { /* BufWriter<File> */ } // flushes on finish() and Drop
608-pub fn create(path: &Path) -> std::io::Result<PcapWriter>; // truncate + global header
609-pub fn from_path_append(path: &Path) -> std::io::Result<PcapWriter>; // existing non-empty file: append, NO header rewrite; missing/empty: like create
610-impl PcapWriter { pub fn append(&mut self, frame: &[u8]) -> std::io::Result<()>; pub fn finish(&mut self) -> std::io::Result<()>; }
611-```
612-Writer field layout (all LE): magic `0xa1b2c3d4`, version 2.4, thiszone 0,
613-sigfigs 0, snaplen 65535, linktype 127 (`DLT_IEEE802_11_RADIO`).
614-
615-## pcapin.rs — capture-file importer
616-`pub fn extract(path: &Path) -> anyhow::Result<Vec<common::ImportedCapture>>`
617-— the headless/CLI-capable entry point used by the UI Import button.
618-Importer guarantees:
619-- Both byte orders of the file magic are accepted (`0xa1b2c3d4` LE,
620- `0xd4c3b2a1` BE); all other magics → error.
621-- Supported linktypes: 127 (`DLT_IEEE802_11_RADIO`, radiotap prefix stripped
622- via `radiotap::strip`; malformed prefixes are skipped and counted) and 105
623- (`DLT_IEEE802_11`, raw 802.11). Any other linktype → error naming the
624- numeric linktype.
625-- Two in-memory passes: (1) beacons/probe-responses → bssid→essid map;
626- (2) EAPOL frames → `parse_eapol` → `parse_eapol_key` → `handshake::Tracker`
627- (progress events drained internally, never surfaced); M1-shaped keys are
628- additionally scanned for PMKID KDEs (`pmkid::extract_pmkid`),
629- yielding `ImportedCapture::Pmkid` with the observed station as `client`.
630-- essid-skip semantics: a capture (handshake or PMKID) whose AP's essid is
631- not resolvable from the file's beacons/probe-responses is uncrackable
632- (essid = PBKDF2 salt) and is skipped; skips are reported via
633- `tracing::warn!`, not in the return value. `extract` therefore returns
634- only crackable captures.
635-`pub(crate) fn frames(path: &Path) -> io::Result<(u32, Vec<Vec<u8>>)>`
636-returns (linktype, frame payloads) after global-header validation; packet
637-records with truncated payload → `UnexpectedEof`.
638-
639-## cli.rs — headless `wifilab crack` subcommand
640-Clap subcommand on the main binary (`src/main.rs` `Commands::Crack`); runs
641-with NO UI, no radio, no root — `--privileged-worker` dispatch stays ahead
642-of it and is untouched. `main.rs` owns the derived `CrackArgs`/`CliMode`
643-clap structs and converts them 1:1 into the owned, clap-free
644-`cli::CliCrack` for testability.
645-```rust
646-pub struct CliCrack { pub capture: String, pub mode: String /* "wordlist"|"rules"|"bruteforce" */,
647- pub wordlist: Option<String>, pub rules: Option<String>, pub min: usize, pub max: usize,
648- pub hybrid: bool, pub lower: bool, pub upper: bool, pub digits: bool, pub special: bool,
649- pub cpu: bool }
650-pub fn run_crack_cli(args: CliCrack, out: &mut dyn std::io::Write) -> i32;
651-```
652-Flags: `--capture` (required hc22000 file), `--mode wordlist|rules|bruteforce`
653-(default wordlist), `--wordlist` (required by wordlist/rules/hybrid),
654-`--rules` (required by rules), `--min 8` / `--max 12`, `--hybrid`
655-(wordlist × append-charset sweep; takes precedence over `--mode`),
656-`--lower/--upper/--digits/--special` charset chips — when ALL chips are
657-false the charset defaults to lower+digits. `--cpu` forces the CPU backend
658-(`spawn_crack(.., force_cpu: true)`).
659-Target rule: the capture file is read as text; each line is tried as
660-`crypto::parse_hc22000(line.strip_prefix("WPA*").unwrap_or(line))` (the
661-hashcat `WPA*` prefix is stripped because parse takes the bare form) and
662-the FIRST parseable line is the target — unparseable lines are skipped
663-silently; none parseable → `error: no crackable WPA* line in <path>` + exit 2.
664-Exit codes: 0 password found (`FOUND: <password>` on the sink), 1 keyspace
665-exhausted, 2 usage/IO error (unreadable capture, no crackable line, missing
666-wordlist-family file, `attack.validate()` failure, engine `Error` event).
667-Progress throttled to one `done/total @ H/s` line per 2 s; engine `Log`
668-lines pass through verbatim.
669-Cache semantics: consult-only intent lives in the ENGINE, not the CLI —
670-wordlist-family runs always CONSULT the per-SSID PMK cache
671-(`store::cache_file`). Writes: `--cpu` (force_cpu) disables the cache sink,
672-so a forced-CPU CLI run is fully side-effect-free. Without `--cpu` on a
673-GPU-less machine the pure-CPU fallback DOES append newly computed PMKs to
674-`~/wifilab/cache` (engine semantics) — later runs of the same SSID benefit.
675-Tests: `cli_crack_finds_fabricated` (fabricated-mic capture crackable by
676-the mock password → wordlist → exit 0, `FOUND:` on the sink; pinned
677-password constant must track ui/cracker.rs `MOCK_PASSWORD`),
678-`cli_crack_missing_files_exit_2` (both usage-error paths).
docs/USAGE.mddeleted+0 -224
@@ -1,224 +0,0 @@
1-# wifilab — usage
2-
3-WPA/WPA2 lab tool: passive scan → capture a 4-way handshake or PMKID →
4-crack it on the GPU (CPU fallback). Single binary, GPUI shell.
5-
6-## Running
7-
8-No terminal privileges needed. Start the app normally:
9-
10-```sh
11-cargo build --release
12-./target/release/wifilab
13-```
14-
15-Privileges are handled by a **privileged service**: the UI itself never
16-needs root and never respawns. The first time you click **Start capture**
17-the app spawns the same binary as a child process with the hidden flag
18-`--privileged-worker` — directly when already root, otherwise through
19-`pkexec`, which pops the system polkit dialog **once per capture
20-session**. All radio work (monitor mode, scanning, deauth, PMKID grab,
21-handshake capture) happens inside that service; the two halves talk JSON
22-lines over the child's stdin/stdout and only distilled events cross the
23-pipe. The GPU cracker needs no privilege and runs as a plain thread in
24-the UI process.
25-
26-- `--iface <name>` picks the wireless interface (default: first detected
27- wireless interface, falling back to `wlp14s0`). The header bar's picker
28- can also switch interfaces while capture is stopped.
29-- `--mock` (or `WIFILAB_MOCK=1`) runs the UI against fabricated events —
30- no device access, for development only.
31-- On startup the tool prints one line: mode, interface, root status.
32- Not root? The badge says *user (service will elevate)* and a toast
33- notes polkit will ask when capture starts — the UI stays fully usable.
34- A dismissed polkit dialog just logs an error; click Start again to
35- retry.
36-
37-**NetworkManager fight:** while NetworkManager is active it pins the card
38-to the connected network's channel — during a scan you will typically see
39-**only that one SSID** (e.g. your connected network) instead of every
40-neighbour. The app detects this at *Start capture*, shows a destructive
41-toast, logs a warning, and offers a **"Stop NM"** button in the header
42-(the request runs inside the elevated service). Restore it afterwards
43-with `systemctl start NetworkManager`. Everything else on the system is
44-left untouched.
45-
46-## Workflow
47-
48-1. **Start capture (monitor)** — switches the interface to monitor mode
49- (creates `<iface>mon` on drivers that can't switch in place) and starts
50- the channel hopper. APs and clients stream into the Networks page.
51-2. Click the target network (e.g. *parafin*) in the AP table — or click a
52- client row to select the (AP, client) pair.
53- The Networks page also shows, per AP/client: OUI vendor (IEEE MA-L/MA-M/
54- MA-S registries; `random` marks a locally-administered address — the
55- [MAC-randomization] norm for modern phones), security detail (AKM
56- suites; the badge refines to `WPA2/3` transition, `WPA3` SAE-only, or
57- `OWE` enhanced-open), and a signal-history sparkline; a per-channel
58- activity strip sits above the AP table; a **Probes** section lists
59- nearby clients' probe requests (hidden SSIDs also get correlated from
60- association requests). Client rows resolve their AP column to the SSID
61- name, and the **ID** column pairs rotated/randomized MACs of one
62- physical radio: `#1~ (2)` = device group 1, two known MACs, `~` = strong
63- witness (`?` fingerprint only, `~` fingerprint + shared probed SSID or
64- uninterrupted sequence numbers, `=` WPS UUID-E). Pairing uses the
65- ordered-IE fingerprint of probe/assoc frames plus those witnesses — see
66- the Log page for pairing decisions. AP rows flag risk at a glance:
67- `weak` on Open/WEP networks, `<hidden>` for cloaked SSIDs, `rogue?` when
68- the same SSID appears on another BSSID with different security. The
69- activity strip above the AP table becomes a scrolling per-channel
70- timeline once traffic accumulates (one column per snapshot, brightest =
71- busiest); a channel hosting ≥4 APs gets a crowded warning — overlapping
72- BSSs eat each other's airtime. A sudden deauth storm from a source that
73- is not us (≥10 frames to one target in 10 s) raises a `DEAUTH STORM`
74- alert.
75-3. **Attacks** page — the top card is a full target briefing, built from
76- everything Networks already knows: BSSID, channel/band, OUI vendor,
77- security badge + AKM suites, signal sparkline, beacon count, material
78- already captured for this AP family, your label, and a bold **advice
79- line** ("deauth a client while capture runs", "no clients mapped — run
80- PMKID first", "SAE-only — dead end", "WPA3 transition — crackable") that
81- answers "which button do I press". The card survives the AP leaving the
82- scan table (a "last scan snapshot" note marks the fallback), so locking
83- onto a host-connected network no longer blanks it. The Stations list
84- shows each mapped station with vendor, ID-pairing chip, RSSI, and
85- whether its AP link is real or assumed.
86- - **Capture Handshake** — parks on the target channel and tracks EAPOL
87- 4-way exchanges; `M1..M4` progress shows live until a crackable
88- M1+M2 pair lands.
89- - **Deauth** — forces a client (the selected one, or broadcast) to
90- re-authenticate so the handshake capture above completes fast. Count
91- comes from the input next to the button. Deauth while capturing is
92- the intended combo: keep both on the same channel (the UI targets a
93- single AP, so this is automatic). When the AP has ≥2 connected
94- clients a **Deauth all clients (N)** button appears: targeted frames
95- at every known client plus one broadcast round.
96- - **PMKID Attack** — clientless: auth+assoc from the monitor
97- interface's own MAC and read the PMKID from the AP's M1. Many APs
98- don't volunteer one — the log tells you either way.
99- - **SAE-only APs** (WPA3 without the PSK AKM) offer no offline-crackable
100- handshake or PMKID — the capture/deauth buttons are disabled for them
101- with an explanation. WPA2/WPA3 transition APs (PSK AKM present) are
102- crackable as usual.
103- - **Export .hc22000** — writes every capture in hashcat 22000 format.
104- - **Export .pcap** — copies the session's raw-frame spool
105- (`~/wifilab/spool.pcap`, radiotap linktype, truncated on each Start
106- capture) for Wireshark.
107-4. **Cracker** page — pick the capture, the attack mode, hit **Start**.
108- Cracking is a plain UI-process job (GPU + wordlist need neither root
109- nor the radio), so it runs while capturing, before ever capturing, or
110- after a restart (captures are persisted and restored). Modes:
111- - **wordlist** — dictionary run; point the field at a wordlist file
112- (e.g. rockyou; note it is NOT preinstalled — download/choose a real
113- path, the page refuses to start on a path it cannot open).
114- - **rules** — dictionary × mangling rules (hashcat-subset:
115- `l u c C t r d $X ^X [ ] sXY`, multi-op lines, `#` comments): the
116- classic human-password crack that plain wordlists miss. Resume
117- continues at the flattened word×rule index.
118- - **hybrid** — wordlist × append sweep: every word gets every suffix
119- of 1..4 characters from the charset chips (human pattern
120- "summer2024"), clamped to WPA's 63 bytes.
121- - **bruteforce** — exhaustive `charset^len` sweep over the given
122- min..max lengths (clamped to WPA's 8..63). The charset is the union
123- of the checked preset chips (a-z, A-Z, 0-9, common specials) and the
124- custom-chars field. Grows combinatorially — the status row shows
125- the exact total and the worst-case ETA. The **freq-order** chip
126- (default on) tries most-common password characters first (same
127- space, better early-hit odds).
128- - **rainbow** — a precomputed PMK table for the capture's SSID: no
129- PBKDF2 at run time, one MIC compare per entry (millions/s). Build
130- one from any wordlist with **Build table** (pays PBKDF2 once, GPU
131- when available); reuse it for every later capture of that SSID.
132- Tables are salt-bound to the SSID — a table for another SSID is
133- refused up front, not silently exhausted.
134- Live H/s and candidate count stream in, with a throughput curve (one
135- bar per progress sample), a coverage progress bar with exact percentage
136- whenever the worker knows the worst-case total, and a worst-case ETA
137- (every untried candidate at the current rate — wordlist/table line
138- counts are upper bounds, brute force is exact). A **recent captures**
139- block lists the newest crackable targets so you can see what material
140- you have without opening the dropdown. The recent-activity block on
141- the page mirrors cracker/rainbow log lines (including failures).
142- **Stop** flips the job's stop flag and the worker exits
143- at the next batch.
144-
145- **PMK cache** — wordlist-family runs first blast through a per-SSID
146- cache of already-computed PMKs (`~/wifilab/cache/<ssid-hex>.pmk`,
147- rainbow format — one MIC compare per entry) and skip those candidates
148- in the main run. Pure-CPU runs APPEND their PMKs to the cache (GPU
149- runs cannot — the verify pipeline has no PMK readback). A cache for a
150- different SSID is never used.
151-
152- **Presets & recents** — the row above the target picker saves the
153- current mode+paths as a named chip and re-applies them later; the last
154- five wordlists are one click away (`~/wifilab/profiles.json`).
155-
156- **Import** — `Import .cap/.pcap/.hc22000` brings in captures made
157- elsewhere: pcap files (radiotap or raw 802.11) are scanned for
158- beacons + EAPOL exchanges and PMKIDs; hc22000 files are parsed line
159- by line. Everything importable lands in the target picker.
160-
161- **Benchmark & estimator** — `Benchmark (3s)` measures this machine's
162- GPU and CPU hash rate. The estimator card then converts any candidate
163- or attack configuration into worst-case crack times (log lines
164- prefixed `estimate:`); without a benchmark it shows candidate-space
165- math only.
166-
167- A found password raises a desktop notification (best-effort; silently
168- no-ops headless) on top of the in-app banner and toast.
169-
170- **Resume:** an interrupted run autosaves its position to
171- `~/wifilab/crack-session.json` every couple of seconds (and once on
172- Stop) — crash, power cut, or closing the window loses at most ~2 s
173- of work. On the next start the page shows a "saved run" banner with
174- **Resume** (wordlist/table re-open and skip forward, brute force
175- seeks the odometer in O(1); progress and ETA keep counting against
176- the full space) and **Discard**. A found password or an exhausted
177- space deletes the session instead.
178-5. Everything the service (and the crack thread) does is mirrored on the
179- **Log** page, including worker errors (permissions, channel-change
180- failures, wordlist open failures). During a scan a compact
181- `scan: N rx frames, M beacons -> K APs live (ch C)` heartbeat lands
182- every 10 s — the evidence line distinguishing RX-silence from parser
183- drops.
184-
185-On exit (window close) the service is told to shut down: it stops all
186-radio workers, restores the interface to managed mode (deleting the
187-`<iface>mon` vif if one was created), restarts NetworkManager if it was
188-stopped this session, and exits; the UI-side crack thread is stopped as
189-well. The restore is verified: if the monitor vif survives, the log
190-carries the exact manual recovery command (`sudo iw dev <if>mon del`).
191-
192-## Headless CLI
193-
194-`wifilab crack --capture capture.hc22000 --wordlist rockyou.txt` runs the
195-same engine with no UI, no radio, no root: first crackable `WPA*` line of
196-the capture file is the target; modes `--mode wordlist|rules|bruteforce`
197-plus `--rules`, `--hybrid`, `--min/--max`, charset chips, and `--cpu`
198-(force CPU; also fully side-effect-free — no PMK-cache appends). Exit
199-codes: 0 password found (`FOUND: …`), 1 space exhausted, 2 usage/io
200-error. Consults the per-SSID PMK cache like the UI does.
201-
202-## Cracking backends
203-
204-The cracker prefers the GPU (wgpu/Vulkan compute; works headless, e.g.
205-radv). `GpuCracker::try_new()` returns `None` when no suitable adapter
206-exists and the run transparently falls back to the CPU reference cracker —
207-the log line says which backend is active. WPA passphrases 8..63 bytes;
208-wordlist lines are trimmed/streamed, huge files are fine. Rainbow runs
209-use precomputed PMKs and skip PBKDF2 entirely (the GPU is then only used
210-for the one-time build).
211-
212-## Files
213-
214-- Captures export to `./captures/wifilab-<ts>.hc22000` (or the path chosen
215- in the save dialog) in hashcat `-m 22000` format — one `WPA*02` line per
216- handshake, one `WPA*01` line per PMKID. Export .pcap copies the spool
217- instead.
218-- `~/wifilab/spool.pcap` — raw frames (radiotap) of the current capture
219- session, written by the service; truncated on each Start capture.
220-- `~/wifilab/cache/<ssid-hex>.pmk` — per-SSID PMK cache (rainbow format),
221- consulted by every wordlist-family run; appended by pure-CPU runs.
222-- `~/wifilab/profiles.json` — cracker presets + recent wordlists.
223-- `~/wifilab/captures.jsonl`, `labels.json`, `crack-session.json` — as
224- before (captures, per-MAC labels, resume state).
screenshots/attacks.pngadded+0 -0

Binary file changed

screenshots/cracker.pngadded+0 -0

Binary file changed

screenshots/log.pngadded+0 -0

Binary file changed

screenshots/networks.pngadded+0 -0

Binary file changed

src/attack.rsmodified+1079 -235
@@ -6,13 +6,15 @@
6 //! table ([`crate::rainbow`]) skips PBKDF2 entirely and checks precomputed6 //! table ([`crate::rainbow`]) skips PBKDF2 entirely and checks precomputed
7 //! PMKs with one PTK derivation + MIC compare each.7 //! PMKs with one PTK derivation + MIC compare each.
8 //!8 //!
9-//! Worker contract (unchanged from the old service-coupled cracker):9+//! Worker contract: progress via `CrackProgress` (its `done` is an exact
10-//! progress via `CrackProgress`, then exactly one terminator —10+//! RAW stream position — the session v2 resume index, see [`RawPosIter`]),
11-//! `CrackFound` + `CrackStopped { found: true }` on success,11+//! then exactly one terminator — `CrackFound` + `CrackStopped { found:
12-//! `CrackStopped { found: false }` on stop, exhaustion, or setup failure.12+//! true }` on success, `CrackStopped { found: false }` on stop,
13-//! The rainbow *builder* job reports `RainbowProgress` and always ends13+//! exhaustion, or setup failure, `CrackError { reason }` on backend
14-//! with one `RainbowBuilt` (entries written so far; errors precede it as14+//! failure (GPU device lost / dispatch timeout / worker panic: NOT
15-//! `Error` events).15+//! exhaustion; the resume session is left in place). The rainbow *builder*
16+//! job reports `RainbowProgress` and always ends with one `RainbowBuilt`
17+//! (entries written so far; errors precede it as `Error` events).
16 18
17 use std::collections::HashSet;19 use std::collections::HashSet;
18 use std::path::{Path, PathBuf};20 use std::path::{Path, PathBuf};
@@ -40,7 +42,12 @@ pub enum Attack {
40 /// Dictionary × mutation rules (hashcat-subset ops, see [`parse_rules`]).42 /// Dictionary × mutation rules (hashcat-subset ops, see [`parse_rules`]).
41 Rules { wordlist: PathBuf, rules: PathBuf },43 Rules { wordlist: PathBuf, rules: PathBuf },
42 /// Dictionary × append-charset sweep: `word + charset^k` for k in `min..=max`.44 /// Dictionary × append-charset sweep: `word + charset^k` for k in `min..=max`.
43- Hybrid { wordlist: PathBuf, charset: Vec<u8>, min: usize, max: usize },45+ Hybrid {
46+ wordlist: PathBuf,
47+ charset: Vec<u8>,
48+ min: usize,
49+ max: usize,
50+ },
44 /// Exhaustive `charset^len` sweep for len in `min..=max` through PBKDF2.51 /// Exhaustive `charset^len` sweep for len in `min..=max` through PBKDF2.
45 /// `freq_order` permutes the charset most-common-first (a bijection —52 /// `freq_order` permutes the charset most-common-first (a bijection —
46 /// space size and seek indices are unchanged).53 /// space size and seek indices are unchanged).
@@ -63,12 +70,22 @@ impl Attack {
63 Attack::Rules { wordlist, rules } => {70 Attack::Rules { wordlist, rules } => {
64 format!("rules {} × {}", wordlist.display(), rules.display())71 format!("rules {} × {}", wordlist.display(), rules.display())
65 }72 }
66- Attack::Hybrid { wordlist, charset, min, max } => format!(73+ Attack::Hybrid {
74+ wordlist,
75+ charset,
76+ min,
77+ max,
78+ } => format!(
67 "hybrid {} + charset({} bytes) suffix len {min}..={max}",79 "hybrid {} + charset({} bytes) suffix len {min}..={max}",
68 wordlist.display(),80 wordlist.display(),
69 charset.len()81 charset.len()
70 ),82 ),
71- Attack::Bruteforce { charset, min, max, freq_order } => format!(83+ Attack::Bruteforce {
84+ charset,
85+ min,
86+ max,
87+ freq_order,
88+ } => format!(
72 "bruteforce charset({} bytes, {:?}…{}) len {min}..={max}",89 "bruteforce charset({} bytes, {:?}…{}) len {min}..={max}",
73 charset.len(),90 charset.len(),
74 String::from_utf8_lossy(&charset[..charset.len().min(16)]),91 String::from_utf8_lossy(&charset[..charset.len().min(16)]),
@@ -95,12 +112,22 @@ impl Attack {
95 bail!("rules file {} has no rules", rules.display());112 bail!("rules file {} has no rules", rules.display());
96 }113 }
97 }114 }
98- Attack::Hybrid { wordlist, charset, min, max } => {115+ Attack::Hybrid {
116+ wordlist,
117+ charset,
118+ min,
119+ max,
120+ } => {
99 std::fs::File::open(wordlist)121 std::fs::File::open(wordlist)
100 .with_context(|| format!("cannot open wordlist {}", wordlist.display()))?;122 .with_context(|| format!("cannot open wordlist {}", wordlist.display()))?;
101 HybridIter::validate(charset, *min, *max)?;123 HybridIter::validate(charset, *min, *max)?;
102 }124 }
103- Attack::Bruteforce { charset, min, max, freq_order } => {125+ Attack::Bruteforce {
126+ charset,
127+ min,
128+ max,
129+ freq_order,
130+ } => {
104 BruteForce::new(charset.clone(), *min, *max, *freq_order).map(|_| ())?;131 BruteForce::new(charset.clone(), *min, *max, *freq_order).map(|_| ())?;
105 }132 }
106 Attack::Rainbow(p) => {133 Attack::Rainbow(p) => {
@@ -127,7 +154,13 @@ pub mod charset {
127 pub const SPECIAL: &[u8] = b"!@#$%^&*()-_=+[]{};:,.<>/?";154 pub const SPECIAL: &[u8] = b"!@#$%^&*()-_=+[]{};:,.<>/?";
128 155
129 /// Union of the selected presets + `custom`, deduplicated.156 /// Union of the selected presets + `custom`, deduplicated.
130- pub fn compose(lower: bool, upper: bool, digits: bool, special: bool, custom: &[u8]) -> Vec<u8> {157+ pub fn compose(
158+ lower: bool,
159+ upper: bool,
160+ digits: bool,
161+ special: bool,
162+ custom: &[u8],
163+ ) -> Vec<u8> {
131 let mut out = Vec::new();164 let mut out = Vec::new();
132 for src in [165 for src in [
133 (lower, LOWER),166 (lower, LOWER),
@@ -170,6 +203,9 @@ pub struct BruteForce {
170 /// Odometer digits (indices into charset), same length as the word.203 /// Odometer digits (indices into charset), same length as the word.
171 idx: Vec<usize>,204 idx: Vec<usize>,
172 exhausted: bool,205 exhausted: bool,
206+ /// Candidates yielded so far = raw stream position (the resume seek
207+ /// index of the next unyielded candidate). [`BruteForce::seek`] sets it.
208+ pos: u64,
173 }209 }
174 210
175 impl BruteForce {211 impl BruteForce {
@@ -178,7 +214,12 @@ impl BruteForce {
178 pub fn new(charset: Vec<u8>, min: usize, max: usize, freq_order: bool) -> Result<Self> {214 pub fn new(charset: Vec<u8>, min: usize, max: usize, freq_order: bool) -> Result<Self> {
179 let mut charset = charset;215 let mut charset = charset;
180 if freq_order {216 if freq_order {
181- let rank = |b: u8| FREQ_ORDER.iter().position(|&c| c == b).unwrap_or(usize::MAX);217+ let rank = |b: u8| {
218+ FREQ_ORDER
219+ .iter()
220+ .position(|&c| c == b)
221+ .unwrap_or(usize::MAX)
222+ };
182 charset.sort_by_key(|&b| (rank(b), b));223 charset.sort_by_key(|&b| (rank(b), b));
183 charset.dedup();224 charset.dedup();
184 } else {225 } else {
@@ -202,6 +243,7 @@ impl BruteForce {
202 max_len: hi,243 max_len: hi,
203 idx: vec![0; lo],244 idx: vec![0; lo],
204 exhausted: false,245 exhausted: false,
246+ pos: 0,
205 })247 })
206 }248 }
207 249
@@ -229,6 +271,7 @@ impl BruteForce {
229 }271 }
230 if len == self.max_len && rem >= base.pow(len as u32) {272 if len == self.max_len && rem >= base.pow(len as u32) {
231 self.exhausted = true;273 self.exhausted = true;
274+ self.pos = n;
232 return;275 return;
233 }276 }
234 // Odometer order: right-most digit cycles fastest → `rem` is the277 // Odometer order: right-most digit cycles fastest → `rem` is the
@@ -240,6 +283,13 @@ impl BruteForce {
240 rem /= base;283 rem /= base;
241 }284 }
242 self.exhausted = false;285 self.exhausted = false;
286+ self.pos = n;
287+ }
288+}
289+
290+impl RawPosIter for BruteForce {
291+ fn raw_pos(&self) -> u64 {
292+ self.pos
243 }293 }
244 }294 }
245 295
@@ -251,6 +301,7 @@ impl Iterator for BruteForce {
251 return None;301 return None;
252 }302 }
253 let word: Vec<u8> = self.idx.iter().map(|&d| self.charset[d]).collect();303 let word: Vec<u8> = self.idx.iter().map(|&d| self.charset[d]).collect();
304+ self.pos += 1;
254 // Advance the odometer; carry beyond the left-most digit either305 // Advance the odometer; carry beyond the left-most digit either
255 // grows the word length or exhausts the space.306 // grows the word length or exhausts the space.
256 let mut pos = self.idx.len();307 let mut pos = self.idx.len();
@@ -275,6 +326,122 @@ impl Iterator for BruteForce {
275 }326 }
276 }327 }
277 328
329+// ---------------------------------------------------------------------------
330+// Raw stream positions (exact resume, session format v2)
331+// ---------------------------------------------------------------------------
332+
333+/// Candidate iterators that know their exact RAW stream position: the
334+/// index of the next unyielded candidate in the addressing scheme the
335+/// mode's resume seek uses (flattened index for rules/hybrid, plain
336+/// candidate number otherwise). Raw positions count EVERY slot —
337+/// candidates filtered out below (rules/hybrid length rejects) or skipped
338+/// above ([`CacheSkipIter`]) consume raw positions too. This makes a saved
339+/// position an exact resume point that is INDEPENDENT of the PMK cache's
340+/// contents: a mutated cache changes which candidates get skipped, never
341+/// the addressing.
342+trait RawPosIter: Iterator<Item = Vec<u8>> {
343+ /// Raw index of the NEXT unyielded candidate (absolute — seek
344+ /// functions preset it, so `raw_pos() - yields_since_seek` is not
345+ /// meaningful; use the value directly).
346+ fn raw_pos(&self) -> u64;
347+}
348+
349+impl RawPosIter for Box<dyn RawPosIter> {
350+ fn raw_pos(&self) -> u64 {
351+ (**self).raw_pos()
352+ }
353+}
354+
355+/// Adds raw (yield-)positions to any plain `Vec<u8>` candidate stream
356+/// whose resume is a plain `skip_n` (wordlist files, arcane tables: their
357+/// stream addressing already IS the yield sequence). `at` is the absolute
358+/// position of the next yield (resume offset).
359+struct CountIter<I: Iterator<Item = Vec<u8>>> {
360+ inner: I,
361+ pos: u64,
362+}
363+
364+impl<I: Iterator<Item = Vec<u8>>> CountIter<I> {
365+ fn at(inner: I, pos: u64) -> Self {
366+ CountIter { inner, pos }
367+ }
368+}
369+
370+impl<I: Iterator<Item = Vec<u8>>> Iterator for CountIter<I> {
371+ type Item = Vec<u8>;
372+
373+ fn next(&mut self) -> Option<Vec<u8>> {
374+ let out = self.inner.next()?;
375+ self.pos += 1;
376+ Some(out)
377+ }
378+}
379+
380+impl<I: Iterator<Item = Vec<u8>>> RawPosIter for CountIter<I> {
381+ fn raw_pos(&self) -> u64 {
382+ self.pos
383+ }
384+}
385+
386+/// FIFO of raw positions: one entry per candidate DELIVERED to the crack
387+/// backend (post-cache-skip), popped once the backend confirms processing
388+/// via a progress tick. The pop count aligns with the progress event's
389+/// cumulative `done`, mapping it to an exact raw position. Bounded by the
390+/// backend's in-flight window (≤ a couple of batches).
391+type PosMap = std::rc::Rc<std::cell::RefCell<std::collections::VecDeque<u64>>>;
392+
393+/// Wraps the final (post-cache-skip) stream delivered to a crack backend
394+/// and records the raw position after each yield for [`PosMap`].
395+struct PosFeed {
396+ inner: Box<dyn RawPosIter>,
397+ map: PosMap,
398+}
399+
400+impl PosFeed {
401+ fn new(inner: Box<dyn RawPosIter>) -> (PosFeed, PosMap) {
402+ let map: PosMap = Default::default();
403+ (
404+ PosFeed {
405+ inner,
406+ map: map.clone(),
407+ },
408+ map,
409+ )
410+ }
411+}
412+
413+impl Iterator for PosFeed {
414+ type Item = Vec<u8>;
415+
416+ fn next(&mut self) -> Option<Vec<u8>> {
417+ let out = self.inner.next()?;
418+ let raw = self.inner.raw_pos();
419+ self.map.borrow_mut().push_back(raw);
420+ Some(out)
421+ }
422+}
423+
424+/// Translate a backend progress count (`done` = candidates processed so
425+/// far THIS run) into the absolute raw position of the last processed
426+/// candidate, popping confirmed entries out of `map`. Returns `None` when
427+/// the map underflows (a found-candidate early return, or a partial batch
428+/// the backend never counted — in both cases the last known position is
429+/// still the last reported one).
430+fn raw_position_of(map: &PosMap, acked: &mut u64, done: u64) -> Option<u64> {
431+ let mut raw = None;
432+ let mut dq = map.borrow_mut();
433+ while *acked < done {
434+ match dq.pop_front() {
435+ Some(p) => {
436+ raw = Some(p);
437+ *acked += 1;
438+ }
439+ None => break,
440+ }
441+ }
442+ raw
443+}
444+
278 // ---------------------------------------------------------------------------445 // ---------------------------------------------------------------------------
279 // Mutation rules (hashcat-subset) — wordlist × rules attack446 // Mutation rules (hashcat-subset) — wordlist × rules attack
280 // ---------------------------------------------------------------------------447 // ---------------------------------------------------------------------------
@@ -309,52 +476,52 @@ fn apply_rule(ops: &Rule, word: &[u8]) -> Option<Vec<u8>> {
309 let mut w = word.to_vec();476 let mut w = word.to_vec();
310 for op in ops {477 for op in ops {
311 match op {478 match op {
312- Op::Noop => {}479+ Op::Noop => {}
313- Op::Lower => w.make_ascii_lowercase(),480+ Op::Lower => w.make_ascii_lowercase(),
314- Op::Upper => w.make_ascii_uppercase(),481+ Op::Upper => w.make_ascii_uppercase(),
315- Op::Capitalize => {482+ Op::Capitalize => {
316- w.make_ascii_lowercase();483+ w.make_ascii_lowercase();
317- if let Some(first) = w.first_mut() {484+ if let Some(first) = w.first_mut() {
318- first.make_ascii_uppercase();485+ first.make_ascii_uppercase();
486+ }
319 }487 }
320- }488+ Op::InvertCapitalize => {
321- Op::InvertCapitalize => {489+ w.make_ascii_uppercase();
322- w.make_ascii_uppercase();490+ if let Some(first) = w.first_mut() {
323- if let Some(first) = w.first_mut() {491+ first.make_ascii_lowercase();
324- first.make_ascii_lowercase();492+ }
325 }493 }
326- }494+ Op::Toggle => {
327- Op::Toggle => {495+ for b in &mut w {
328- for b in &mut w {496+ if b.is_ascii_lowercase() {
329- if b.is_ascii_lowercase() {497+ *b = b.to_ascii_uppercase();
330- *b = b.to_ascii_uppercase();498+ } else if b.is_ascii_uppercase() {
331- } else if b.is_ascii_uppercase() {499+ *b = b.to_ascii_lowercase();
332- *b = b.to_ascii_lowercase();500+ }
333 }501 }
334 }502 }
335- }503+ Op::Reverse => w.reverse(),
336- Op::Reverse => w.reverse(),504+ Op::Duplicate => {
337- Op::Duplicate => {505+ let tail = w.clone();
338- let tail = w.clone();506+ w.extend_from_slice(&tail);
339- w.extend_from_slice(&tail);
340- }
341- Op::Append(b) => w.push(*b),
342- Op::Prepend(b) => w.insert(0, *b),
343- Op::DeleteFirst => {
344- if !w.is_empty() {
345- w.remove(0);
346 }507 }
347- }508+ Op::Append(b) => w.push(*b),
348- Op::DeleteLast => {509+ Op::Prepend(b) => w.insert(0, *b),
349- w.pop();510+ Op::DeleteFirst => {
350- }511+ if !w.is_empty() {
351- Op::Replace(x, y) => {512+ w.remove(0);
352- for b in &mut w {513+ }
353- if b == x {514+ }
354- *b = *y;515+ Op::DeleteLast => {
516+ w.pop();
517+ }
518+ Op::Replace(x, y) => {
519+ for b in &mut w {
520+ if b == x {
521+ *b = *y;
522+ }
355 }523 }
356 }524 }
357- }
358 }525 }
359 }526 }
360 (8..=63).contains(&w.len()).then_some(w)527 (8..=63).contains(&w.len()).then_some(w)
@@ -390,19 +557,31 @@ fn parse_rule_line(line: &[u8], lineno: usize) -> Result<Rule> {
390 bail!("rules line {lineno}: `{c}` at column {i} is missing its character");557 bail!("rules line {lineno}: `{c}` at column {i} is missing its character");
391 };558 };
392 i += 1;559 i += 1;
393- if c == b'$' { Op::Append(lit) } else { Op::Prepend(lit) }560+ if c == b'$' {
561+ Op::Append(lit)
562+ } else {
563+ Op::Prepend(lit)
564+ }
394 }565 }
395 b's' => {566 b's' => {
396 let Some(&x) = line.get(i) else {567 let Some(&x) = line.get(i) else {
397- bail!("rules line {lineno}: `s` at column {i} is missing its replacement chars");568+ bail!(
569+ "rules line {lineno}: `s` at column {i} is missing its replacement chars"
570+ );
398 };571 };
399 let Some(&y) = line.get(i + 1) else {572 let Some(&y) = line.get(i + 1) else {
400- bail!("rules line {lineno}: `s` at column {i} is missing its replacement chars");573+ bail!(
574+ "rules line {lineno}: `s` at column {i} is missing its replacement chars"
575+ );
401 };576 };
402 i += 2;577 i += 2;
403 Op::Replace(x, y)578 Op::Replace(x, y)
404 }579 }
405- _ => bail!("rules line {lineno}: unsupported op `{}` (column {})", c as char, i - 1),580+ _ => bail!(
581+ "rules line {lineno}: unsupported op `{}` (column {})",
582+ c as char,
583+ i - 1
584+ ),
406 };585 };
407 ops.push(op);586 ops.push(op);
408 }587 }
@@ -471,15 +650,57 @@ pub struct RuleIter {
471 rules: Rc<Vec<Rule>>,650 rules: Rc<Vec<Rule>>,
472 cur: Option<Vec<u8>>,651 cur: Option<Vec<u8>>,
473 ri: usize,652 ri: usize,
653+ /// Flattened slots consumed so far (`word_idx * rules_len + ri`,
654+ /// absolute): the resume seek index of the next unconsumed slot.
655+ flat: u64,
474 }656 }
475 657
476 impl RuleIter {658 impl RuleIter {
477 pub fn new(words: Box<dyn Iterator<Item = Vec<u8>> + Send>, rules: Rc<Vec<Rule>>) -> Self {659 pub fn new(words: Box<dyn Iterator<Item = Vec<u8>> + Send>, rules: Rc<Vec<Rule>>) -> Self {
478 if rules.is_empty() {660 if rules.is_empty() {
479 // Degenerate case: keep the stream empty rather than panic.661 // Degenerate case: keep the stream empty rather than panic.
480- return RuleIter { words: Box::new(std::iter::empty()), rules, cur: None, ri: 0 };662+ return RuleIter {
663+ words: Box::new(std::iter::empty()),
664+ rules,
665+ cur: None,
666+ ri: 0,
667+ flat: 0,
668+ };
669+ }
670+ RuleIter {
671+ words,
672+ rules,
673+ cur: None,
674+ ri: 0,
675+ flat: 0,
676+ }
677+ }
678+
679+ /// Position the generator at flattened index `n` (exact resume): skip
680+ /// `n / rules_len` words and continue at rule `n % rules_len` of the
681+ /// next word. `n` beyond the space leaves the stream at its end.
682+ pub fn seek_flat(&mut self, n: u64) {
683+ let rules_len = self.rules.len() as u64;
684+ if rules_len == 0 {
685+ // Degenerate stream: always empty; positions are moot.
686+ self.flat = n;
687+ return;
481 }688 }
482- RuleIter { words, rules, cur: None, ri: 0 }689+ skip_n(&mut self.words, n / rules_len);
690+ let ri = (n % rules_len) as usize;
691+ // cur = None makes the first next() LOAD the word — which resets
692+ // ri to 0; pre-fill `cur` instead so the primed rule index
693+ // survives (a wordlist failure/exhaustion just empties the
694+ // stream).
695+ self.cur = self.words.next();
696+ self.ri = if self.cur.is_some() { ri } else { 0 };
697+ self.flat = n;
698+ }
699+}
700+
701+impl RawPosIter for RuleIter {
702+ fn raw_pos(&self) -> u64 {
703+ self.flat
483 }704 }
484 }705 }
485 706
@@ -496,6 +717,7 @@ impl Iterator for RuleIter {
496 while self.ri < self.rules.len() {717 while self.ri < self.rules.len() {
497 let r = &self.rules[self.ri];718 let r = &self.rules[self.ri];
498 self.ri += 1;719 self.ri += 1;
720+ self.flat += 1;
499 if let Some(out) = apply_rule(r, &cur) {721 if let Some(out) = apply_rule(r, &cur) {
500 return Some(out);722 return Some(out);
501 }723 }
@@ -527,7 +749,6 @@ pub struct HybridIter {
527 charset: Vec<u8>,749 charset: Vec<u8>,
528 min: usize,750 min: usize,
529 max: usize,751 max: usize,
530- /// Current wordlist word (None = load the next one).
531 cur_word: Option<Vec<u8>>,752 cur_word: Option<Vec<u8>>,
532 /// Suffix length currently emitted for `cur_word`.753 /// Suffix length currently emitted for `cur_word`.
533 k: usize,754 k: usize,
@@ -536,6 +757,11 @@ pub struct HybridIter {
536 /// Set by `seek_flat`: the odometer was primed externally and the next757 /// Set by `seek_flat`: the odometer was primed externally and the next
537 /// word load must NOT reset it.758 /// word load must NOT reset it.
538 primed: bool,759 primed: bool,
760+ /// Flattened slots consumed so far (absolute): the resume seek index
761+ /// of the next unconsumed slot.
762+ flat: u64,
763+ /// Slots consumed for the CURRENT word (0..=per_word).
764+ inner_used: u64,
539 }765 }
540 766
541 impl HybridIter {767 impl HybridIter {
@@ -563,6 +789,8 @@ impl HybridIter {
563 k: min,789 k: min,
564 odo: vec![0; min],790 odo: vec![0; min],
565 primed: false,791 primed: false,
792+ flat: 0,
793+ inner_used: 0,
566 })794 })
567 }795 }
568 796
@@ -600,7 +828,7 @@ impl HybridIter {
600 /// at its natural end.828 /// at its natural end.
601 pub fn seek_flat(&mut self, n: u64) {829 pub fn seek_flat(&mut self, n: u64) {
602 let per_word = self.per_word();830 let per_word = self.per_word();
603- let word_idx = if per_word == 0 { n } else { n / per_word };831+ let word_idx = n.checked_div(per_word).unwrap_or(n);
604 let inner = if per_word == 0 { 0 } else { n % per_word };832 let inner = if per_word == 0 { 0 } else { n % per_word };
605 skip_n(&mut self.words, word_idx);833 skip_n(&mut self.words, word_idx);
606 self.set_inner(inner as u128);834 self.set_inner(inner as u128);
@@ -609,6 +837,18 @@ impl HybridIter {
609 // odometer (one word only).837 // odometer (one word only).
610 self.cur_word = None;838 self.cur_word = None;
611 self.primed = true;839 self.primed = true;
840+ self.flat = n;
841+ self.inner_used = inner;
842+ }
843+
844+ /// Consume the rest of the current word's slots without emitting
845+ /// (overlong-word early exit: every remaining candidate is provably
846+ /// >63 bytes, i.e. "tried" by construction).
847+ fn consume_word_rest(&mut self) {
848+ let rest = self.per_word().saturating_sub(self.inner_used);
849+ self.flat += rest;
850+ self.inner_used = self.per_word();
851+ self.cur_word = None;
612 }852 }
613 853
614 /// Prime the odometer so the next calls yield suffix-block index854 /// Prime the odometer so the next calls yield suffix-block index
@@ -643,6 +883,12 @@ impl HybridIter {
643 }883 }
644 }884 }
645 885
886+impl RawPosIter for HybridIter {
887+ fn raw_pos(&self) -> u64 {
888+ self.flat
889+ }
890+}
891+
646 impl Iterator for HybridIter {892 impl Iterator for HybridIter {
647 type Item = Vec<u8>;893 type Item = Vec<u8>;
648 894
@@ -655,19 +901,22 @@ impl Iterator for HybridIter {
655 if !self.primed {901 if !self.primed {
656 self.k = self.min;902 self.k = self.min;
657 self.odo = vec![0; self.k];903 self.odo = vec![0; self.k];
904+ self.inner_used = 0;
658 }905 }
659 self.primed = false;906 self.primed = false;
660 }907 }
661 let word = self.cur_word.clone().expect("just filled");908 let word = self.cur_word.clone().expect("just filled");
662- // Out-of-range sentinel from set_inner: exhaust.909+ // Out-of-range sentinel from set_inner: exhaust the word.
663 if self.odo.iter().any(|&d| d >= self.charset.len()) {910 if self.odo.iter().any(|&d| d >= self.charset.len()) {
664- self.cur_word = None;911+ self.consume_word_rest();
665 continue;912 continue;
666 }913 }
667 let mut cand = word.clone();914 let mut cand = word.clone();
668 for d in &self.odo {915 for d in &self.odo {
669 cand.push(self.charset[*d]);916 cand.push(self.charset[*d]);
670 }917 }
918+ self.flat += 1;
919+ self.inner_used += 1;
671 // Advance the odometer: rightmost fastest; carry grows k until920 // Advance the odometer: rightmost fastest; carry grows k until
672 // max is exhausted, which moves on to the next word.921 // max is exhausted, which moves on to the next word.
673 let mut pos = self.odo.len();922 let mut pos = self.odo.len();
@@ -693,9 +942,10 @@ impl Iterator for HybridIter {
693 return Some(cand);942 return Some(cand);
694 }943 }
695 // word exhausted check: when the suffix made it not fit at k,944 // word exhausted check: when the suffix made it not fit at k,
696- // larger k will not either — jump straight to the next word.945+ // larger k will not either — consume the word's remaining
697- if word.len() + self.k + 1 > 63 {946+ // slots (all provably too long) and jump to the next word.
698- self.cur_word = None;947+ if self.cur_word.is_some() && word.len() + self.k + 1 > 63 {
948+ self.consume_word_rest();
699 }949 }
700 }950 }
701 }951 }
@@ -707,8 +957,9 @@ impl Iterator for HybridIter {
707 957
708 /// Wraps a candidate stream, dropping candidates already covered by the958 /// Wraps a candidate stream, dropping candidates already covered by the
709 /// per-SSID PMK cache consult (they were shown not to match). Skipped959 /// per-SSID PMK cache consult (they were shown not to match). Skipped
710-/// candidates do NOT count against `done` — the cache pass replaced the960+/// candidates consume their RAW positions like any other (the cache pass
711-/// work; resume indices still refer to the RAW stream (worst-case).961+/// did the work), so saved positions stay exact no matter how the cache
962+/// changes between save and resume — see [`RawPosIter`].
712 pub struct CacheSkipIter<I: Iterator<Item = Vec<u8>>> {963 pub struct CacheSkipIter<I: Iterator<Item = Vec<u8>>> {
713 inner: I,964 inner: I,
714 covered: HashSet<Box<[u8]>>,965 covered: HashSet<Box<[u8]>>,
@@ -724,12 +975,18 @@ impl<I: Iterator<Item = Vec<u8>>> Iterator for CacheSkipIter<I> {
724 type Item = Vec<u8>;975 type Item = Vec<u8>;
725 976
726 fn next(&mut self) -> Option<Vec<u8>> {977 fn next(&mut self) -> Option<Vec<u8>> {
727- for cand in self.inner.by_ref() {978+ self.inner
728- if !self.covered.contains(cand.as_slice()) {979+ .by_ref()
729- return Some(cand);980+ .find(|cand| !self.covered.contains(cand.as_slice()))
730- }981+ }
731- }982+}
732- None983+
984+/// After a yield, the wrapped iterator's raw position reflects every slot
985+/// pulled to produce it — including the cache-skipped ones: positions
986+/// stay in RAW stream coordinates (cache contents never shift them).
987+impl<I: Iterator<Item = Vec<u8>> + RawPosIter> RawPosIter for CacheSkipIter<I> {
988+ fn raw_pos(&self) -> u64 {
989+ self.inner.raw_pos()
733 }990 }
734 }991 }
735 992
@@ -749,43 +1006,86 @@ fn log_err(tx: &Sender<Event>, line: impl Into<String>) {
749 send(tx, Event::Error(line.into()));1006 send(tx, Event::Error(line.into()));
750 }1007 }
751 1008
1009+/// Run-scoped crack context shared by the words-family backends: target
1010+/// identity, raw-position map, worst-case total, event sink, stop flag
1011+/// and the CPU-only override. Bundled so [`word_crack`] stays under the
1012+/// argument-count lint.
1013+struct CrackCtx<'a> {
1014+ target_desc: &'a str,
1015+ target: &'a CrackTarget,
1016+ pos_map: &'a PosMap,
1017+ total: Option<u64>,
1018+ tx: &'a Sender<Event>,
1019+ stop: &'a Arc<AtomicBool>,
1020+ force_cpu: bool,
1021+}
1022+
752 /// GPU (or CPU-fallback) PBKDF2 crack over a word stream — the selection1023 /// GPU (or CPU-fallback) PBKDF2 crack over a word stream — the selection
753 /// logic the cracker has always used. `total` is the worst-case candidate1024 /// logic the cracker has always used. `total` is the worst-case candidate
754 /// count (worst-case ETA = (total - done) / hps) when the source is1025 /// count (worst-case ETA = (total - done) / hps) when the source is
755-/// countable. `force_cpu` skips the GPU entirely (CLI `--cpu`); it also1026+/// countable. `pos_map` carries raw stream positions recorded by
756-/// disables the PMK-cache sink so a forced-CPU client run stays1027+/// [`PosFeed`], one per candidate DELIVERED to the backend; progress
757-/// side-effect-free. Otherwise a PURE-CPU run (no adapter, or a key_ver1028+/// events map backend-confirmed counts onto them, so `CrackProgress.done`
758-/// the shader cannot express) populates the per-SSID PMK cache while it1029+/// is always an exact raw position (session v2 resume index), never a
759-/// cracks — every candidate's PBKDF2 result lands in1030+/// post-filter yield count. `force_cpu` skips the GPU entirely (CLI
1031+/// `--cpu`); it also disables the PMK-cache sink so a forced-CPU client
1032+/// run stays side-effect-free. Otherwise a PURE-CPU run (no adapter, or a
1033+/// key_ver the shader cannot express) populates the per-SSID PMK cache
1034+/// while it cracks — every candidate's PBKDF2 result lands in
760 /// `store::cache_file(essid)` in rainbow format.1035 /// `store::cache_file(essid)` in rainbow format.
1036+///
1037+/// `Err` means the GPU backend itself failed (device lost, dispatch
1038+/// timeout): NOT exhaustion, NOT user stop — the caller reports
1039+/// [`Event::CrackError`] and the session stays resumable.
761 fn word_crack(1040 fn word_crack(
762- target_desc: &str,1041+ ctx: &CrackCtx<'_>,
763- target: &CrackTarget,
764 words: &mut dyn Iterator<Item = Vec<u8>>,1042 words: &mut dyn Iterator<Item = Vec<u8>>,
765- total: Option<u64>,1043+) -> Result<Option<String>, gpu::GpuError> {
766- done_offset: u64,1044+ let CrackCtx {
767- tx: &Sender<Event>,1045+ target_desc,
768- stop: &Arc<AtomicBool>,1046+ target,
769- force_cpu: bool,1047+ pos_map,
770-) -> Option<String> {1048+ total,
1049+ tx,
1050+ stop,
1051+ force_cpu,
1052+ } = *ctx;
771 if let Some(t) = total {1053 if let Some(t) = total {
772 log(tx, format!("cracker: worst case: {t} candidates"));1054 log(tx, format!("cracker: worst case: {t} candidates"));
773 }1055 }
774 let mut progress = {1056 let mut progress = {
775 let tx = tx.clone();1057 let tx = tx.clone();
1058+ let map = pos_map.clone();
1059+ let mut acked = 0u64;
776 move |done: u64, hps: f64| {1060 move |done: u64, hps: f64| {
777- send(&tx, Event::CrackProgress { done: done_offset + done, hps, total })1061+ if let Some(raw) = raw_position_of(&map, &mut acked, done) {
1062+ send(
1063+ &tx,
1064+ Event::CrackProgress {
1065+ done: raw,
1066+ hps,
1067+ total,
1068+ },
1069+ );
1070+ }
778 }1071 }
779 };1072 };
780 // SHA1-family targets (handshake key_ver 1|2, PMKID) crack fully1073 // SHA1-family targets (handshake key_ver 1|2, PMKID) crack fully
781 // on-device (init + chain + MIC epilogue); key_ver 3 / overlong1074 // on-device (init + chain + MIC epilogue); key_ver 3 / overlong
782 // ESSIDs stay on the CPU cracker even when a GPU exists.1075 // ESSIDs stay on the CPU cracker even when a GPU exists.
783- let adapter = if !force_cpu && gpu::gpu_verifiable(target) { GpuCracker::try_new() } else { None };1076+ let adapter = if !force_cpu && gpu::gpu_verifiable(target) {
1077+ GpuCracker::try_new()
1078+ } else {
1079+ None
1080+ };
784 match adapter {1081 match adapter {
785 Some(g) => {1082 Some(g) => {
786 log(1083 log(
787 tx,1084 tx,
788- format!("cracker: GPU backend: {} — cracking {target_desc}", g.device_name()),1085+ format!(
1086+ "cracker: GPU backend: {} — cracking {target_desc}",
1087+ g.device_name()
1088+ ),
789 );1089 );
790 // GPU runs never populate the cache: the hit-slot readback1090 // GPU runs never populate the cache: the hit-slot readback
791 // pipeline has no PMK readback plumbed through it.1091 // pipeline has no PMK readback plumbed through it.
@@ -797,7 +1097,9 @@ fn word_crack(
797 if force_cpu {1097 if force_cpu {
798 format!("cracker: CPU backend (forced) — cracking {target_desc}")1098 format!("cracker: CPU backend (forced) — cracking {target_desc}")
799 } else {1099 } else {
800- format!("cracker: CPU backend (no adapter or non-SHA1 target) — cracking {target_desc}")1100+ format!(
1101+ "cracker: CPU backend (no adapter or non-SHA1 target) — cracking {target_desc}"
1102+ )
801 },1103 },
802 );1104 );
803 let mut sink = if force_cpu {1105 let mut sink = if force_cpu {
@@ -812,7 +1114,9 @@ fn word_crack(
812 Err(e) => {1114 Err(e) => {
813 log(1115 log(
814 tx,1116 tx,
815- format!("pmk cache: cannot open cache file for writing ({e:#}) — continuing without"),1117+ format!(
1118+ "pmk cache: cannot open cache file for writing ({e:#}) — continuing without"
1119+ ),
816 );1120 );
817 None1121 None
818 }1122 }
@@ -821,11 +1125,17 @@ fn word_crack(
821 let found = gpu::cpu_crack(target, words, &mut progress, stop, sink.as_mut());1125 let found = gpu::cpu_crack(target, words, &mut progress, stop, sink.as_mut());
822 if let Some(s) = sink {1126 if let Some(s) = sink {
823 match s.finish() {1127 match s.finish() {
824- Ok(n) => log(tx, format!("pmk cache: {n} PMKs cached → {}", store::cache_file(target.essid()).display())),1128+ Ok(n) => log(
1129+ tx,
1130+ format!(
1131+ "pmk cache: {n} PMKs cached → {}",
1132+ store::cache_file(target.essid()).display()
1133+ ),
1134+ ),
825 Err(e) => log(tx, format!("pmk cache: flush failed ({e:#})")),1135 Err(e) => log(tx, format!("pmk cache: flush failed ({e:#})")),
826 }1136 }
827 }1137 }
828- found1138+ Ok(found)
829 }1139 }
830 }1140 }
831 }1141 }
@@ -846,21 +1156,30 @@ pub fn rainbow_crack(
846 for (pmk, pass) in entries {1156 for (pmk, pass) in entries {
847 done += 1;1157 done += 1;
848 if gpu::prepared_matches(&prepared, &pmk) {1158 if gpu::prepared_matches(&prepared, &pmk) {
849- progress(done, done as f64 / started.elapsed().as_secs_f64().max(1e-6));1159+ progress(
1160+ done,
1161+ done as f64 / started.elapsed().as_secs_f64().max(1e-6),
1162+ );
850 return String::from_utf8(pass).ok();1163 return String::from_utf8(pass).ok();
851 }1164 }
852 if last_tick.elapsed() > Duration::from_millis(250) {1165 if last_tick.elapsed() > Duration::from_millis(250) {
853 last_tick = Instant::now();1166 last_tick = Instant::now();
854- progress(done, done as f64 / started.elapsed().as_secs_f64().max(1e-6));1167+ progress(
1168+ done,
1169+ done as f64 / started.elapsed().as_secs_f64().max(1e-6),
1170+ );
855 }1171 }
856- if done % 4096 == 0 && stop.load(Ordering::Relaxed) {1172+ if done.is_multiple_of(4096) && stop.load(Ordering::Relaxed) {
857 return None;1173 return None;
858 }1174 }
859 }1175 }
860 // Exhaustion: a table smaller than one tick interval would otherwise1176 // Exhaustion: a table smaller than one tick interval would otherwise
861 // end with zero progress ever reported (the word path ticks per1177 // end with zero progress ever reported (the word path ticks per
862 // batch — match it).1178 // batch — match it).
863- progress(done, done as f64 / started.elapsed().as_secs_f64().max(1e-6));1179+ progress(
1180+ done,
1181+ done as f64 / started.elapsed().as_secs_f64().max(1e-6),
1182+ );
864 None1183 None
865 }1184 }
866 1185
@@ -884,7 +1203,7 @@ enum CacheConsult {
884 Skip,1203 Skip,
885 }1204 }
886 1205
887-/// Per-SSID PMK cache consult (`~/wifilab/cache/<ssid-hex>.pmk`, rainbow1206+/// Per-SSID PMK cache consult (`~/wifi_lab/cache/<ssid-hex>.pmk`, rainbow
888 /// text format): if the file exists and is readable, run a quick1207 /// text format): if the file exists and is readable, run a quick
889 /// PBKDF2-free pass ([`rainbow_crack`]) over its entries BEFORE the main1208 /// PBKDF2-free pass ([`rainbow_crack`]) over its entries BEFORE the main
890 /// attack. On a miss the caller wraps the main iterator in1209 /// attack. On a miss the caller wraps the main iterator in
@@ -905,12 +1224,18 @@ fn consult_cache(
905 Ok((ssid, entries)) => match rainbow::check_ssid(ssid.as_deref(), target.essid()) {1224 Ok((ssid, entries)) => match rainbow::check_ssid(ssid.as_deref(), target.essid()) {
906 Ok(()) => entries,1225 Ok(()) => entries,
907 Err(e) => {1226 Err(e) => {
908- log(tx, format!("pmk cache: unreadable ({e:#}), proceeding without"));1227+ log(
1228+ tx,
1229+ format!("pmk cache: unreadable ({e:#}), proceeding without"),
1230+ );
909 return CacheConsult::Skip;1231 return CacheConsult::Skip;
910 }1232 }
911 },1233 },
912 Err(e) => {1234 Err(e) => {
913- log(tx, format!("pmk cache: unreadable ({e:#}), proceeding without"));1235+ log(
1236+ tx,
1237+ format!("pmk cache: unreadable ({e:#}), proceeding without"),
1238+ );
914 return CacheConsult::Skip;1239 return CacheConsult::Skip;
915 }1240 }
916 };1241 };
@@ -938,19 +1263,33 @@ fn consult_cache(
938 // produce the canonical "stopped" terminator.1263 // produce the canonical "stopped" terminator.
939 return CacheConsult::Miss(covered);1264 return CacheConsult::Miss(covered);
940 }1265 }
941- log(tx, format!("pmk cache: {} entries, no hit — continuing {attack_desc}", covered.len()));1266+ log(
1267+ tx,
1268+ format!(
1269+ "pmk cache: {} entries, no hit — continuing {attack_desc}",
1270+ covered.len()
1271+ ),
1272+ );
942 CacheConsult::Miss(covered)1273 CacheConsult::Miss(covered)
943 }1274 }
944 1275
945 /// Start a crack run on a background thread. Always returns the stop flag;1276 /// Start a crack run on a background thread. Always returns the stop flag;
946 /// spawn failure is reported as events instead of a thread. `resume_from`1277 /// spawn failure is reported as events instead of a thread. `resume_from`
947-/// skips that many leading candidates (saved position of a previous run —1278+/// is a RAW stream position (session v2): the candidate index the run
948-/// a FLATTENED index for rules/hybrid, see [`RuleIter`]/[`HybridIter`]);1279+/// continues at — a flattened slot index for rules/hybrid (see
949-/// progress events still count from zero of the FULL space. `force_cpu`1280+/// [`RuleIter::seek_flat`]/[`HybridIter::seek_flat`]), a plain skip count
950-/// pins the CPU backend (headless CLI `--cpu`) and disables PMK-cache1281+/// for wordlist tables, an odometer index for bruteforce. Progress events
951-/// writes. Wordlist-family attacks first consult the per-SSID PMK cache1282+/// report raw positions of the FULL space from zero. `force_cpu` pins the
1283+/// CPU backend (headless CLI `--cpu`) and disables PMK-cache writes.
1284+/// Wordlist-family attacks first consult the per-SSID PMK cache
952 /// (`store::cache_file`): hit → the normal found-terminator without a1285 /// (`store::cache_file`): hit → the normal found-terminator without a
953-/// main run; miss → cached passwords are skipped via [`CacheSkipIter`].1286+/// main run; miss → cached passwords are skipped via [`CacheSkipIter`]
1287+/// WITHOUT shifting raw positions.
1288+///
1289+/// Terminators: found → `CrackFound` + `CrackStopped { found: true }`;
1290+/// user stop / true exhaustion / setup failure → `CrackStopped { found:
1291+/// false }`; GPU backend failure or worker panic → `CrackError { reason }`
1292+/// (the session file stays resumable).
954 pub fn spawn_crack(1293 pub fn spawn_crack(
955 target_desc: String,1294 target_desc: String,
956 target: CrackTarget,1295 target: CrackTarget,
@@ -962,13 +1301,15 @@ pub fn spawn_crack(
962 let stop = Arc::new(AtomicBool::new(false));1301 let stop = Arc::new(AtomicBool::new(false));
963 let stop2 = stop.clone();1302 let stop2 = stop.clone();
964 let err_tx = tx.clone();1303 let err_tx = tx.clone();
1304+ let panic_tx = tx.clone();
965 let result = std::thread::Builder::new()1305 let result = std::thread::Builder::new()
966- .name("wifilab-crack".into())1306+ .name("wifi_lab-crack".into())
967- .spawn(move || {1307+ .spawn(move || {
968- if resume_from > 0 {1308+ let run = || {
969- log(&tx, format!("cracker: resuming at candidate {resume_from}"));1309+ if resume_from > 0 {
970- }1310+ log(&tx, format!("cracker: resuming at candidate {resume_from}"));
971- // Per-SSID PMK cache consult (wordlist-family only).1311+ }
1312+ // Per-SSID PMK cache consult (wordlist-family only).
972 let wordlist_family = matches!(1313 let wordlist_family = matches!(
973 attack,1314 attack,
974 Attack::Wordlist(_)1315 Attack::Wordlist(_)
@@ -989,18 +1330,34 @@ pub fn spawn_crack(
989 CacheConsult::Skip => {}1330 CacheConsult::Skip => {}
990 }1331 }
991 }1332 }
992- // Wrap a candidate stream with the coverage filter from the1333+ // Wrap a raw-positioned candidate stream with the coverage
993- // cache consult (when one happened).1334+ // filter from the cache consult (when one happened). Coverage
994- fn with_cache<I: Iterator<Item = Vec<u8>> + 'static>(1335+ // sits BETWEEN the raw stream and the backend: positions stay
1336+ // raw, so a cache that changed since the session was saved
1337+ // shifts only WHICH candidates get skipped, never the resume
1338+ // address.
1339+ fn with_cache<I: RawPosIter + 'static>(
995 it: I,1340 it: I,
996 covered: &mut Option<HashSet<Box<[u8]>>>,1341 covered: &mut Option<HashSet<Box<[u8]>>>,
997- ) -> Box<dyn Iterator<Item = Vec<u8>>> {1342+ ) -> Box<dyn RawPosIter> {
998 match covered.take() {1343 match covered.take() {
999 Some(c) => Box::new(CacheSkipIter::new(it, c)),1344 Some(c) => Box::new(CacheSkipIter::new(it, c)),
1000 None => Box::new(it),1345 None => Box::new(it),
1001 }1346 }
1002 }1347 }
1003- let found = match &attack {1348+ // Setup failures (missing files, bad rules): the error is
1349+ // already logged; the run ends with the standard
1350+ // not-found terminator (NOT CrackError: nothing backend died).
1351+ fn setup_fail(tx: &Sender<Event>, e: &anyhow::Error) -> Result<Option<String>, gpu::GpuError> {
1352+ log_err(tx, format!("cracker: {e:#}"));
1353+ Ok(None)
1354+ }
1355+ // Snapshot the input skip counters so the run can surface
1356+ // lines the iterators silently dropped (cache consult above
1357+ // is excluded — it owns its own log lines).
1358+ let wl_skipped_at_start = wordlist::skipped_lines();
1359+ let rb_skipped_at_start = rainbow::skipped_lines();
1360+ let found: Result<Option<String>, gpu::GpuError> = match &attack {
1004 Attack::Wordlist(path) => match wordlist::open(path) {1361 Attack::Wordlist(path) => match wordlist::open(path) {
1005 Ok(mut words) => {1362 Ok(mut words) => {
1006 // Line count is an upper bound (length-filtering1363 // Line count is an upper bound (length-filtering
@@ -1008,13 +1365,23 @@ pub fn spawn_crack(
1008 // case" the ETA promises).1365 // case" the ETA promises).
1009 let total = wordlist::line_count(path).ok();1366 let total = wordlist::line_count(path).ok();
1010 skip_n(&mut words, resume_from);1367 skip_n(&mut words, resume_from);
1011- let mut words = with_cache(words, &mut covered);1368+ let raw = CountIter::at(words, resume_from);
1012- word_crack(&target_desc, &target, &mut words, total, resume_from, &tx, &stop2, force_cpu)1369+ let stream = with_cache(raw, &mut covered);
1013- }1370+ let (mut feed, map) = PosFeed::new(stream);
1014- Err(e) => {1371+ word_crack(
1015- log_err(&tx, format!("cracker: {e:#}"));1372+ &CrackCtx {
1016- None1373+ target_desc: &target_desc,
1374+ target: &target,
1375+ pos_map: &map,
1376+ total,
1377+ tx: &tx,
1378+ stop: &stop2,
1379+ force_cpu,
1380+ },
1381+ &mut feed,
1382+ )
1017 }1383 }
1384+ Err(e) => setup_fail(&tx, &e),
1018 },1385 },
1019 Attack::Rules { wordlist: wl_path, rules: rules_path } => {1386 Attack::Rules { wordlist: wl_path, rules: rules_path } => {
1020 match (wordlist::open(wl_path), parse_rules(rules_path)) {1387 match (wordlist::open(wl_path), parse_rules(rules_path)) {
@@ -1025,19 +1392,25 @@ pub fn spawn_crack(
1025 let total =1392 let total =
1026 lines.map(|l| (l as u128).saturating_mul(n_rules).min(u64::MAX as u128) as u64);1393 lines.map(|l| (l as u128).saturating_mul(n_rules).min(u64::MAX as u128) as u64);
1027 let mut it = RuleIter::new(words, Rc::new(rules));1394 let mut it = RuleIter::new(words, Rc::new(rules));
1028- // Flattened index resume: a plain skip.1395+ // Exact flattened-index resume.
1029- skip_n(&mut it, resume_from);1396+ it.seek_flat(resume_from);
1030- let mut it = with_cache(it, &mut covered);1397+ let stream = with_cache(it, &mut covered);
1031- word_crack(&target_desc, &target, &mut it, total, resume_from, &tx, &stop2, force_cpu)1398+ let (mut feed, map) = PosFeed::new(stream);
1032- }1399+ word_crack(
1033- (Err(e), _) => {1400+ &CrackCtx {
1034- log_err(&tx, format!("cracker: {e:#}"));1401+ target_desc: &target_desc,
1035- None1402+ target: &target,
1036- }1403+ pos_map: &map,
1037- (_, Err(e)) => {1404+ total,
1038- log_err(&tx, format!("cracker: {e:#}"));1405+ tx: &tx,
1039- None1406+ stop: &stop2,
1407+ force_cpu,
1408+ },
1409+ &mut feed,
1410+ )
1040 }1411 }
1412+ (Err(e), _) => setup_fail(&tx, &e),
1413+ (_, Err(e)) => setup_fail(&tx, &e),
1041 }1414 }
1042 }1415 }
1043 Attack::Hybrid { wordlist: wl_path, charset, min, max } => {1416 Attack::Hybrid { wordlist: wl_path, charset, min, max } => {
@@ -1052,13 +1425,22 @@ pub fn spawn_crack(
1052 });1425 });
1053 // Exact flattened-index resume.1426 // Exact flattened-index resume.
1054 it.seek_flat(resume_from);1427 it.seek_flat(resume_from);
1055- let mut it = with_cache(it, &mut covered);1428+ let stream = with_cache(it, &mut covered);
1056- word_crack(&target_desc, &target, &mut it, total, resume_from, &tx, &stop2, force_cpu)1429+ let (mut feed, map) = PosFeed::new(stream);
1057- }1430+ word_crack(
1058- Err(e) => {1431+ &CrackCtx {
1059- log_err(&tx, format!("cracker: {e:#}"));1432+ target_desc: &target_desc,
1060- None1433+ target: &target,
1434+ pos_map: &map,
1435+ total,
1436+ tx: &tx,
1437+ stop: &stop2,
1438+ force_cpu,
1439+ },
1440+ &mut feed,
1441+ )
1061 }1442 }
1443+ Err(e) => setup_fail(&tx, &e),
1062 }1444 }
1063 }1445 }
1064 Attack::Bruteforce { charset, min, max, freq_order } => {1446 Attack::Bruteforce { charset, min, max, freq_order } => {
@@ -1068,43 +1450,88 @@ pub fn spawn_crack(
1068 let total = Some(brute.space().min(u64::MAX as u128) as u64);1450 let total = Some(brute.space().min(u64::MAX as u128) as u64);
1069 // Exact seek (no skipping): O(1) odometer math.1451 // Exact seek (no skipping): O(1) odometer math.
1070 brute.seek(resume_from);1452 brute.seek(resume_from);
1071- let mut brute = with_cache(brute, &mut covered);1453+ let stream = with_cache(brute, &mut covered);
1072- word_crack(&target_desc, &target, &mut brute, total, resume_from, &tx, &stop2, force_cpu)1454+ let (mut feed, map) = PosFeed::new(stream);
1455+ word_crack(
1456+ &CrackCtx {
1457+ target_desc: &target_desc,
1458+ target: &target,
1459+ pos_map: &map,
1460+ total,
1461+ tx: &tx,
1462+ stop: &stop2,
1463+ force_cpu,
1464+ },
1465+ &mut feed,
1466+ )
1073 }1467 }
1074 Attack::Rainbow(path) => match rainbow::open(path) {1468 Attack::Rainbow(path) => match rainbow::open(path) {
1075 Ok((ssid, mut entries)) => {1469 Ok((ssid, mut entries)) => {
1076 if let Err(e) = rainbow::check_ssid(ssid.as_deref(), target.essid()) {1470 if let Err(e) = rainbow::check_ssid(ssid.as_deref(), target.essid()) {
1077- log_err(&tx, format!("cracker: {e:#}"));1471+ setup_fail(&tx, &e)
1078- None
1079 } else {1472 } else {
1080 let total = wordlist::line_count(path).ok();1473 let total = wordlist::line_count(path).ok();
1081 skip_n(&mut entries, resume_from);1474 skip_n(&mut entries, resume_from);
1475+ // Rainbow entries have no cache coverage layer;
1476+ // raw position = resume_from + pulls, recorded
1477+ // per delivered item like the word paths.
1478+ let map: PosMap = Default::default();
1479+ let pull_map = map.clone();
1480+ let mut pulls = resume_from;
1481+ let mut feed = std::iter::from_fn(move || {
1482+ let out = entries.next()?;
1483+ pulls += 1;
1484+ pull_map.borrow_mut().push_back(pulls);
1485+ Some(out)
1486+ });
1487+ let mut acked = 0u64;
1082 let mut progress = {1488 let mut progress = {
1083 let tx = tx.clone();1489 let tx = tx.clone();
1084 move |done: u64, hps: f64| {1490 move |done: u64, hps: f64| {
1085- send(&tx, Event::CrackProgress { done: resume_from + done, hps, total })1491+ if let Some(raw) = raw_position_of(&map, &mut acked, done) {
1492+ send(&tx, Event::CrackProgress { done: raw, hps, total });
1493+ }
1086 }1494 }
1087 };1495 };
1088 log(1496 log(
1089 &tx,1497 &tx,
1090 format!("cracker: rainbow run (precomputed PMKs) — {target_desc}"),1498 format!("cracker: rainbow run (precomputed PMKs) — {target_desc}"),
1091 );1499 );
1092- rainbow_crack(&target, &mut entries, &mut progress, &stop2)1500+ Ok(rainbow_crack(&target, &mut feed, &mut progress, &stop2))
1093 }1501 }
1094 }1502 }
1095- Err(e) => {1503+ Err(e) => setup_fail(&tx, &e),
1096- log_err(&tx, format!("cracker: {e:#}"));1504+ },
1097- None1505+ };
1098- }1506+ // One summary line per run when the input iterator silently
1099- },1507+ // dropped lines (out-of-range or undecodable bytes).
1100- };1508+ let skipped = if matches!(attack, Attack::Rainbow(_)) {
1101- match found {1509+ rainbow::skipped_lines() - rb_skipped_at_start
1102- Some(password) => {1510+ } else {
1511+ wordlist::skipped_lines() - wl_skipped_at_start
1512+ };
1513+ if skipped > 0 {
1514+ log(
1515+ &tx,
1516+ format!(
1517+ "wordlist: {skipped} line(s) skipped (out-of-range or undecodable bytes)"
1518+ ),
1519+ );
1520+ }
1521+ match found {
1522+ Err(e) => {
1523+ // Backend failure (device lost, dispatch timeout,
1524+ // unsupported mid-run): NOT exhaustion, NOT user stop.
1525+ // The session file stays — the run may be resumed.
1526+ log_err(&tx, format!("cracker: backend failed: {e} — run aborted, session resumable"));
1527+ send(&tx, Event::CrackError { reason: e.to_string() });
1528+ }
1529+ Ok(Some(password)) => {
1103 log(&tx, format!("cracker: PASSWORD found: {password}"));1530 log(&tx, format!("cracker: PASSWORD found: {password}"));
1104 send(&tx, Event::CrackFound { password });1531 send(&tx, Event::CrackFound { password });
1105 send(&tx, Event::CrackStopped { found: true });1532 send(&tx, Event::CrackStopped { found: true });
1106 }1533 }
1107- None => {1534+ Ok(None) => {
1108 if stop2.load(Ordering::Relaxed) {1535 if stop2.load(Ordering::Relaxed) {
1109 log(&tx, "cracker: stopped");1536 log(&tx, "cracker: stopped");
1110 } else {1537 } else {
@@ -1113,6 +1540,21 @@ pub fn spawn_crack(
1113 send(&tx, Event::CrackStopped { found: false });1540 send(&tx, Event::CrackStopped { found: false });
1114 }1541 }
1115 }1542 }
1543+ };
1544+ if let Err(payload) = std::panic::catch_unwind(std::panic::AssertUnwindSafe(run)) {
1545+ // A worker panic is a backend failure too: surface it as
1546+ // CrackError (the session file stays for a resume) instead
1547+ // of the historical silent "exhausted" mis-report.
1548+ let msg = if let Some(s) = payload.downcast_ref::<&str>() {
1549+ (*s).to_string()
1550+ } else if let Some(s) = payload.downcast_ref::<String>() {
1551+ s.clone()
1552+ } else {
1553+ "unknown panic payload".to_string()
1554+ };
1555+ log_err(&panic_tx, format!("cracker: worker panicked: {msg}"));
1556+ send(&panic_tx, Event::CrackError { reason: format!("worker panicked: {msg}") });
1557+ }
1116 });1558 });
1117 if let Err(e) = result {1559 if let Err(e) = result {
1118 send(&err_tx, Event::Error(format!("cracker: spawn failed: {e}")));1560 send(&err_tx, Event::Error(format!("cracker: spawn failed: {e}")));
@@ -1136,7 +1578,7 @@ pub fn spawn_rainbow_build(
1136 let err_tx = tx.clone();1578 let err_tx = tx.clone();
1137 let out2 = out.clone();1579 let out2 = out.clone();
1138 let result = std::thread::Builder::new()1580 let result = std::thread::Builder::new()
1139- .name("wifilab-rainbow-build".into())1581+ .name("wifi_lab-rainbow-build".into())
1140 .spawn(move || {1582 .spawn(move || {
1141 let entries = build_table(&ssid, &wordlist, &out2, &tx, &stop2);1583 let entries = build_table(&ssid, &wordlist, &out2, &tx, &stop2);
1142 send(1584 send(
@@ -1160,12 +1602,44 @@ pub fn spawn_rainbow_build(
1160 stop1602 stop
1161 }1603 }
1162 1604
1605+/// Batch PMK computer: raw passphrases in, one PMK per word out (GPU
1606+/// kernel or test fake).
1607+type PmkBatchFn<'a> = dyn FnMut(&[Vec<u8>]) -> Result<Vec<[u8; 32]>, gpu::GpuError> + 'a;
1608+
1609+/// Compute PMKs for EVERY word of `batch` over the GPU batch kernel.
1610+/// `pmk_batch_gpu` may return only a PREFIX after its internal
1611+/// halving-retry — the kernel was invoked on the head, the tail was never
1612+/// attempted; loop it until the whole batch is covered (each retry itself
1613+/// may return a shorter prefix). An empty `Ok` on a non-empty slice would
1614+/// spin forever, so it is treated as failure. `Err` aborts the build
1615+/// (the caller keeps the partial table).
1616+fn gpu_pmk_batch_full(
1617+ compute: &mut PmkBatchFn<'_>,
1618+ batch: &[Vec<u8>],
1619+) -> Result<Vec<[u8; 32]>, gpu::GpuError> {
1620+ let mut out: Vec<[u8; 32]> = Vec::with_capacity(batch.len());
1621+ while out.len() < batch.len() {
1622+ let tail = &batch[out.len()..];
1623+ let mut got = compute(tail)?;
1624+ if got.is_empty() {
1625+ // Not per the kernel's contract — bail rather than spin.
1626+ return Err(gpu::GpuError::Unsupported(
1627+ "batch kernel returned zero PMKs for a non-empty input".to_string(),
1628+ ));
1629+ }
1630+ // Defensive: never accept more PMKs than requested words.
1631+ got.truncate(tail.len());
1632+ out.append(&mut got);
1633+ }
1634+ Ok(out)
1635+}
1636+
1163 /// The build loop: wordlist batches → PMKs (GPU batch or per-word CPU) →1637 /// The build loop: wordlist batches → PMKs (GPU batch or per-word CPU) →
1164 /// table file. Returns entries actually written.1638 /// table file. Returns entries actually written.
1165 fn build_table(1639 fn build_table(
1166 ssid: &str,1640 ssid: &str,
1167- wordlist_path: &PathBuf,1641+ wordlist_path: &Path,
1168- out: &PathBuf,1642+ out: &Path,
1169 tx: &Sender<Event>,1643 tx: &Sender<Event>,
1170 stop: &Arc<AtomicBool>,1644 stop: &Arc<AtomicBool>,
1171 ) -> u64 {1645 ) -> u64 {
@@ -1187,7 +1661,11 @@ fn build_table(
1187 log(1661 log(
1188 tx,1662 tx,
1189 match &gpu {1663 match &gpu {
1190- Some(g) => format!("rainbow: building via GPU ({}) → {}", g.device_name(), out.display()),1664+ Some(g) => format!(
1665+ "rainbow: building via GPU ({}) → {}",
1666+ g.device_name(),
1667+ out.display()
1668+ ),
1191 None => format!("rainbow: building via CPU → {}", out.display()),1669 None => format!("rainbow: building via CPU → {}", out.display()),
1192 },1670 },
1193 );1671 );
@@ -1210,17 +1688,23 @@ fn build_table(
1210 break;1688 break;
1211 }1689 }
1212 let pmks = match &gpu {1690 let pmks = match &gpu {
1213- Some(g) => match g.pmk_batch_gpu(&batch, salt) {1691+ Some(g) => {
1214- // Device hiccup even after the internal halving: give up,1692+ match gpu_pmk_batch_full(&mut |slice| g.pmk_batch_gpu(slice, salt), &batch) {
1215- // the partial table stays usable.1693+ Ok(p) => p,
1216- None => {1694+ // Device hiccup even after the internal halving: give up,
1217- log_err(tx, "rainbow: GPU batch failed — table left partial");1695+ // the partial table stays usable.
1218- break 'outer;1696+ Err(e) => {
1697+ log_err(
1698+ tx,
1699+ format!("rainbow: GPU batch failed ({e}) — table left partial"),
1700+ );
1701+ break 'outer;
1702+ }
1219 }1703 }
1220- Some(p) => p,1704+ }
1221- },
1222 None => batch.iter().map(|w| crypto::pmk(w, salt)).collect(),1705 None => batch.iter().map(|w| crypto::pmk(w, salt)).collect(),
1223 };1706 };
1707+ debug_assert_eq!(pmks.len(), batch.len(), "every batch word must have a PMK");
1224 for (pmk, w) in pmks.iter().zip(batch.iter()) {1708 for (pmk, w) in pmks.iter().zip(batch.iter()) {
1225 if let Err(e) = table.push(pmk, w) {1709 if let Err(e) = table.push(pmk, w) {
1226 log_err(tx, format!("rainbow: write failed: {e:#}"));1710 log_err(tx, format!("rainbow: write failed: {e:#}"));
@@ -1231,13 +1715,28 @@ fn build_table(
1231 if last_tick.elapsed() > Duration::from_millis(250) {1715 if last_tick.elapsed() > Duration::from_millis(250) {
1232 last_tick = Instant::now();1716 last_tick = Instant::now();
1233 let secs = started.elapsed().as_secs_f64().max(1e-6);1717 let secs = started.elapsed().as_secs_f64().max(1e-6);
1234- send(tx, Event::RainbowProgress { done: written, hps: written as f64 / secs, total });1718+ send(
1719+ tx,
1720+ Event::RainbowProgress {
1721+ done: written,
1722+ hps: written as f64 / secs,
1723+ total,
1724+ },
1725+ );
1235 }1726 }
1236 if stop.load(Ordering::Relaxed) {1727 if stop.load(Ordering::Relaxed) {
1237 log(tx, "rainbow: build stopped — partial table kept");1728 log(tx, "rainbow: build stopped — partial table kept");
1238 break;1729 break;
1239 }1730 }
1240 }1731 }
1732+ let skipped_at_start = wordlist::skipped_lines();
1733+ let skipped = wordlist::skipped_lines() - skipped_at_start;
1734+ if skipped > 0 {
1735+ log(
1736+ tx,
1737+ format!("wordlist: {skipped} line(s) skipped (out-of-range or undecodable bytes)"),
1738+ );
1739+ }
1241 match table.finish() {1740 match table.finish() {
1242 Ok(n) => n,1741 Ok(n) => n,
1243 Err(e) => {1742 Err(e) => {
@@ -1257,7 +1756,7 @@ fn build_table(
1257 fn bench_cpu(secs: f64, stop: Option<&AtomicBool>) -> f64 {1756 fn bench_cpu(secs: f64, stop: Option<&AtomicBool>) -> f64 {
1258 const BATCH: u64 = 512;1757 const BATCH: u64 = 512;
1259 let word = b"benchmark1";1758 let word = b"benchmark1";
1260- let salt = b"wifilab-bench";1759+ let salt = b"wifi_lab-bench";
1261 let started = Instant::now();1760 let started = Instant::now();
1262 let mut done = 0u64;1761 let mut done = 0u64;
1263 loop {1762 loop {
@@ -1269,10 +1768,10 @@ fn bench_cpu(secs: f64, stop: Option<&AtomicBool>) -> f64 {
1269 if elapsed >= secs {1768 if elapsed >= secs {
1270 return done as f64 / elapsed.max(1e-6);1769 return done as f64 / elapsed.max(1e-6);
1271 }1770 }
1272- if let Some(s) = stop {1771+ if let Some(s) = stop
1273- if s.load(Ordering::Relaxed) {1772+ && s.load(Ordering::Relaxed)
1274- return done as f64 / elapsed.max(1e-6);1773+ {
1275- }1774+ return done as f64 / elapsed.max(1e-6);
1276 }1775 }
1277 }1776 }
1278 }1777 }
@@ -1284,19 +1783,21 @@ fn bench_gpu(secs: f64, stop: Option<&AtomicBool>) -> Option<f64> {
1284 let g = GpuCracker::try_new()?;1783 let g = GpuCracker::try_new()?;
1285 const BATCH: usize = 4096;1784 const BATCH: usize = 4096;
1286 let batch = vec![b"benchmark1".to_vec(); BATCH];1785 let batch = vec![b"benchmark1".to_vec(); BATCH];
1287- let salt = b"wifilab-bench";1786+ let salt = b"wifi_lab-bench";
1288 let started = Instant::now();1787 let started = Instant::now();
1289 let mut done = 0u64;1788 let mut done = 0u64;
1290 loop {1789 loop {
1291- done += g.pmk_batch_gpu(&batch, salt)?.len() as u64;1790+ // A mid-bench backend failure just ends the GPU half (the CPU
1791+ // number is still meaningful).
1792+ done += g.pmk_batch_gpu(&batch, salt).ok()?.len() as u64;
1292 let elapsed = started.elapsed().as_secs_f64();1793 let elapsed = started.elapsed().as_secs_f64();
1293 if elapsed >= secs {1794 if elapsed >= secs {
1294 return Some(done as f64 / elapsed.max(1e-6));1795 return Some(done as f64 / elapsed.max(1e-6));
1295 }1796 }
1296- if let Some(s) = stop {1797+ if let Some(s) = stop
1297- if s.load(Ordering::Relaxed) {1798+ && s.load(Ordering::Relaxed)
1298- return Some(done as f64 / elapsed.max(1e-6));1799+ {
1299- }1800+ return Some(done as f64 / elapsed.max(1e-6));
1300 }1801 }
1301 }1802 }
1302 }1803 }
@@ -1311,7 +1812,7 @@ pub fn benchmark(seconds: u32) -> (Option<f64>, f64) {
1311 (bench_gpu(secs, None), bench_cpu(secs, None))1812 (bench_gpu(secs, None), bench_cpu(secs, None))
1312 }1813 }
1313 1814
1314-/// Benchmark on a background thread ("wifilab-benchmark"); terminates1815+/// Benchmark on a background thread ("wifi_lab-benchmark"); terminates
1315 /// with exactly one `Event::BenchmarkDone { gpu_hps, cpu_hps }` (on spawn1816 /// with exactly one `Event::BenchmarkDone { gpu_hps, cpu_hps }` (on spawn
1316 /// failure: an `Error` plus a zeroed `BenchmarkDone`). Honors the stop1817 /// failure: an `Error` plus a zeroed `BenchmarkDone`). Honors the stop
1317 /// flag between batches. The UI guards against running it alongside a1818 /// flag between batches. The UI guards against running it alongside a
@@ -1322,17 +1823,29 @@ pub fn spawn_benchmark(seconds: u32, tx: Sender<Event>) -> Arc<AtomicBool> {
1322 let stop2 = stop.clone();1823 let stop2 = stop.clone();
1323 let err_tx = tx.clone();1824 let err_tx = tx.clone();
1324 let result = std::thread::Builder::new()1825 let result = std::thread::Builder::new()
1325- .name("wifilab-benchmark".into())1826+ .name("wifi_lab-benchmark".into())
1326 .spawn(move || {1827 .spawn(move || {
1327- log(&tx, format!("benchmark: measuring crack speed ({seconds}s per backend)"));1828+ log(
1829+ &tx,
1830+ format!("benchmark: measuring crack speed ({seconds}s per backend)"),
1831+ );
1328 let secs = seconds.max(1) as f64;1832 let secs = seconds.max(1) as f64;
1329 let gpu_hps = bench_gpu(secs, Some(&stop2));1833 let gpu_hps = bench_gpu(secs, Some(&stop2));
1330 let cpu_hps = bench_cpu(secs, Some(&stop2));1834 let cpu_hps = bench_cpu(secs, Some(&stop2));
1331 send(&tx, Event::BenchmarkDone { gpu_hps, cpu_hps });1835 send(&tx, Event::BenchmarkDone { gpu_hps, cpu_hps });
1332 });1836 });
1333 if let Err(e) = result {1837 if let Err(e) = result {
1334- send(&err_tx, Event::Error(format!("benchmark: spawn failed: {e}")));1838+ send(
1335- send(&err_tx, Event::BenchmarkDone { gpu_hps: None, cpu_hps: 0.0 });1839+ &err_tx,
1840+ Event::Error(format!("benchmark: spawn failed: {e}")),
1841+ );
1842+ send(
1843+ &err_tx,
1844+ Event::BenchmarkDone {
1845+ gpu_hps: None,
1846+ cpu_hps: 0.0,
1847+ },
1848+ );
1336 }1849 }
1337 stop1850 stop
1338 }1851 }
@@ -1365,7 +1878,7 @@ mod tests {
1365 f.extend_from_slice(&[0u8; 8]);1878 f.extend_from_slice(&[0u8; 8]);
1366 f.extend_from_slice(&[0u8; 16]);1879 f.extend_from_slice(&[0u8; 16]);
1367 f.extend_from_slice(&0u16.to_be_bytes());1880 f.extend_from_slice(&0u16.to_be_bytes());
1368- let m = crypto::mic(&dk, &f, 2);1881+ let m = crypto::mic_on_zeroed(&dk, &crypto::zeroed_eapol(&f), 2);
1369 CrackTarget::Handshake(HandshakeCapture::new(1882 CrackTarget::Handshake(HandshakeCapture::new(
1370 ap,1883 ap,
1371 sta,1884 sta,
@@ -1412,7 +1925,8 @@ mod tests {
1412 #[test]1925 #[test]
1413 fn bruteforce_seek_lands_exactly() {1926 fn bruteforce_seek_lands_exactly() {
1414 // seek(j) must equal collecting j items — across a length boundary.1927 // seek(j) must equal collecting j items — across a length boundary.
1415- let reference: Vec<Vec<u8>> = BruteForce::new(b"abcde".to_vec(), 8, 9, false).unwrap()1928+ let reference: Vec<Vec<u8>> = BruteForce::new(b"abcde".to_vec(), 8, 9, false)
1929+ .unwrap()
1416 .take(5usize.pow(8) + 40)1930 .take(5usize.pow(8) + 40)
1417 .collect();1931 .collect();
1418 for j in [0u64, 1, 17, 5u64.pow(8) - 1, 5u64.pow(8), 5u64.pow(8) + 39] {1932 for j in [0u64, 1, 17, 5u64.pow(8) - 1, 5u64.pow(8), 5u64.pow(8) + 39] {
@@ -1438,10 +1952,10 @@ mod tests {
1438 #[test]1952 #[test]
1439 fn rainbow_crack_finds_pass() {1953 fn rainbow_crack_finds_pass() {
1440 let pass = b"sup3r-secret";1954 let pass = b"sup3r-secret";
1441- let target = synthetic_target("parafin", pass);1955+ let target = synthetic_target("testnet", pass);
1442 let entries: Vec<([u8; 32], Vec<u8>)> = vec![1956 let entries: Vec<([u8; 32], Vec<u8>)> = vec![
1443- (crypto::pmk(b"nope-nope", b"parafin"), b"nope-nope".to_vec()),1957+ (crypto::pmk(b"nope-nope", b"testnet"), b"nope-nope".to_vec()),
1444- (crypto::pmk(pass, b"parafin"), pass.to_vec()),1958+ (crypto::pmk(pass, b"testnet"), pass.to_vec()),
1445 ];1959 ];
1446 let mut it = entries.into_iter();1960 let mut it = entries.into_iter();
1447 let stop = Arc::new(AtomicBool::new(false));1961 let stop = Arc::new(AtomicBool::new(false));
@@ -1454,18 +1968,18 @@ mod tests {
1454 // The exact files the worker threads touch: wordlist in, table out,1968 // The exact files the worker threads touch: wordlist in, table out,
1455 // crack via the table — no GPU required.1969 // crack via the table — no GPU required.
1456 let dir = std::env::temp_dir();1970 let dir = std::env::temp_dir();
1457- let wl = dir.join(format!("wifilab-attack-wl-{}", std::process::id()));1971+ let wl = dir.join(format!("wifi_lab-attack-wl-{}", std::process::id()));
1458- let tbl = dir.join(format!("wifilab-attack-tbl-{}", std::process::id()));1972+ let tbl = dir.join(format!("wifi_lab-attack-tbl-{}", std::process::id()));
1459 std::fs::write(&wl, "nope-nope\nsup3r-secret\nalsonope!\n").unwrap();1973 std::fs::write(&wl, "nope-nope\nsup3r-secret\nalsonope!\n").unwrap();
1460 1974
1461 let (etx, erx) = crossbeam_channel::unbounded();1975 let (etx, erx) = crossbeam_channel::unbounded();
1462 let stop = Arc::new(AtomicBool::new(false));1976 let stop = Arc::new(AtomicBool::new(false));
1463- let written = build_table("parafin", &wl, &tbl, &etx, &stop);1977+ let written = build_table("testnet", &wl, &tbl, &etx, &stop);
1464 assert_eq!(written, 3);1978 assert_eq!(written, 3);
1465 let built: Vec<Event> = erx.try_iter().collect();1979 let built: Vec<Event> = erx.try_iter().collect();
1466 assert!(!built.iter().any(|e| matches!(e, Event::Error(_))));1980 assert!(!built.iter().any(|e| matches!(e, Event::Error(_))));
1467 1981
1468- let target = synthetic_target("parafin", b"sup3r-secret");1982+ let target = synthetic_target("testnet", b"sup3r-secret");
1469 let (ssid, mut entries) = rainbow::open(&tbl).unwrap();1983 let (ssid, mut entries) = rainbow::open(&tbl).unwrap();
1470 rainbow::check_ssid(ssid.as_deref(), target.essid()).unwrap();1984 rainbow::check_ssid(ssid.as_deref(), target.essid()).unwrap();
1471 let found = rainbow_crack(&target, &mut entries, &mut |_, _| {}, &stop);1985 let found = rainbow_crack(&target, &mut entries, &mut |_, _| {}, &stop);
@@ -1486,12 +2000,12 @@ mod tests {
1486 // was a run that looked alive at 0 H/s forever). CPU fallback is2000 // was a run that looked alive at 0 H/s forever). CPU fallback is
1487 // fine — the GPU path shares the same word_crack wrapper.2001 // fine — the GPU path shares the same word_crack wrapper.
1488 let dir = std::env::temp_dir();2002 let dir = std::env::temp_dir();
1489- let wl = dir.join(format!("wifilab-spawn-wl-{}", std::process::id()));2003+ let wl = dir.join(format!("wifi_lab-spawn-wl-{}", std::process::id()));
1490 std::fs::write(&wl, "wrong-pass1\nsup3r-secret\nwrong-pass2\n").unwrap();2004 std::fs::write(&wl, "wrong-pass1\nsup3r-secret\nwrong-pass2\n").unwrap();
1491- let target = synthetic_target("parafin", b"sup3r-secret");2005+ let target = synthetic_target("testnet", b"sup3r-secret");
1492 let (etx, erx) = crossbeam_channel::unbounded();2006 let (etx, erx) = crossbeam_channel::unbounded();
1493 // force_cpu: deterministic CPU run AND no PMK-cache writes into2007 // force_cpu: deterministic CPU run AND no PMK-cache writes into
1494- // the real ~/wifilab/cache from a test.2008+ // the real ~/wifi_lab/cache from a test.
1495 let _stop = spawn_crack(2009 let _stop = spawn_crack(
1496 target.describe(),2010 target.describe(),
1497 target,2011 target,
@@ -1523,7 +2037,7 @@ mod tests {
1523 #[test]2037 #[test]
1524 #[ignore = "smoke: user's real stored capture + GPU; run on demand"]2038 #[ignore = "smoke: user's real stored capture + GPU; run on demand"]
1525 fn smoke_real_stored_capture() {2039 fn smoke_real_stored_capture() {
1526- let caps = crate::store::load_captures().expect(" ~/wifilab/captures.jsonl");2040+ let caps = crate::store::load_captures().expect(" ~/wifi_lab/captures.jsonl");
1527 let target = caps2041 let target = caps
1528 .iter()2042 .iter()
1529 .find_map(|c| match c {2043 .find_map(|c| match c {
@@ -1537,17 +2051,23 @@ mod tests {
1537 eprintln!("smoke target: {}", target.describe());2051 eprintln!("smoke target: {}", target.describe());
1538 2052
1539 let dir = std::env::temp_dir();2053 let dir = std::env::temp_dir();
1540- let wl = dir.join("wifilab-smoke-wl.txt");2054+ let wl = dir.join("wifi_lab-smoke-wl.txt");
1541 std::fs::write(&wl, "password123\nletmein123\nqwertyuiop1\n").unwrap();2055 std::fs::write(&wl, "password123\nletmein123\nqwertyuiop1\n").unwrap();
1542- let tbl = dir.join("wifilab-smoke.pmk");2056+ let tbl = dir.join("wifi_lab-smoke.pmk");
1543 2057
1544 let drain = |erx: &crossbeam_channel::Receiver<Event>, what: &str| {2058 let drain = |erx: &crossbeam_channel::Receiver<Event>, what: &str| {
1545 let mut saw_progress = false;2059 let mut saw_progress = false;
1546 let deadline = std::time::Instant::now() + Duration::from_secs(180);2060 let deadline = std::time::Instant::now() + Duration::from_secs(180);
1547 loop {2061 loop {
1548- assert!(std::time::Instant::now() < deadline, "{what}: no terminator");2062+ assert!(
2063+ std::time::Instant::now() < deadline,
2064+ "{what}: no terminator"
2065+ );
1549 match erx.recv_timeout(Duration::from_secs(10)) {2066 match erx.recv_timeout(Duration::from_secs(10)) {
1550- Ok(Event::CrackProgress { done, hps, .. } | Event::RainbowProgress { done, hps, .. }) => {2067+ Ok(
2068+ Event::CrackProgress { done, hps, .. }
2069+ | Event::RainbowProgress { done, hps, .. },
2070+ ) => {
1551 if done > 0 {2071 if done > 0 {
1552 saw_progress = true;2072 saw_progress = true;
1553 assert!(hps > 0.0, "{what}: progress with 0 H/s");2073 assert!(hps > 0.0, "{what}: progress with 0 H/s");
@@ -1566,12 +2086,22 @@ mod tests {
1566 Err(_) => panic!("{what}: channel silence"),2086 Err(_) => panic!("{what}: channel silence"),
1567 }2087 }
1568 }2088 }
1569- assert!(saw_progress || what.contains("build"), "{what}: zero progress events");2089+ assert!(
2090+ saw_progress || what.contains("build"),
2091+ "{what}: zero progress events"
2092+ );
1570 };2093 };
1571 2094
1572 // 1. wordlist run (GPU): the exact stuck path from the bug report.2095 // 1. wordlist run (GPU): the exact stuck path from the bug report.
1573 let (tx, rx) = crossbeam_channel::unbounded();2096 let (tx, rx) = crossbeam_channel::unbounded();
1574- let _s1 = spawn_crack(target.describe(), target.clone(), Attack::Wordlist(wl.clone()), 0, tx, false);2097+ let _s1 = spawn_crack(
2098+ target.describe(),
2099+ target.clone(),
2100+ Attack::Wordlist(wl.clone()),
2101+ 0,
2102+ tx,
2103+ false,
2104+ );
1575 drain(&rx, "wordlist run");2105 drain(&rx, "wordlist run");
1576 2106
1577 // 2. rainbow build then run (GPU for the build).2107 // 2. rainbow build then run (GPU for the build).
@@ -1579,7 +2109,14 @@ mod tests {
1579 let _s2 = spawn_rainbow_build(ssid, wl.clone(), tbl.clone(), tx);2109 let _s2 = spawn_rainbow_build(ssid, wl.clone(), tbl.clone(), tx);
1580 drain(&rx, "rainbow build");2110 drain(&rx, "rainbow build");
1581 let (tx, rx) = crossbeam_channel::unbounded();2111 let (tx, rx) = crossbeam_channel::unbounded();
1582- let _s3 = spawn_crack(target.describe(), target, Attack::Rainbow(tbl.clone()), 0, tx, false);2112+ let _s3 = spawn_crack(
2113+ target.describe(),
2114+ target,
2115+ Attack::Rainbow(tbl.clone()),
2116+ 0,
2117+ tx,
2118+ false,
2119+ );
1583 drain(&rx, "rainbow run");2120 drain(&rx, "rainbow run");
1584 2121
1585 let _ = std::fs::remove_file(&wl);2122 let _ = std::fs::remove_file(&wl);
@@ -1590,9 +2127,9 @@ mod tests {
1590 fn resume_from_skips_checked_candidates() {2127 fn resume_from_skips_checked_candidates() {
1591 // wordlist positions: 0 wrong, 1 wrong, 2 TARGET, 3 wrong.2128 // wordlist positions: 0 wrong, 1 wrong, 2 TARGET, 3 wrong.
1592 let dir = std::env::temp_dir();2129 let dir = std::env::temp_dir();
1593- let wl = dir.join(format!("wifilab-resume-wl-{}", std::process::id()));2130+ let wl = dir.join(format!("wifi_lab-resume-wl-{}", std::process::id()));
1594 std::fs::write(&wl, "wrong-pass1\nwrong-pass2\nsup3r-secret\nwrong-pass3\n").unwrap();2131 std::fs::write(&wl, "wrong-pass1\nwrong-pass2\nsup3r-secret\nwrong-pass3\n").unwrap();
1595- let target = synthetic_target("parafin", b"sup3r-secret");2132+ let target = synthetic_target("testnet", b"sup3r-secret");
1596 2133
1597 let run = |resume_from: u64| -> (Option<String>, bool) {2134 let run = |resume_from: u64| -> (Option<String>, bool) {
1598 let (etx, erx) = crossbeam_channel::unbounded();2135 let (etx, erx) = crossbeam_channel::unbounded();
@@ -1640,9 +2177,14 @@ mod tests {
1640 .is_err()2177 .is_err()
1641 );2178 );
1642 assert!(2179 assert!(
1643- Attack::Bruteforce { charset: b"01".to_vec(), min: 8, max: 10, freq_order: false }2180+ Attack::Bruteforce {
1644- .validate()2181+ charset: b"01".to_vec(),
1645- .is_ok()2182+ min: 8,
2183+ max: 10,
2184+ freq_order: false
2185+ }
2186+ .validate()
2187+ .is_ok()
1646 );2188 );
1647 assert!(2189 assert!(
1648 Attack::Rules {2190 Attack::Rules {
@@ -1706,7 +2248,7 @@ mod tests {
1706 #[test]2248 #[test]
1707 fn parse_rules_skips_comments_and_blanks() {2249 fn parse_rules_skips_comments_and_blanks() {
1708 let dir = std::env::temp_dir();2250 let dir = std::env::temp_dir();
1709- let path = dir.join(format!("wifilab-rules-{}", std::process::id()));2251+ let path = dir.join(format!("wifi_lab-rules-{}", std::process::id()));
1710 std::fs::write(&path, "# comment\n\n:\nl\n$1\n# another\nso0\n").unwrap();2252 std::fs::write(&path, "# comment\n\n:\nl\n$1\n# another\nso0\n").unwrap();
1711 let rules = parse_rules(&path).unwrap();2253 let rules = parse_rules(&path).unwrap();
1712 assert_eq!(rules.len(), 4);2254 assert_eq!(rules.len(), 4);
@@ -1717,17 +2259,17 @@ mod tests {
1717 #[test]2259 #[test]
1718 fn rule_iter_flatten_and_resume_continuation() {2260 fn rule_iter_flatten_and_resume_continuation() {
1719 // 3 words × 2 rules: flattened order is word-major / rule-minor.2261 // 3 words × 2 rules: flattened order is word-major / rule-minor.
1720- let words: Vec<Vec<u8>> =2262+ let words: Vec<Vec<u8>> = vec![
1721- vec![b"password".to_vec(), b"letmein1".to_vec(), b"hunter22".to_vec()];2263+ b"password".to_vec(),
2264+ b"letmein1".to_vec(),
2265+ b"hunter22".to_vec(),
2266+ ];
1722 let rules = std::rc::Rc::new(vec![2267 let rules = std::rc::Rc::new(vec![
1723 parse_rule_line(b":", 0).unwrap(),2268 parse_rule_line(b":", 0).unwrap(),
1724 parse_rule_line(b"$1", 0).unwrap(),2269 parse_rule_line(b"$1", 0).unwrap(),
1725 ]);2270 ]);
1726 let collect_from = |it: &mut dyn Iterator<Item = Vec<u8>>| -> Vec<Vec<u8>> { it.collect() };2271 let collect_from = |it: &mut dyn Iterator<Item = Vec<u8>>| -> Vec<Vec<u8>> { it.collect() };
1727- let mut full = RuleIter::new(2272+ let mut full = RuleIter::new(Box::new(words.clone().into_iter()), rules.clone());
1728- Box::new(words.clone().into_iter()),
1729- rules.clone(),
1730- );
1731 let got = collect_from(&mut full);2273 let got = collect_from(&mut full);
1732 assert_eq!(2274 assert_eq!(
1733 got,2275 got,
@@ -1741,14 +2283,15 @@ mod tests {
1741 ]2283 ]
1742 );2284 );
1743 // Resume: skip_n(3) must continue exactly with candidate #3.2285 // Resume: skip_n(3) must continue exactly with candidate #3.
1744- let mut resumed = RuleIter::new(2286+ let mut resumed = RuleIter::new(Box::new(words.into_iter()), rules);
1745- Box::new(words.into_iter()),
1746- rules,
1747- );
1748 skip_n(&mut resumed, 3);2287 skip_n(&mut resumed, 3);
1749 assert_eq!(2288 assert_eq!(
1750 collect_from(&mut resumed),2289 collect_from(&mut resumed),
1751- vec![b"letmein11".to_vec(), b"hunter22".to_vec(), b"hunter221".to_vec()]2290+ vec![
2291+ b"letmein11".to_vec(),
2292+ b"hunter22".to_vec(),
2293+ b"hunter221".to_vec()
2294+ ]
1752 );2295 );
1753 }2296 }
1754 2297
@@ -1790,8 +2333,7 @@ mod tests {
1790 assert_eq!(got, reference[n as usize..], "seek_flat({n})");2333 assert_eq!(got, reference[n as usize..], "seek_flat({n})");
1791 }2334 }
1792 // Past the end: empty.2335 // Past the end: empty.
1793- let mut it =2336+ let mut it = HybridIter::new(Box::new(words.into_iter()), b"ab".to_vec(), 1, 2).unwrap();
1794- HybridIter::new(Box::new(words.into_iter()), b"ab".to_vec(), 1, 2).unwrap();
1795 it.seek_flat(12);2337 it.seek_flat(12);
1796 assert_eq!(it.next(), None);2338 assert_eq!(it.next(), None);
1797 }2339 }
@@ -1802,10 +2344,304 @@ mod tests {
1802 // but flattened slots still consumed: seeking past the first2344 // but flattened slots still consumed: seeking past the first
1803 // word's 6 slots lands at the second word's first candidate.2345 // word's 6 slots lands at the second word's first candidate.
1804 let long_word = vec![b'x'; 63];2346 let long_word = vec![b'x'; 63];
1805- let words: Vec<Vec<u8>> = vec![long_word, b"password".to_vec()];2347+ let words: Vec<Vec<u8>> = vec![long_word.clone(), b"password".to_vec()];
1806- let mut it = HybridIter::new(Box::new(words.into_iter()), b"ab".to_vec(), 1, 2).unwrap();2348+ let mut it =
2349+ HybridIter::new(Box::new(words.clone().into_iter()), b"ab".to_vec(), 1, 2).unwrap();
1807 it.seek_flat(6);2350 it.seek_flat(6);
1808 assert_eq!(it.next().unwrap(), b"passworda");2351 assert_eq!(it.next().unwrap(), b"passworda");
2352+
2353+ // EXACT semantics: running through the overlong word consumes all
2354+ // of its 6 slots, so the STREAM position after the run equals the
2355+ // position seek_flat(6) addresses — resume can use the live
2356+ // position directly, no drift.
2357+ let mut run = HybridIter::new(Box::new(words.into_iter()), b"ab".to_vec(), 1, 2).unwrap();
2358+ assert_eq!(run.next().unwrap(), b"passworda");
2359+ assert_eq!(run.raw_pos(), 7, "six filtered slots + one yielded");
2360+ let mut resumed = HybridIter::new(
2361+ Box::new(vec![long_word, b"password".to_vec()].into_iter()),
2362+ b"ab".to_vec(),
2363+ 1,
2364+ 2,
2365+ )
2366+ .unwrap();
2367+ resumed.seek_flat(7);
2368+ assert_eq!(resumed.next().unwrap(), b"passwordb");
2369+ }
2370+
2371+ #[test]
2372+ fn hybrid_raw_pos_exact_through_overlong_word() {
2373+ // The overlong word contributes NOTHING but still consumes its
2374+ // full flattened block — raw positions jump from 0 to 6 (per_word)
2375+ // to 12 without any yield, then the second word emits at 6..11.
2376+ let long_word = vec![b'x'; 63];
2377+ let words: Vec<Vec<u8>> = vec![long_word, b"hunter22".to_vec()];
2378+ let mut it = HybridIter::new(Box::new(words.into_iter()), b"ab".to_vec(), 1, 2).unwrap();
2379+ let mut positions = Vec::new();
2380+ let mut out = Vec::new();
2381+ while let Some(c) = it.next() {
2382+ positions.push(it.raw_pos());
2383+ out.push(c);
2384+ }
2385+ assert_eq!(out.len(), 6, "only the 8-byte word yields");
2386+ assert_eq!(positions, vec![7, 8, 9, 10, 11, 12]);
2387+ // Resuming at each recorded raw position must continue exactly.
2388+ for (i, &pos) in positions.iter().enumerate() {
2389+ let words: Vec<Vec<u8>> = vec![vec![b'x'; 63], b"hunter22".to_vec()];
2390+ let mut r = HybridIter::new(Box::new(words.into_iter()), b"ab".to_vec(), 1, 2).unwrap();
2391+ r.seek_flat(pos);
2392+ let rest: Vec<Vec<u8>> = r.collect();
2393+ assert_eq!(rest, out[i + 1..], "resume at raw {pos}");
2394+ }
2395+ }
2396+
2397+ #[test]
2398+ fn rule_iter_raw_pos_and_seek_flat_exact() {
2399+ // Positions count filter-consumed slots; seek_flat(pos) continues
2400+ // exactly where a run at raw position `pos` would.
2401+ let words: Vec<Vec<u8>> = vec![b"password".to_vec(), b"letmein1".to_vec()];
2402+ let rules = Rc::new(vec![
2403+ parse_rule_line(b"]", 0).unwrap(), // 8-byte word → 7 bytes: FILTERED
2404+ parse_rule_line(b":", 0).unwrap(),
2405+ parse_rule_line(b"$!", 0).unwrap(),
2406+ ]);
2407+ let mut it = RuleIter::new(Box::new(words.clone().into_iter()), rules.clone());
2408+ let mut seen = Vec::new();
2409+ while let Some(c) = it.next() {
2410+ seen.push((it.raw_pos(), c));
2411+ }
2412+ // 2 words × 3 rules = 6 slots; the two `]` outputs (7 bytes) are
2413+ // filtered, so 4 yields at raw positions after each slot.
2414+ assert_eq!(
2415+ seen,
2416+ vec![
2417+ (2, b"password".to_vec()),
2418+ (3, b"password!".to_vec()),
2419+ (5, b"letmein1".to_vec()),
2420+ (6, b"letmein1!".to_vec()),
2421+ ]
2422+ );
2423+ // Resume from every recorded position plus interesting slots
2424+ // (including a filtered one) continues exactly.
2425+ let reference: Vec<Vec<u8>> = seen.iter().map(|(_, c)| c.clone()).collect();
2426+ for start in 0..=6u64 {
2427+ let mut r = RuleIter::new(Box::new(words.clone().into_iter()), rules.clone());
2428+ r.seek_flat(start);
2429+ let rest: Vec<Vec<u8>> = r.collect();
2430+ let want: Vec<Vec<u8>> = seen
2431+ .iter()
2432+ .filter(|(pos, _)| *pos > start)
2433+ .map(|(_, c)| c.clone())
2434+ .collect();
2435+ assert_eq!(rest, want, "seek_flat({start}) of {reference:?}");
2436+ }
2437+ }
2438+
2439+ #[test]
2440+ fn pos_feed_progress_maps_to_raw_positions() {
2441+ // Cache-covered candidates are dropped between raw stream and
2442+ // backend, and the backend reports counts in POST-skip terms; the
2443+ // progress translation must still yield raw positions.
2444+ let words: Vec<Vec<u8>> = (0..6u8).map(|i| vec![b'0' + i; 8]).collect();
2445+ let covered: HashSet<Box<[u8]>> = [
2446+ vec![b'1'; 8].into_boxed_slice(),
2447+ vec![b'3'; 8].into_boxed_slice(),
2448+ ]
2449+ .into_iter()
2450+ .collect();
2451+ let raw = CountIter::at(words.into_iter(), 0);
2452+ let stream: Box<dyn RawPosIter> = Box::new(CacheSkipIter::new(raw, covered));
2453+ let (mut feed, map) = PosFeed::new(stream);
2454+ // Backend pulls its first batch (all 4 surviving candidates), then
2455+ // reports progress in two chunks.
2456+ let pulled: Vec<Vec<u8>> = feed.by_ref().collect();
2457+ assert_eq!(pulled.len(), 4);
2458+ let mut acked = 0u64;
2459+ assert_eq!(raw_position_of(&map, &mut acked, 1), Some(1));
2460+ assert_eq!(
2461+ raw_position_of(&map, &mut acked, 2),
2462+ Some(3),
2463+ "skipped raw 1,2"
2464+ );
2465+ assert_eq!(
2466+ raw_position_of(&map, &mut acked, 4),
2467+ Some(6),
2468+ "skipped raw 3,4"
2469+ );
2470+ // Map drained: every confirmed candidate consumed exactly its raw
2471+ // position; resume at 6 continues past '0'..'5'.
2472+ assert!(map.borrow().is_empty());
2473+ // Underflow (a progress tick beyond recorded yields) is a no-op.
2474+ assert_eq!(raw_position_of(&map, &mut acked, 5), None);
2475+ }
2476+
2477+ #[test]
2478+ fn gpu_pmk_batch_tail_is_computed() {
2479+ // Fake kernel: succeeds only with a PREFIX — first call returns
2480+ // half, subsequent calls again shorter prefixes — the loop must
2481+ // keep asking until every word has its PMK.
2482+ let batch: Vec<Vec<u8>> = (0..5u8).map(|i| vec![b'a' + i; 8]).collect();
2483+ let salt = b"testnet";
2484+ let mut calls = 0usize;
2485+ let pmks = gpu_pmk_batch_full(
2486+ &mut |slice: &[Vec<u8>]| {
2487+ calls += 1;
2488+ let n = if slice.len() == 1 { 1 } else { slice.len() / 2 };
2489+ Ok(slice[..n].iter().map(|w| crypto::pmk(w, salt)).collect())
2490+ },
2491+ &batch,
2492+ )
2493+ .unwrap();
2494+ assert_eq!(pmks.len(), batch.len(), "tail words must not vanish");
2495+ for (pmk, w) in pmks.iter().zip(batch.iter()) {
2496+ assert_eq!(pmk, &crypto::pmk(w, salt));
2497+ }
2498+ assert!(
2499+ calls >= 4,
2500+ "prefix returns force several tail calls ({calls})"
2501+ );
2502+ }
2503+
2504+ #[test]
2505+ fn gpu_pmk_batch_err_propagates_and_empty_aborts() {
2506+ let batch: Vec<Vec<u8>> = vec![b"password1".to_vec(), b"password2".to_vec()];
2507+ let err = gpu_pmk_batch_full(&mut |_| Err(gpu::GpuError::Lost), &batch).unwrap_err();
2508+ assert_eq!(err, gpu::GpuError::Lost);
2509+ // A zero-PMK Ok would spin forever without the guard.
2510+ let err = gpu_pmk_batch_full(&mut |_| Ok(Vec::new()), &batch).unwrap_err();
2511+ assert!(matches!(err, gpu::GpuError::Unsupported(_)));
2512+ }
2513+
2514+ #[test]
2515+ fn spawn_crack_worker_panic_becomes_crack_error() {
2516+ // An invalid attack that BYPASSES validate() (empty hybrid
2517+ // charset) panics inside the worker at the `.expect("validated")`
2518+ // — the terminator must be CrackError, not a fake "exhausted".
2519+ let target = synthetic_target("testnet", b"sup3r-secret");
2520+ let wl = std::env::temp_dir().join(format!("wifi_lab-panic-wl-{}", std::process::id()));
2521+ std::fs::write(&wl, "whatever1\n").unwrap();
2522+ let (etx, erx) = crossbeam_channel::unbounded();
2523+ let _stop = spawn_crack(
2524+ "test".to_string(),
2525+ target,
2526+ Attack::Hybrid {
2527+ wordlist: wl.clone(),
2528+ charset: Vec::new(),
2529+ min: 1,
2530+ max: 2,
2531+ },
2532+ 0,
2533+ etx,
2534+ true,
2535+ );
2536+ let deadline = std::time::Instant::now() + Duration::from_secs(30);
2537+ let got_error = loop {
2538+ assert!(
2539+ std::time::Instant::now() < deadline,
2540+ "no terminator after worker panic"
2541+ );
2542+ match erx.recv_timeout(Duration::from_secs(5)) {
2543+ Ok(Event::CrackError { reason }) => break reason,
2544+ Ok(Event::CrackStopped { found }) => {
2545+ panic!("panic was mis-reported as CrackStopped {{ found: {found} }}")
2546+ }
2547+ Ok(Event::Error(_)) => {} // the panic's log line
2548+ Ok(_) => {}
2549+ Err(_) => panic!("channel silent — no terminator"),
2550+ }
2551+ };
2552+ assert!(got_error.contains("panicked"));
2553+ let _ = std::fs::remove_file(&wl);
2554+ }
2555+
2556+ #[test]
2557+ fn rainbow_resume_position_exact() {
2558+ // Build a 3-entry table, resume at 1 and at 3: the position is a
2559+ // raw entry index — 1 finds the planted pass, 3 exhausts.
2560+ let dir = std::env::temp_dir();
2561+ let wl = dir.join(format!("wifi_lab-rbresume-wl-{}", std::process::id()));
2562+ let tbl = dir.join(format!("wifi_lab-rbresume-tbl-{}", std::process::id()));
2563+ std::fs::write(&wl, "wrong-pass1\nsup3r-secret\nwrong-pass2\n").unwrap();
2564+ let (etx, _erx) = crossbeam_channel::unbounded();
2565+ let stop = Arc::new(AtomicBool::new(false));
2566+ assert_eq!(build_table("testnet", &wl, &tbl, &etx, &stop), 3);
2567+
2568+ let target = synthetic_target("testnet", b"sup3r-secret");
2569+ let run = |resume_from: u64| -> (Option<String>, bool) {
2570+ let (etx, erx) = crossbeam_channel::unbounded();
2571+ let _s = spawn_crack(
2572+ target.describe(),
2573+ target.clone(),
2574+ Attack::Rainbow(tbl.clone()),
2575+ resume_from,
2576+ etx,
2577+ true,
2578+ );
2579+ let mut pass = None;
2580+ let deadline = std::time::Instant::now() + Duration::from_secs(60);
2581+ loop {
2582+ assert!(std::time::Instant::now() < deadline, "no terminator");
2583+ match erx.recv_timeout(Duration::from_secs(5)) {
2584+ Ok(Event::CrackFound { password }) => pass = Some(password),
2585+ Ok(Event::CrackStopped { found }) => return (pass, found),
2586+ Ok(Event::CrackError { reason }) => panic!("backend error: {reason}"),
2587+ Ok(Event::Error(l)) => panic!("worker error: {l}"),
2588+ Ok(_) => {}
2589+ Err(_) => panic!("channel silent"),
2590+ }
2591+ }
2592+ };
2593+ assert_eq!(run(1), (Some("sup3r-secret".to_string()), true));
2594+ assert_eq!(run(3), (None, false));
2595+ let _ = std::fs::remove_file(&wl);
2596+ let _ = std::fs::remove_file(&tbl);
2597+ }
2598+
2599+ #[test]
2600+ fn resume_progress_reports_raw_positions() {
2601+ // End-to-end position semantics at the event level: a resumed
2602+ // wordlist run reports progress as RAW stream positions — the
2603+ // first tick after a resume at 1 with a 512-item CPU batch is raw
2604+ // 513 (1 + 512 confirmed), not the old post-filter yield count.
2605+ let dir = std::env::temp_dir();
2606+ let wl = dir.join(format!("wifi_lab-rawpos-wl-{}", std::process::id()));
2607+ let mut lines: Vec<String> = (0..700).map(|i| format!("filler-{i:04}")).collect();
2608+ lines[650] = "sup3r-secret".to_string();
2609+ std::fs::write(&wl, lines.join("\n") + "\n").unwrap();
2610+ // A test-unique SSID keeps the real per-SSID PMK cache out of the
2611+ // run (consult proceeds straight to a miss).
2612+ let target = synthetic_target("rawpos-test-ssid", b"sup3r-secret");
2613+ let (etx, erx) = crossbeam_channel::unbounded();
2614+ let _s = spawn_crack(
2615+ target.describe(),
2616+ target,
2617+ Attack::Wordlist(wl.clone()),
2618+ 1,
2619+ etx,
2620+ true,
2621+ );
2622+ let mut positions = Vec::new();
2623+ let mut found = false;
2624+ let deadline = std::time::Instant::now() + Duration::from_secs(120);
2625+ loop {
2626+ assert!(std::time::Instant::now() < deadline, "no terminator");
2627+ match erx.recv_timeout(Duration::from_secs(30)) {
2628+ Ok(Event::CrackProgress { done, .. }) => positions.push(done),
2629+ Ok(Event::CrackFound { password }) => {
2630+ assert_eq!(password, "sup3r-secret");
2631+ found = true;
2632+ }
2633+ Ok(Event::CrackStopped { found: true }) => break,
2634+ Ok(Event::CrackError { reason }) => panic!("backend error: {reason}"),
2635+ Ok(Event::Error(l)) => panic!("worker error: {l}"),
2636+ Ok(_) => {}
2637+ Err(_) => panic!("channel silent"),
2638+ }
2639+ }
2640+ assert!(found);
2641+ // Resume(1) + first full batch of 512 confirmed = raw 513; then
2642+ // the find short-circuits batch 2 before its tick.
2643+ assert_eq!(positions, vec![513]);
2644+ let _ = std::fs::remove_file(&wl);
1809 }2645 }
1810 2646
1811 #[test]2647 #[test]
@@ -1820,9 +2656,12 @@ mod tests {
1820 assert_eq!(first[3], b"eeeeeezz");2656 assert_eq!(first[3], b"eeeeeezz");
1821 // Sanitizer: the space is still a bijection (size + seek match2657 // Sanitizer: the space is still a bijection (size + seek match
1822 // the lexicographic construction).2658 // the lexicographic construction).
1823- let freq: Vec<Vec<u8>> = BruteForce::new(b"wze1".to_vec(), 8, 8, true).unwrap().collect();2659+ let freq: Vec<Vec<u8>> = BruteForce::new(b"wze1".to_vec(), 8, 8, true)
1824- let mut plain: Vec<Vec<u8>> =2660+ .unwrap()
1825- BruteForce::new(b"wze1".to_vec(), 8, 8, false).unwrap().collect();2661+ .collect();
2662+ let mut plain: Vec<Vec<u8>> = BruteForce::new(b"wze1".to_vec(), 8, 8, false)
2663+ .unwrap()
2664+ .collect();
1826 plain.sort();2665 plain.sort();
1827 let mut freq_sorted = freq.clone();2666 let mut freq_sorted = freq.clone();
1828 freq_sorted.sort();2667 freq_sorted.sort();
@@ -1832,7 +2671,11 @@ mod tests {
1832 let mut s = BruteForce::new(b"wze1".to_vec(), 8, 8, true).unwrap();2671 let mut s = BruteForce::new(b"wze1".to_vec(), 8, 8, true).unwrap();
1833 s.seek(n);2672 s.seek(n);
1834 let got: Vec<Vec<u8>> = s.by_ref().take(3).collect();2673 let got: Vec<Vec<u8>> = s.by_ref().take(3).collect();
1835- assert_eq!(got, freq[n as usize..(n as usize + 3).min(freq.len())], "seek({n})");2674+ assert_eq!(
2675+ got,
2676+ freq[n as usize..(n as usize + 3).min(freq.len())],
2677+ "seek({n})"
2678+ );
1836 }2679 }
1837 }2680 }
1838 2681
@@ -1843,9 +2686,10 @@ mod tests {
1843 b"letmein1".to_vec(),2686 b"letmein1".to_vec(),
1844 b"hunter22".to_vec(),2687 b"hunter22".to_vec(),
1845 ];2688 ];
1846- let covered: HashSet<Box<[u8]>> = [b"letmein1".as_slice().into(), b"hunter22".as_slice().into()]2689+ let covered: HashSet<Box<[u8]>> =
1847- .into_iter()2690+ [b"letmein1".as_slice().into(), b"hunter22".as_slice().into()]
1848- .collect();2691+ .into_iter()
2692+ .collect();
1849 let it = CacheSkipIter::new(words.into_iter(), covered);2693 let it = CacheSkipIter::new(words.into_iter(), covered);
1850 assert_eq!(it.collect::<Vec<_>>(), vec![b"password".to_vec()]);2694 assert_eq!(it.collect::<Vec<_>>(), vec![b"password".to_vec()]);
1851 // Empty coverage = pass-through.2695 // Empty coverage = pass-through.
src/cli.rsmodified+99 -15
@@ -1,9 +1,10 @@
1-//! Headless `wifilab crack` subcommand: crack one capture file with no UI,1+//! Headless `wifi_lab crack` subcommand: crack one capture file with no UI,
2 //! no radio and no root. The capture file is hc22000 text (one `WPA*01*` /2 //! no radio and no root. The capture file is hc22000 text (one `WPA*01*` /
3 //! `WPA*02*` line per capture, hashcat -m 22000); the first line that parses3 //! `WPA*02*` line per capture, hashcat -m 22000); the first line that parses
4 //! is the target, everything else is ignored.4 //! is the target, everything else is ignored.
5 //!5 //!
6-//! Exit codes: 0 password found, 1 keyspace exhausted, 2 usage/IO error.6+//! Exit codes: 0 password found, 1 keyspace exhausted, 2 usage/IO/backend
7+//! error (backend = `Event::CrackError`, e.g. GPU device lost).
7 8
8 use std::io::Write;9 use std::io::Write;
9 use std::path::PathBuf;10 use std::path::PathBuf;
@@ -123,7 +124,22 @@ pub fn run_crack_cli(args: CliCrack, out: &mut dyn Write) -> i32 {
123 124
124 let (tx, rx) = crossbeam_channel::unbounded();125 let (tx, rx) = crossbeam_channel::unbounded();
125 let _stop = attack::spawn_crack(target.describe(), target, attack, 0, tx, args.cpu);126 let _stop = attack::spawn_crack(target.describe(), target, attack, 0, tx, args.cpu);
127+ crack_event_loop(&rx, out)
128+}
126 129
130+/// Consume crack-job `Event`s until the job terminates; returns the process
131+/// exit code: 0 password found, 1 keyspace exhausted, 2 error. Extracted
132+/// from `run_crack_cli` so the verdict logic is testable without a real
133+/// crack worker.
134+///
135+/// `Event::CrackError` (backend failure — NOT exhaustion) prints its reason
136+/// with the same `error:` prefix as other errors and forces exit 2 even if
137+/// a `CrackStopped { found: false }` follows (the error supersedes the
138+/// stop verdict, unless a password was already reported). Capture events
139+/// (handshakes/PMKIDs, incl. partial M2+M3 pairs) carry no crack verdict
140+/// here — CLI targets come from the capture file, not from events — and
141+/// are ignored.
142+fn crack_event_loop(rx: &crossbeam_channel::Receiver<Event>, out: &mut dyn Write) -> i32 {
127 let mut found = false;143 let mut found = false;
128 let mut exit = 1;144 let mut exit = 1;
129 let mut last = Instant::now() - Duration::from_secs(3);145 let mut last = Instant::now() - Duration::from_secs(3);
@@ -149,6 +165,10 @@ pub fn run_crack_cli(args: CliCrack, out: &mut dyn Write) -> i32 {
149 let _ = writeln!(out, "error: {line}");165 let _ = writeln!(out, "error: {line}");
150 exit = 2;166 exit = 2;
151 }167 }
168+ Event::CrackError { reason } => {
169+ let _ = writeln!(out, "error: {reason}");
170+ exit = 2;
171+ }
152 Event::CrackFound { password } => {172 Event::CrackFound { password } => {
153 let _ = writeln!(out, "FOUND: {password}");173 let _ = writeln!(out, "FOUND: {password}");
154 found = true;174 found = true;
@@ -178,13 +198,13 @@ mod tests {
178 /// (the private `MOCK_PASSWORD` const in ui/cracker.rs — value pinned198 /// (the private `MOCK_PASSWORD` const in ui/cracker.rs — value pinned
179 /// here so the test trips loudly if the mock password ever changes).199 /// here so the test trips loudly if the mock password ever changes).
180 fn crackable_capture() -> crate::common::HandshakeCapture {200 fn crackable_capture() -> crate::common::HandshakeCapture {
181- const MOCK_PW: &str = "parafin2024!";201+ const MOCK_PW: &str = "testnet2024!";
182 let ap = MacAddr([0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]);202 let ap = MacAddr([0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]);
183 let client = MacAddr([0x11, 0x22, 0x33, 0x44, 0x55, 0x66]);203 let client = MacAddr([0x11, 0x22, 0x33, 0x44, 0x55, 0x66]);
184 let mut cap = crate::ui::mock::fabricate_handshake(ap, client, "testap", 7);204 let mut cap = crate::ui::mock::fabricate_handshake(ap, client, "testap", 7);
185 let pmk = crypto::pmk(MOCK_PW.as_bytes(), b"testap");205 let pmk = crypto::pmk(MOCK_PW.as_bytes(), b"testap");
186 let ptk = crypto::ptk(&pmk, &ap, &client, &cap.anonce, &cap.snonce);206 let ptk = crypto::ptk(&pmk, &ap, &client, &cap.anonce, &cap.snonce);
187- let mic = crypto::mic(&ptk, &cap.eapol_m2, cap.key_ver);207+ let mic = crypto::mic_on_zeroed(&ptk, &crypto::zeroed_eapol(&cap.eapol_m2), cap.key_ver);
188 cap = crate::common::HandshakeCapture::new(208 cap = crate::common::HandshakeCapture::new(
189 ap,209 ap,
190 client,210 client,
@@ -195,15 +215,13 @@ mod tests {
195 cap.eapol_m2,215 cap.eapol_m2,
196 cap.key_ver,216 cap.key_ver,
197 );217 );
198- let target = CrackTarget::Handshake(cap.clone());
199- assert!(crypto::verify(&target, MOCK_PW.as_bytes()));
200 cap218 cap
201 }219 }
202 220
203 #[test]221 #[test]
204 fn cli_crack_finds_fabricated() {222 fn cli_crack_finds_fabricated() {
205 let dir = std::env::temp_dir().join(format!(223 let dir = std::env::temp_dir().join(format!(
206- "wifilab-cli-test-{}-{}",224+ "wifi_lab-cli-test-{}-{}",
207 std::process::id(),225 std::process::id(),
208 std::time::SystemTime::now()226 std::time::SystemTime::now()
209 .duration_since(std::time::UNIX_EPOCH)227 .duration_since(std::time::UNIX_EPOCH)
@@ -216,9 +234,12 @@ mod tests {
216 234
217 let cap = crackable_capture();235 let cap = crackable_capture();
218 let line = crate::handshake::handshake_hc22000(&cap);236 let line = crate::handshake::handshake_hc22000(&cap);
219- std::fs::write(&capture, format!("junk line not hc22000\nWPA*99*bogus\n{line}\n"))237+ std::fs::write(
220- .expect("write capture");238+ &capture,
221- std::fs::write(&wordlist, "not-the-password\nhunter2\nparafin2024!\n")239+ format!("junk line not hc22000\nWPA*99*bogus\n{line}\n"),
240+ )
241+ .expect("write capture");
242+ std::fs::write(&wordlist, "not-the-password\nhunter2\ntestnet2024!\n")
222 .expect("write wordlist");243 .expect("write wordlist");
223 244
224 let args = CliCrack {245 let args = CliCrack {
@@ -240,7 +261,73 @@ mod tests {
240 let text = String::from_utf8_lossy(&buf);261 let text = String::from_utf8_lossy(&buf);
241 let _ = std::fs::remove_dir_all(&dir);262 let _ = std::fs::remove_dir_all(&dir);
242 assert_eq!(ret, 0, "expected exit 0, output:\n{text}");263 assert_eq!(ret, 0, "expected exit 0, output:\n{text}");
243- assert!(text.contains("FOUND: parafin2024!"), "output:\n{text}");264+ assert!(text.contains("FOUND: testnet2024!"), "output:\n{text}");
265+ }
266+
267+ /// Drive `crack_event_loop` with a scripted event stream (real channel,
268+ /// no crack worker) and return (exit code, captured output).
269+ fn run_scripted(events: Vec<Event>) -> (i32, String) {
270+ let (tx, rx) = crossbeam_channel::unbounded();
271+ for ev in events {
272+ tx.send(ev).expect("send scripted event");
273+ }
274+ drop(tx);
275+ let mut buf = Vec::new();
276+ let ret = crack_event_loop(&rx, &mut buf);
277+ (ret, String::from_utf8_lossy(&buf).into_owned())
278+ }
279+
280+ #[test]
281+ fn cli_crack_error_event_exits_2_with_reason() {
282+ // Backend failure (GPU device lost): reason surfaces with the same
283+ // `error:` prefix as other errors, and a following exhausted-verdict
284+ // CrackStopped must NOT downgrade the exit code to 1.
285+ let (ret, text) = run_scripted(vec![
286+ Event::CrackError {
287+ reason: "gpu: device lost".to_string(),
288+ },
289+ Event::CrackStopped { found: false },
290+ ]);
291+ assert_eq!(ret, 2, "output:\n{text}");
292+ assert!(text.contains("error: gpu: device lost"), "output:\n{text}");
293+
294+ // A password already reported before the failure still wins: the
295+ // run recovered the passphrase, the tail error cannot un-find it.
296+ let (ret, text) = run_scripted(vec![
297+ Event::CrackFound {
298+ password: "s3cret".to_string(),
299+ },
300+ Event::CrackError {
301+ reason: "gpu: dispatch timeout".to_string(),
302+ },
303+ Event::CrackStopped { found: false },
304+ ]);
305+ assert_eq!(ret, 0, "output:\n{text}");
306+ assert!(text.contains("FOUND: s3cret"), "output:\n{text}");
307+ }
308+
309+ #[test]
310+ fn cli_handshake_partial_event_ignored() {
311+ // Capture events carry no crack verdict for the CLI (targets come
312+ // from the capture file): a partial M2+M3 event mid-stream must not
313+ // disturb progress/found/stopped handling.
314+ let cap = crackable_capture();
315+ let (ret, text) = run_scripted(vec![
316+ Event::HandshakePartial(Box::new(cap)),
317+ Event::CrackFound {
318+ password: "testnet2024!".to_string(),
319+ },
320+ Event::CrackStopped { found: true },
321+ ]);
322+ assert_eq!(ret, 0, "output:\n{text}");
323+ assert!(text.contains("FOUND: testnet2024!"), "output:\n{text}");
324+
325+ // Exhaustion after a partial event is still a plain exit 1.
326+ let (ret, text) = run_scripted(vec![
327+ Event::HandshakePartial(Box::new(crackable_capture())),
328+ Event::CrackStopped { found: false },
329+ ]);
330+ assert_eq!(ret, 1, "output:\n{text}");
244 }331 }
245 332
246 #[test]333 #[test]
@@ -266,10 +353,7 @@ mod tests {
266 assert!(text.contains("cannot read capture file"), "output:\n{text}");353 assert!(text.contains("cannot read capture file"), "output:\n{text}");
267 354
268 // Capture fine (fabricated), wordlist missing → still exit 2.355 // Capture fine (fabricated), wordlist missing → still exit 2.
269- let dir = std::env::temp_dir().join(format!(356+ let dir = std::env::temp_dir().join(format!("wifi_lab-cli-err-{}", std::process::id()));
270- "wifilab-cli-err-{}",
271- std::process::id()
272- ));
273 std::fs::create_dir_all(&dir).expect("tempdir");357 std::fs::create_dir_all(&dir).expect("tempdir");
274 let capture = dir.join("cap.hc22000");358 let capture = dir.join("cap.hc22000");
275 let line = crate::handshake::handshake_hc22000(&crackable_capture());359 let line = crate::handshake::handshake_hc22000(&crackable_capture());
src/common.rsmodified+115 -31
@@ -186,8 +186,17 @@ pub struct HandshakeCapture {
186 /// Full EAPOL-Key frame payload (starting at the EAPOL version byte) of186 /// Full EAPOL-Key frame payload (starting at the EAPOL version byte) of
187 /// message 2, with the MIC field NOT zeroed (zeroing happens in crypto).187 /// message 2, with the MIC field NOT zeroed (zeroing happens in crypto).
188 pub eapol_m2: Vec<u8>,188 pub eapol_m2: Vec<u8>,
189- /// RSN key-info version: 1, 2 (HMAC-SHA1 MIC) or 3 (AES-CMAC MIC).189+ /// RSN key-info version: 1 (HMAC-MD5 MIC, WPA1-TKIP), 2 (HMAC-SHA1 MIC)
190+ /// or 3 (AES-CMAC MIC).
190 pub key_ver: u8,191 pub key_ver: u8,
192+ /// Partial capture: an M2+M3 nonce pair (ANonce taken from M3, SNonce
193+ /// from M2; `eapol_m2` then carries the M3 frame whose MIC is checked).
194+ /// Crackable by our own engine (the PTK/MIC math is identical) and
195+ /// exportable to hashcat (message_pair bit 0x02); the flag is
196+ /// provenance only. Serde default keeps older wire records (all
197+ /// complete captures) deserializing as `false`.
198+ #[serde(default)]
199+ pub partial: bool,
191 }200 }
192 201
193 impl HandshakeCapture {202 impl HandshakeCapture {
@@ -197,6 +206,8 @@ impl HandshakeCapture {
197 }206 }
198 207
199 impl HandshakeCapture {208 impl HandshakeCapture {
209+ /// Complete M1+M2 capture (`partial: false`).
210+ #[allow(clippy::too_many_arguments)]
200 pub fn new(211 pub fn new(
201 ap: MacAddr,212 ap: MacAddr,
202 client: MacAddr,213 client: MacAddr,
@@ -216,6 +227,33 @@ impl HandshakeCapture {
216 mic,227 mic,
217 eapol_m2,228 eapol_m2,
218 key_ver,229 key_ver,
230+ partial: false,
231+ }
232+ }
233+
234+ /// Partial M2+M3 capture: `anonce` from the M3, `snonce` from the M2,
235+ /// `mic`/`eapol_m2` from the M3 frame.
236+ #[allow(clippy::too_many_arguments)]
237+ pub fn new_partial(
238+ ap: MacAddr,
239+ client: MacAddr,
240+ essid: String,
241+ anonce: [u8; 32],
242+ snonce: [u8; 32],
243+ mic: [u8; 16],
244+ eapol_m3: Vec<u8>,
245+ key_ver: u8,
246+ ) -> Self {
247+ Self {
248+ ap,
249+ client,
250+ essid,
251+ anonce,
252+ snonce,
253+ mic,
254+ eapol_m2: eapol_m3,
255+ key_ver,
256+ partial: true,
219 }257 }
220 }258 }
221 }259 }
@@ -299,25 +337,56 @@ pub enum Event {
299 have: u8,337 have: u8,
300 },338 },
301 HandshakeComplete(Box<HandshakeCapture>),339 HandshakeComplete(Box<HandshakeCapture>),
340+ /// A capture session ended having assembled only an M2+M3 nonce pair
341+ /// (see [`HandshakeCapture::partial`]). The pair is crackable like a
342+ /// complete capture; the event exists so the UI can label provenance.
343+ HandshakePartial(Box<HandshakeCapture>),
302 PmkidCaptured(PmkidCapture),344 PmkidCaptured(PmkidCapture),
303 /// Count of deauth/disassoc frames actually written to the wire.345 /// Count of deauth/disassoc frames actually written to the wire.
304- DeauthSent { ap: MacAddr, target: MacAddr, count: u64 },346+ DeauthSent {
347+ ap: MacAddr,
348+ target: MacAddr,
349+ count: u64,
350+ },
305 /// Candidates checked so far (`done`), current throughput (`hps`),351 /// Candidates checked so far (`done`), current throughput (`hps`),
306 /// and the worst-case candidate total (`total`, when the attack352 /// and the worst-case candidate total (`total`, when the attack
307 /// mode's space is countable) of a running crack job. Worst-case353 /// mode's space is countable) of a running crack job. Worst-case
308 /// remaining time = (total - done) / hps.354 /// remaining time = (total - done) / hps.
309- CrackProgress { done: u64, hps: f64, total: Option<u64> },355+ CrackProgress {
356+ done: u64,
357+ hps: f64,
358+ total: Option<u64>,
359+ },
310 /// A crack job recovered the passphrase.360 /// A crack job recovered the passphrase.
311- CrackFound { password: String },361+ CrackFound {
362+ password: String,
363+ },
312 /// The active crack job ended: `found` distinguishes success from364 /// The active crack job ended: `found` distinguishes success from
313 /// exhaustion/user-stop (emitted after [`Event::CrackFound`] too).365 /// exhaustion/user-stop (emitted after [`Event::CrackFound`] too).
314- CrackStopped { found: bool },366+ CrackStopped {
367+ found: bool,
368+ },
369+ /// The crack job died from a backend failure (GPU device lost, kernel
370+ /// dispatch timeout, worker thread panic) — NOT keyspace exhaustion.
371+ /// `found` in a preceding/following CrackStopped is meaningless here:
372+ /// this event supersedes it. The UI must surface `reason`, reset the
373+ /// cracker to idle, and NOT delete the resume session.
374+ CrackError {
375+ reason: String,
376+ },
315 /// Throughput of a rainbow-table build job (PMKs written so far);377 /// Throughput of a rainbow-table build job (PMKs written so far);
316 /// `total` is the wordlist's line count (worst-case table size).378 /// `total` is the wordlist's line count (worst-case table size).
317- RainbowProgress { done: u64, hps: f64, total: Option<u64> },379+ RainbowProgress {
380+ done: u64,
381+ hps: f64,
382+ total: Option<u64>,
383+ },
318 /// A rainbow-table build job ended (always exactly one; `entries` is384 /// A rainbow-table build job ended (always exactly one; `entries` is
319 /// what actually landed in `path`, 0 on failure).385 /// what actually landed in `path`, 0 on failure).
320- RainbowBuilt { path: String, entries: u64 },386+ RainbowBuilt {
387+ path: String,
388+ entries: u64,
389+ },
321 Log(String),390 Log(String),
322 Error(String),391 Error(String),
323 /// Cumulative per-channel counters snapshot (emitted every ~2 s).392 /// Cumulative per-channel counters snapshot (emitted every ~2 s).
@@ -341,14 +410,12 @@ pub enum Event {
341 confidence: IdentConfidence,410 confidence: IdentConfidence,
342 },411 },
343 /// Crack-speed benchmark finished.412 /// Crack-speed benchmark finished.
344- BenchmarkDone { gpu_hps: Option<f64>, cpu_hps: f64 },413+ BenchmarkDone {
414+ gpu_hps: Option<f64>,
415+ cpu_hps: f64,
416+ },
345 }417 }
346 418
347-/// Channel list for hopper: all enabled 2.4 GHz + 5 GHz UNII channels of the
348-/// lab card (keep conservative, driver validates anyway).
349-pub const HOP_CHANNELS_24: &[u8] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
350-pub const HOP_CHANNELS_5: &[u8] = &[36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128];
351-
352 /// 2.4 GHz channel → carrier frequency (MHz).419 /// 2.4 GHz channel → carrier frequency (MHz).
353 pub fn freq_of_channel(ch: u8) -> Option<u16> {420 pub fn freq_of_channel(ch: u8) -> Option<u16> {
354 match ch {421 match ch {
@@ -368,13 +435,13 @@ pub const HOP_FREQS_ALL: &[u16] = &[
368 // 2.4 GHz ch 1..13435 // 2.4 GHz ch 1..13
369 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472,436 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472,
370 // 5 GHz ch 36..64 and 100..140437 // 5 GHz ch 36..64 and 100..140
371- 5180, 5200, 5220, 5240, 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620,438+ 5180, 5200, 5220, 5240, 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640,
372- 5640, 5660, 5680, 5700,439+ 5660, 5680, 5700,
373 // 6 GHz: ONLY the phy-advertised 20 MHz channel grid (5955 + 20n,440 // 6 GHz: ONLY the phy-advertised 20 MHz channel grid (5955 + 20n,
374 // ch 1/5/9/…/85). PSC channel centers (5980/6060/…) are NOT advertised441 // ch 1/5/9/…/85). PSC channel centers (5980/6060/…) are NOT advertised
375 // by iwlwifi and the kernel rejects them with "Unknown channel".442 // by iwlwifi and the kernel rejects them with "Unknown channel".
376- 5955, 5975, 5995, 6015, 6035, 6055, 6075, 6095, 6115, 6135, 6155, 6175, 6195, 6215, 6235,443+ 5955, 5975, 5995, 6015, 6035, 6055, 6075, 6095, 6115, 6135, 6155, 6175, 6195, 6215, 6235, 6255,
377- 6255, 6275, 6295, 6315, 6335, 6355, 6375, 6395, 6415,444+ 6275, 6295, 6315, 6335, 6355, 6375, 6395, 6415,
378 ];445 ];
379 446
380 /// Commands the UI process sends to the privileged service447 /// Commands the UI process sends to the privileged service
@@ -449,7 +516,7 @@ mod tests {
449 fn ap_obj() -> AccessPoint {516 fn ap_obj() -> AccessPoint {
450 AccessPoint {517 AccessPoint {
451 bssid: MacAddr([0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]),518 bssid: MacAddr([0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]),
452- ssid: "parafin".into(),519+ ssid: "testnet".into(),
453 channel: 6,520 channel: 6,
454 security: Security::Wpa2,521 security: Security::Wpa2,
455 rssi_dbm: -42,522 rssi_dbm: -42,
@@ -530,13 +597,21 @@ mod tests {
530 target: MacAddr::BROADCAST,597 target: MacAddr::BROADCAST,
531 count: 64,598 count: 64,
532 },599 },
533- Event::CrackProgress { done: 1000, hps: 1234.5, total: Some(5000) },600+ Event::CrackProgress {
601+ done: 1000,
602+ hps: 1234.5,
603+ total: Some(5000),
604+ },
534 Event::CrackFound {605 Event::CrackFound {
535 password: "hunter2".into(),606 password: "hunter2".into(),
536 },607 },
537 Event::CrackStopped { found: true },608 Event::CrackStopped { found: true },
538 Event::CrackStopped { found: false },609 Event::CrackStopped { found: false },
539- Event::RainbowProgress { done: 42, hps: 9.5, total: None },610+ Event::RainbowProgress {
611+ done: 42,
612+ hps: 9.5,
613+ total: None,
614+ },
540 Event::RainbowBuilt {615 Event::RainbowBuilt {
541 path: "/tmp/t.pmk".into(),616 path: "/tmp/t.pmk".into(),
542 entries: 7,617 entries: 7,
@@ -544,8 +619,16 @@ mod tests {
544 Event::Log("hello".into()),619 Event::Log("hello".into()),
545 Event::Error("boom".into()),620 Event::Error("boom".into()),
546 Event::ChannelStats(vec![621 Event::ChannelStats(vec![
547- ChannelStat { channel: 6, frames: 1234, beacons: 56 },622+ ChannelStat {
548- ChannelStat { channel: 36, frames: 78, beacons: 9 },623+ channel: 6,
624+ frames: 1234,
625+ beacons: 56,
626+ },
627+ ChannelStat {
628+ channel: 36,
629+ frames: 78,
630+ beacons: 9,
631+ },
549 ]),632 ]),
550 Event::ProbeObserved(ProbeInfo {633 Event::ProbeObserved(ProbeInfo {
551 client: MacAddr([0x42; 6]),634 client: MacAddr([0x42; 6]),
@@ -564,12 +647,15 @@ mod tests {
564 group: 42,647 group: 42,
565 confidence: IdentConfidence::Exact,648 confidence: IdentConfidence::Exact,
566 },649 },
567- Event::BenchmarkDone { gpu_hps: Some(1_250_000.0), cpu_hps: 310_000.0 },650+ Event::BenchmarkDone {
651+ gpu_hps: Some(1_250_000.0),
652+ cpu_hps: 310_000.0,
653+ },
568 ];654 ];
569 for ev in &cases {655 for ev in &cases {
570 let json = serde_json::to_string(ev).expect("serialize");656 let json = serde_json::to_string(ev).expect("serialize");
571- let back: Event = serde_json::from_str(&json)657+ let back: Event =
572- .unwrap_or_else(|e| panic!("deserialize {json}: {e}"));658+ serde_json::from_str(&json).unwrap_or_else(|e| panic!("deserialize {json}: {e}"));
573 assert_eq!(format!("{ev:?}"), format!("{back:?}"));659 assert_eq!(format!("{ev:?}"), format!("{back:?}"));
574 }660 }
575 }661 }
@@ -580,16 +666,14 @@ mod tests {
580 // Event::HandshakeComplete must survive the wire.666 // Event::HandshakeComplete must survive the wire.
581 let ev = Event::HandshakeComplete(Box::new(handshake_obj()));667 let ev = Event::HandshakeComplete(Box::new(handshake_obj()));
582 let json = serde_json::to_string(&ev).expect("serialize");668 let json = serde_json::to_string(&ev).expect("serialize");
583- let Event::HandshakeComplete(back) =669+ let Event::HandshakeComplete(back) = serde_json::from_str(&json).expect("deserialize")
584- serde_json::from_str(&json).expect("deserialize")
585 else {670 else {
586 panic!("variant changed shape: {json}");671 panic!("variant changed shape: {json}");
587 };672 };
588 assert_eq!(*back, handshake_obj());673 assert_eq!(*back, handshake_obj());
589 let pm = Event::PmkidCaptured(pmkid_obj());674 let pm = Event::PmkidCaptured(pmkid_obj());
590 let json = serde_json::to_string(&pm).expect("serialize");675 let json = serde_json::to_string(&pm).expect("serialize");
591- let Event::PmkidCaptured(back) = serde_json::from_str(&json).expect("deserialize")676+ let Event::PmkidCaptured(back) = serde_json::from_str(&json).expect("deserialize") else {
592- else {
593 panic!("variant changed shape: {json}");677 panic!("variant changed shape: {json}");
594 };678 };
595 assert_eq!(back, pmkid_obj());679 assert_eq!(back, pmkid_obj());
@@ -630,8 +714,8 @@ mod tests {
630 ];714 ];
631 for cmd in &cases {715 for cmd in &cases {
632 let json = serde_json::to_string(cmd).expect("serialize");716 let json = serde_json::to_string(cmd).expect("serialize");
633- let back: Cmd = serde_json::from_str(&json)717+ let back: Cmd =
634- .unwrap_or_else(|e| panic!("deserialize {json}: {e}"));718+ serde_json::from_str(&json).unwrap_or_else(|e| panic!("deserialize {json}: {e}"));
635 assert_eq!(*cmd, back);719 assert_eq!(*cmd, back);
636 }720 }
637 assert_eq!(roundtrip(&cases[0]), cases[0]);721 assert_eq!(roundtrip(&cases[0]), cases[0]);
src/crypto.rsmodified+190 -97
@@ -1,6 +1,6 @@
1 //! CPU reference implementation of WPA2-PSK cryptographic primitives:1 //! CPU reference implementation of WPA2-PSK cryptographic primitives:
2 //! PBKDF2-SHA1 PMK derivation, 802.11 §12.7.1.2 PRF-512 PTK expansion,2 //! PBKDF2-SHA1 PMK derivation, 802.11 §12.7.1.2 PRF-512 PTK expansion,
3-//! EAPOL-Key MIC (HMAC-SHA1-128 and hand-rolled AES-128-CMAC), PMKID hash,3+//! EAPOL-Key MIC (HMAC-MD5/HMAC-SHA1-128 and hand-rolled AES-128-CMAC), PMKID hash,
4 //! verification and hashcat 22000 line parsing.4 //! verification and hashcat 22000 line parsing.
5 5
6 use anyhow::{Context, Result, anyhow, bail};6 use anyhow::{Context, Result, anyhow, bail};
@@ -151,32 +151,35 @@ pub fn zeroed_eapol(eapol: &[u8]) -> Vec<u8> {
151 pub fn mic_on_zeroed(ptk: &[u8; 64], zeroed: &[u8], key_ver: u8) -> [u8; 16] {151 pub fn mic_on_zeroed(ptk: &[u8; 64], zeroed: &[u8], key_ver: u8) -> [u8; 16] {
152 use hmac::{Hmac, Mac};152 use hmac::{Hmac, Mac};
153 153
154- if key_ver == 3 {154+ match key_ver {
155- // key_mic_len = 16 → blk_key = IGTK||0x00*8. EAPOL frames are never155+ 3 => {
156- // zero-length (header is 4 bytes), but the multi-block path covers156+ // key_mic_len = 16 → blk_key = IGTK||0x00*8. EAPOL frames are
157- // len ≡ 0 mod 16 correctly either way.157+ // never zero-length (header is 4 bytes), but the multi-block
158- let mut key = [0u8; 16];158+ // path covers len ≡ 0 mod 16 correctly either way.
159- key[..8].copy_from_slice(&ptk[48..56]);159+ let mut key = [0u8; 16];
160- cmac_aes128(&key, zeroed)160+ key[..8].copy_from_slice(&ptk[48..56]);
161- } else {161+ cmac_aes128(&key, zeroed)
162- let mut mac =162+ }
163- <Hmac<sha1::Sha1> as Mac>::new_from_slice(&ptk[..16]).expect("KCK is 16 bytes");163+ 1 => {
164- mac.update(zeroed);164+ // WPA1-TKIP: HMAC-MD5 keyed with KCK (hashcat -m 22000 keyver 1).
165- let digest = mac.finalize().into_bytes();165+ let mut mac =
166- let mut out = [0u8; 16];166+ <Hmac<md5::Md5> as Mac>::new_from_slice(&ptk[..16]).expect("KCK is 16 bytes");
167- out.copy_from_slice(&digest[..16]);167+ mac.update(zeroed);
168- out168+ mac.finalize().into_bytes().into()
169+ }
170+ _ => {
171+ // WPA2 and any future/unseen version in the HMAC-SHA1 family.
172+ let mut mac =
173+ <Hmac<sha1::Sha1> as Mac>::new_from_slice(&ptk[..16]).expect("KCK is 16 bytes");
174+ mac.update(zeroed);
175+ let digest = mac.finalize().into_bytes();
176+ let mut out = [0u8; 16];
177+ out.copy_from_slice(&digest[..16]);
178+ out
179+ }
169 }180 }
170 }181 }
171 182
172-/// EAPOL-Key MIC. Zeroes bytes 81..97 of a copy of `eapol` (the MIC field
173-/// offset in a well-formed EAPOL-Key frame; short frames are left untouched),
174-/// then: key_ver 1|2 → HMAC-SHA1 keyed with KCK and truncated to 16 bytes,
175-/// key_ver 3 → AES-128-CMAC over IGTK||0^64||frame.
176-pub fn mic(ptk: &[u8; 64], eapol: &[u8], key_ver: u8) -> [u8; 16] {
177- mic_on_zeroed(ptk, &zeroed_eapol(eapol), key_ver)
178-}
179-
180 /// PMKID = HMAC-SHA1-128(pmk, "PMK Name" || ap || sta).183 /// PMKID = HMAC-SHA1-128(pmk, "PMK Name" || ap || sta).
181 pub fn pmkid_hash(pmk: &[u8; 32], ap: &MacAddr, sta: &MacAddr) -> [u8; 16] {184 pub fn pmkid_hash(pmk: &[u8; 32], ap: &MacAddr, sta: &MacAddr) -> [u8; 16] {
182 use hmac::{Hmac, Mac};185 use hmac::{Hmac, Mac};
@@ -199,25 +202,8 @@ pub fn ct_eq16(a: &[u8; 16], b: &[u8; 16]) -> bool {
199 diff == 0202 diff == 0
200 }203 }
201 204
202-/// Verify `pass` against the capture. Handshake MICs compare in constant
203-/// time.
204-pub fn verify(target: &CrackTarget, pass: &[u8]) -> bool {
205- let key = pmk(pass, target.essid().as_bytes());
206- match target {
207- CrackTarget::Handshake(h) => {
208- let dk = ptk(&key, &h.ap, &h.client, &h.anonce, &h.snonce);
209- let got = mic(&dk, &h.eapol_m2, h.key_ver);
210- ct_eq16(&got, h.mic())
211- }
212- CrackTarget::Pmkid(p) => {
213- let got = pmkid_hash(&key, &p.ap, &p.client);
214- ct_eq16(&got, &p.pmkid)
215- }
216- }
217-}
218-
219 fn unhex_field(s: &str, name: &str) -> Result<Vec<u8>> {205 fn unhex_field(s: &str, name: &str) -> Result<Vec<u8>> {
220- if s.is_empty() || s.len() % 2 != 0 || !s.bytes().all(|b| b.is_ascii_hexdigit()) {206+ if s.is_empty() || !s.len().is_multiple_of(2) || !s.bytes().all(|b| b.is_ascii_hexdigit()) {
221 bail!("{name}: not even-length hex");207 bail!("{name}: not even-length hex");
222 }208 }
223 (0..s.len())209 (0..s.len())
@@ -238,7 +224,11 @@ fn parse_mac(s: &str) -> Result<MacAddr> {
238 224
239 /// Parse one hashcat -m 22000 line:225 /// Parse one hashcat -m 22000 line:
240 /// 01*PMKID*MAC_AP*MAC_CLIENT*ESSID(hex)*** (PMKID)226 /// 01*PMKID*MAC_AP*MAC_CLIENT*ESSID(hex)*** (PMKID)
241-/// 02*MIC*MAC_AP*MAC_CLIENT*ESSID(hex)*ANONCE*EAPOL(hex)*... (EAPOL)227+/// 02*MIC*MAC_AP*MAC_CLIENT*ESSID(hex)*ANONCE*EAPOL(hex)[*MESSAGE_PAIR] (EAPOL)
228+///
229+/// The trailing message_pair field (two hex digits) is optional: absent or
230+/// "00" → complete M1+M2 capture, "02" → partial M2+M3 capture
231+/// ([`HandshakeCapture::partial`]).
242 pub fn parse_hc22000(line: &str) -> Result<CrackTarget> {232 pub fn parse_hc22000(line: &str) -> Result<CrackTarget> {
243 let line = line.trim();233 let line = line.trim();
244 let fields: Vec<&str> = line.split('*').collect();234 let fields: Vec<&str> = line.split('*').collect();
@@ -251,8 +241,7 @@ pub fn parse_hc22000(line: &str) -> Result<CrackTarget> {
251 let ap = parse_mac(fields[2])?;241 let ap = parse_mac(fields[2])?;
252 let client = parse_mac(fields[3])?;242 let client = parse_mac(fields[3])?;
253 let essid_bytes = unhex_field(fields[4], "essid")?;243 let essid_bytes = unhex_field(fields[4], "essid")?;
254- let essid =244+ let essid = String::from_utf8(essid_bytes).context("hc22000: essid not valid utf-8")?;
255- String::from_utf8(essid_bytes).context("hc22000: essid not valid utf-8")?;
256 Ok(CrackTarget::Pmkid(PmkidCapture {245 Ok(CrackTarget::Pmkid(PmkidCapture {
257 ap,246 ap,
258 client,247 client,
@@ -268,8 +257,7 @@ pub fn parse_hc22000(line: &str) -> Result<CrackTarget> {
268 let ap = parse_mac(fields[2])?;257 let ap = parse_mac(fields[2])?;
269 let client = parse_mac(fields[3])?;258 let client = parse_mac(fields[3])?;
270 let essid_bytes = unhex_field(fields[4], "essid")?;259 let essid_bytes = unhex_field(fields[4], "essid")?;
271- let essid =260+ let essid = String::from_utf8(essid_bytes).context("hc22000: essid not valid utf-8")?;
272- String::from_utf8(essid_bytes).context("hc22000: essid not valid utf-8")?;
273 let anonce = unhex_array::<32>(fields[5], "anonce")?;261 let anonce = unhex_array::<32>(fields[5], "anonce")?;
274 let eapol = unhex_field(fields[6], "eapol")?;262 let eapol = unhex_field(fields[6], "eapol")?;
275 if eapol.len() < 99 {263 if eapol.len() < 99 {
@@ -280,9 +268,21 @@ pub fn parse_hc22000(line: &str) -> Result<CrackTarget> {
280 let snonce = <[u8; 32]>::try_from(&eapol[17..49]).expect("slice checked");268 let snonce = <[u8; 32]>::try_from(&eapol[17..49]).expect("slice checked");
281 let key_info = u16::from_be_bytes([eapol[5], eapol[6]]);269 let key_info = u16::from_be_bytes([eapol[5], eapol[6]]);
282 let key_ver = (key_info & 0x7) as u8;270 let key_ver = (key_info & 0x7) as u8;
283- Ok(CrackTarget::Handshake(HandshakeCapture::new(271+ // Trailing hashcat message_pair field (index 7), two hex
284- ap, client, essid, anonce, snonce, mic_bytes, eapol, key_ver,272+ // digits when present: "02" marks an M2+M3 (partial M1-less)
285- )))273+ // capture → `partial = true`; "00" or a legacy line ending at
274+ // the eapol field → complete capture. Unknown values parse as
275+ // complete (their MIC math is identical either way).
276+ let message_pair = fields.get(7).copied();
277+ let is_partial = message_pair == Some("02");
278+ let capture = if is_partial {
279+ HandshakeCapture::new_partial(
280+ ap, client, essid, anonce, snonce, mic_bytes, eapol, key_ver,
281+ )
282+ } else {
283+ HandshakeCapture::new(ap, client, essid, anonce, snonce, mic_bytes, eapol, key_ver)
284+ };
285+ Ok(CrackTarget::Handshake(capture))
286 }286 }
287 other => bail!("hc22000: unsupported message pair type {other}"),287 other => bail!("hc22000: unsupported message pair type {other}"),
288 }288 }
@@ -324,8 +324,8 @@ impl AesTables {
324 let mut log = [0u8; 256];324 let mut log = [0u8; 256];
325 let mut v = 1u8;325 let mut v = 1u8;
326 // 0x03 is a generator of GF(2^8) under AES reduction.326 // 0x03 is a generator of GF(2^8) under AES reduction.
327- for i in 0..255usize {327+ for (i, slot) in exp.iter_mut().enumerate().take(255) {
328- exp[i] = v;328+ *slot = v;
329 log[v as usize] = i as u8;329 log[v as usize] = i as u8;
330 v = gf_mul(v, 0x03);330 v = gf_mul(v, 0x03);
331 }331 }
@@ -371,13 +371,8 @@ impl Aes128 {
371 rk[..16].copy_from_slice(key);371 rk[..16].copy_from_slice(key);
372 let mut i = 4usize; // words generated372 let mut i = 4usize; // words generated
373 while i < 44 {373 while i < 44 {
374- let mut w = [374+ let mut w = [rk[4 * i - 4], rk[4 * i - 3], rk[4 * i - 2], rk[4 * i - 1]];
375- rk[4 * i - 4],375+ if i.is_multiple_of(4) {
376- rk[4 * i - 3],
377- rk[4 * i - 2],
378- rk[4 * i - 1],
379- ];
380- if i % 4 == 0 {
381 // RotWord + SubWord + Rcon376 // RotWord + SubWord + Rcon
382 w.rotate_left(1);377 w.rotate_left(1);
383 for b in w.iter_mut() {378 for b in w.iter_mut() {
@@ -411,7 +406,9 @@ impl Aes128 {
411 406
412 fn rcon_for_round(round: usize) -> u8 {407 fn rcon_for_round(round: usize) -> u8 {
413 // Rcon[1..=10] = 01,02,04,08,10,20,40,80,1b,36408 // Rcon[1..=10] = 01,02,04,08,10,20,40,80,1b,36
414- const RCON: [u8; 11] = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];409+ const RCON: [u8; 11] = [
410+ 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36,
411+ ];
415 RCON[round]412 RCON[round]
416 }413 }
417 414
@@ -456,7 +453,7 @@ pub fn cmac_aes128(key: &[u8; 16], msg: &[u8]) -> [u8; 16] {
456 let k2 = dbl(k1);453 let k2 = dbl(k1);
457 454
458 let n = msg.len().div_ceil(16).max(1);455 let n = msg.len().div_ceil(16).max(1);
459- let complete = !msg.is_empty() && msg.len() % 16 == 0;456+ let complete = !msg.is_empty() && msg.len().is_multiple_of(16);
460 457
461 let mut m_last = [0u8; 16];458 let mut m_last = [0u8; 16];
462 if complete {459 if complete {
@@ -569,10 +566,7 @@ mod tests {
569 ];566 ];
570 let aes = Aes128::new(&key);567 let aes = Aes128::new(&key);
571 let ct = aes.encrypt_block(&pt);568 let ct = aes.encrypt_block(&pt);
572- assert_eq!(569+ assert_eq!(hex(&ct), "69c4e0d86a7b0430d8cdb78070b4c55a");
573- hex(&ct),
574- "69c4e0d86a7b0430d8cdb78070b4c55a"
575- );
576 }570 }
577 571
578 #[test]572 #[test]
@@ -643,54 +637,107 @@ mod tests {
643 let key = pmk(pass, ssid.as_bytes());637 let key = pmk(pass, ssid.as_bytes());
644 let dk = ptk(&key, &ap, &sta, &anonce, &snonce);638 let dk = ptk(&key, &ap, &sta, &anonce, &snonce);
645 let frame = build_eapol_m2(key_ver, &snonce, 1);639 let frame = build_eapol_m2(key_ver, &snonce, 1);
646- let m = mic(&dk, &frame, key_ver);640+ let m = mic_on_zeroed(&dk, &zeroed_eapol(&frame), key_ver);
647- let cap = HandshakeCapture::new(641+ let cap =
648- ap,642+ HandshakeCapture::new(ap, sta, ssid.to_string(), anonce, snonce, m, frame, key_ver);
649- sta,
650- ssid.to_string(),
651- anonce,
652- snonce,
653- m,
654- frame,
655- key_ver,
656- );
657 (CrackTarget::Handshake(cap), key)643 (CrackTarget::Handshake(cap), key)
658 }644 }
659 645
646+ /// End-to-end check over the surviving lowest-level APIs (the chain the
647+ /// CPU cracker runs per candidate): pmk → ptk/pmkid → MIC → constant-time
648+ /// compare.
649+ fn verifies(target: &CrackTarget, pass: &[u8]) -> bool {
650+ let key = pmk(pass, target.essid().as_bytes());
651+ match target {
652+ CrackTarget::Handshake(h) => {
653+ let dk = ptk(&key, &h.ap, &h.client, &h.anonce, &h.snonce);
654+ let got = mic_on_zeroed(&dk, &zeroed_eapol(&h.eapol_m2), h.key_ver);
655+ ct_eq16(&got, h.mic())
656+ }
657+ CrackTarget::Pmkid(p) => {
658+ let got = pmkid_hash(&key, &p.ap, &p.client);
659+ ct_eq16(&got, &p.pmkid)
660+ }
661+ }
662+ }
663+
660 #[test]664 #[test]
661 fn synthetic_handshake_sha1_mic() {665 fn synthetic_handshake_sha1_mic() {
662- let (target, _) = synthetic_target("parafin", b"sup3r-secret", 2);666+ let (target, _) = synthetic_target("testnet", b"sup3r-secret", 2);
663- assert!(verify(&target, b"sup3r-secret"));667+ assert!(verifies(&target, b"sup3r-secret"));
664- assert!(!verify(&target, b"sup3r-wrong"));668+ assert!(!verifies(&target, b"sup3r-wrong"));
665 // Tampered MIC must not verify.669 // Tampered MIC must not verify.
666 if let CrackTarget::Handshake(mut h) = target.clone() {670 if let CrackTarget::Handshake(mut h) = target.clone() {
667 h.eapol_m2[10] ^= 1; // flip a nonce bit → MIC mismatch671 h.eapol_m2[10] ^= 1; // flip a nonce bit → MIC mismatch
668- assert!(!verify(&CrackTarget::Handshake(h), b"sup3r-secret"));672+ assert!(!verifies(&CrackTarget::Handshake(h), b"sup3r-secret"));
669 }673 }
670 }674 }
671 675
672 #[test]676 #[test]
673 fn synthetic_handshake_cmac_mic() {677 fn synthetic_handshake_cmac_mic() {
674- let (target, _) = synthetic_target("parafin", b"sup3r-secret", 3);678+ let (target, _) = synthetic_target("testnet", b"sup3r-secret", 3);
675- assert!(verify(&target, b"sup3r-secret"));679+ assert!(verifies(&target, b"sup3r-secret"));
676- assert!(!verify(&target, b"sup3r-wrong"));680+ assert!(!verifies(&target, b"sup3r-wrong"));
681+ }
682+
683+ #[test]
684+ fn hmac_md5_rfc2202() {
685+ use hmac::Mac as _;
686+ // RFC 2202 test case 1: key = 0x0b×16, data = "Hi There".
687+ let mut mac = <hmac::Hmac<md5::Md5> as hmac::Mac>::new_from_slice(&[0x0b; 16])
688+ .expect("HMAC-MD5 takes any key length");
689+ mac.update(b"Hi There");
690+ assert_eq!(
691+ hex(&mac.finalize().into_bytes()),
692+ "9294727a3638bb1c13f48ef8158bfc9d"
693+ );
694+ }
695+
696+ #[test]
697+ fn synthetic_handshake_md5_mic() {
698+ // key_ver 1 (WPA1-TKIP): MIC = HMAC-MD5(KCK, zeroed frame), 16 bytes.
699+ let (target, _) = synthetic_target("testnet", b"sup3r-secret", 1);
700+ assert!(verifies(&target, b"sup3r-secret"));
701+ assert!(!verifies(&target, b"sup3r-wrong"));
702+ }
703+
704+ #[test]
705+ fn key_ver_1_cracks_on_cpu() {
706+ // Regression: a key_ver-1 target must actually crack end-to-end on
707+ // the pure-CPU path (previously the SHA1 epilogue made every
708+ // candidate miss — keyspace "exhausted" without a hit).
709+ let (target, _) = synthetic_target("testnet", b"md5secret!", 1);
710+ let mut words = vec![
711+ b"wrong-pass-1".to_vec(),
712+ b"wrong-pass-2".to_vec(),
713+ b"md5secret!".to_vec(),
714+ ]
715+ .into_iter();
716+ let stop = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false));
717+ let found = crate::gpu::cpu_crack(&target, &mut words, &mut |_, _| {}, &stop, None);
718+ assert_eq!(found.as_deref(), Some("md5secret!"));
719+
720+ // A wordlist without the right passphrase exhausts cleanly.
721+ let mut wrong = vec![b"wrong-pass-1".to_vec(), b"wrong-pass-2".to_vec()].into_iter();
722+ let found = crate::gpu::cpu_crack(&target, &mut wrong, &mut |_, _| {}, &stop, None);
723+ assert_eq!(found, None);
677 }724 }
678 725
679 #[test]726 #[test]
680 fn pmkid_roundtrip() {727 fn pmkid_roundtrip() {
681 let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();728 let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();
682 let sta = "11:22:33:44:55:66".parse::<MacAddr>().unwrap();729 let sta = "11:22:33:44:55:66".parse::<MacAddr>().unwrap();
683- let key = pmk(b"sup3r-secret", b"parafin");730+ let key = pmk(b"sup3r-secret", b"testnet");
684 let id = pmkid_hash(&key, &ap, &sta);731 let id = pmkid_hash(&key, &ap, &sta);
685 let cap = PmkidCapture {732 let cap = PmkidCapture {
686 ap,733 ap,
687 client: sta,734 client: sta,
688- essid: "parafin".to_string(),735+ essid: "testnet".to_string(),
689 pmkid: id,736 pmkid: id,
690 };737 };
691 let target = CrackTarget::Pmkid(cap);738 let target = CrackTarget::Pmkid(cap);
692- assert!(verify(&target, b"sup3r-secret"));739+ assert!(verifies(&target, b"sup3r-secret"));
693- assert!(!verify(&target, b"another-pass"));740+ assert!(!verifies(&target, b"another-pass"));
694 }741 }
695 742
696 /// Export a handshake exactly like handshake::handshake_hc22000 does:743 /// Export a handshake exactly like handshake::handshake_hc22000 does:
@@ -745,7 +792,7 @@ mod tests {
745 792
746 #[test]793 #[test]
747 fn hc22000_handshake_roundtrip() {794 fn hc22000_handshake_roundtrip() {
748- let (target, _key) = synthetic_target("parafin", b"sup3r-secret", 2);795+ let (target, _key) = synthetic_target("testnet", b"sup3r-secret", 2);
749 let h = match &target {796 let h = match &target {
750 CrackTarget::Handshake(h) => h.clone(),797 CrackTarget::Handshake(h) => h.clone(),
751 _ => unreachable!(),798 _ => unreachable!(),
@@ -766,26 +813,71 @@ mod tests {
766 }813 }
767 _ => panic!("wrong target type"),814 _ => panic!("wrong target type"),
768 }815 }
769- assert!(verify(&parsed, b"sup3r-secret"));816+ assert!(verifies(&parsed, b"sup3r-secret"));
770- assert!(!verify(&parsed, b"nope-nope"));817+ assert!(!verifies(&parsed, b"nope-nope"));
818+ }
819+
820+ #[test]
821+ fn hc22000_partial_message_pair_roundtrip() {
822+ // "02" trailing field → partial capture (M2+M3, MIC math identical).
823+ let (target, _key) = synthetic_target("testnet", b"sup3r-secret", 2);
824+ let h = match &target {
825+ CrackTarget::Handshake(h) => h.clone(),
826+ _ => unreachable!(),
827+ };
828+ let line = format!("{}*02", export_handshake(&h).trim_end_matches("*00"));
829+ let parsed = parse_hc22000(&line).unwrap();
830+ match &parsed {
831+ CrackTarget::Handshake(p) => {
832+ assert!(p.partial, "message_pair 02 must set partial=true");
833+ assert_eq!(p.mic(), h.mic());
834+ assert_eq!(p.anonce, h.anonce);
835+ assert_eq!(p.snonce, h.snonce);
836+ }
837+ _ => panic!("wrong target type"),
838+ }
839+ assert!(verifies(&parsed, b"sup3r-secret"));
840+ assert!(!verifies(&parsed, b"nope-nope"));
841+
842+ // Explicit "00" → complete capture, exactly like before.
843+ let line = export_handshake(&h); // ends in *00
844+ let parsed = parse_hc22000(&line).unwrap();
845+ match &parsed {
846+ CrackTarget::Handshake(p) => assert!(!p.partial),
847+ _ => panic!("wrong target type"),
848+ }
849+
850+ // Legacy: no trailing message_pair field at all → still parses as a
851+ // complete capture.
852+ let line = export_handshake(&h).trim_end_matches("*00").to_string();
853+ let parsed = parse_hc22000(&line).unwrap();
854+ match &parsed {
855+ CrackTarget::Handshake(p) => {
856+ assert!(!p.partial);
857+ assert_eq!(p.mic(), h.mic());
858+ assert_eq!(p.eapol_m2, h.eapol_m2);
859+ }
860+ _ => panic!("wrong target type"),
861+ }
862+ assert!(verifies(&parsed, b"sup3r-secret"));
771 }863 }
772 864
773 #[test]865 #[test]
774 fn hc22000_pmkid_roundtrip() {866 fn hc22000_pmkid_roundtrip() {
775 let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();867 let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();
776 let sta = "11:22:33:44:55:66".parse::<MacAddr>().unwrap();868 let sta = "11:22:33:44:55:66".parse::<MacAddr>().unwrap();
777- let key = pmk(b"hunter2!!", b"parafin");869+ let key = pmk(b"hunter2!!", b"testnet");
778 let cap = PmkidCapture {870 let cap = PmkidCapture {
779 ap,871 ap,
780 client: sta,872 client: sta,
781- essid: "parafin".to_string(),873+ essid: "testnet".to_string(),
782 pmkid: pmkid_hash(&key, &ap, &sta),874 pmkid: pmkid_hash(&key, &ap, &sta),
783 };875 };
784 let line = export_pmkid(&cap);876 let line = export_pmkid(&cap);
785 assert!(line.ends_with("***"));877 assert!(line.ends_with("***"));
786 let parsed = parse_hc22000(&line).unwrap();878 let parsed = parse_hc22000(&line).unwrap();
787- assert!(verify(&parsed, b"hunter2!!"));879+ assert!(verifies(&parsed, b"hunter2!!"));
788- assert!(!verify(&parsed, b"hunter3!!"));880+ assert!(!verifies(&parsed, b"hunter3!!"));
789 }881 }
790 882
791 #[test]883 #[test]
@@ -797,8 +889,10 @@ mod tests {
797 assert!(parse_hc22000("01*abc*aabbccddeeff*112233445566*70***").is_err());889 assert!(parse_hc22000("01*abc*aabbccddeeff*112233445566*70***").is_err());
798 // type 02 missing eapol field890 // type 02 missing eapol field
799 assert!(891 assert!(
800- parse_hc22000("02*070a16b46b4d4144f79bdd9dd04a287c*aabbccddeeff*112233445566*70617261*abcd")892+ parse_hc22000(
801- .is_err()893+ "02*070a16b46b4d4144f79bdd9dd04a287c*aabbccddeeff*112233445566*70617261*abcd"
894+ )
895+ .is_err()
802 );896 );
803 }897 }
804 898
@@ -806,4 +900,3 @@ mod tests {
806 b.iter().map(|x| format!("{x:02x}")).collect()900 b.iter().map(|x| format!("{x:02x}")).collect()
807 }901 }
808 }902 }
809-
src/data/oui.txtmodified+33437 -33361

Diff too large; view file

@@ -1,40318 +1,40394 @@
1-000000|XEROX CORPORATION1+000000|XEROX CORPORATION
2-000001|XEROX CORPORATION2+000001|XEROX CORPORATION
3-000002|XEROX CORPORATION3+000002|XEROX CORPORATION
4-000003|XEROX CORPORATION4+000003|XEROX CORPORATION
5-000004|XEROX CORPORATION5+000004|XEROX CORPORATION
6-000005|XEROX CORPORATION6+000005|XEROX CORPORATION
7-000006|XEROX CORPORATION7+000006|XEROX CORPORATION
8-000007|XEROX CORPORATION8+000007|XEROX CORPORATION
9-000008|XEROX CORPORATION9+000008|XEROX CORPORATION
10-000009|XEROX CORPORATION10+000009|XEROX CORPORATION
11-00000A|OMRON TATEISI ELECTRONICS CO.11+00000A|OMRON TATEISI ELECTRONICS CO.
12-00000B|MATRIX CORPORATION12+00000B|MATRIX CORPORATION
13-00000C|Cisco Systems, Inc13+00000C|Cisco Systems, Inc
14-00000D|FIBRONICS LTD.14+00000D|FIBRONICS LTD.
15-00000E|FUJITSU LIMITED15+00000E|FUJITSU LIMITED
16-00000F|NEXT, INC.16+00000F|NEXT, INC.
17-000010|SYTEK INC.17+000010|SYTEK INC.
18-000011|NORMEREL SYSTEMES18+000011|NORMEREL SYSTEMES
19-000012|INFORMATION TECHNOLOGY LIMITED19+000012|INFORMATION TECHNOLOGY LIMITED
20-000013|CAMEX20+000013|CAMEX
21-000014|NETRONIX21+000014|NETRONIX
22-000015|DATAPOINT CORPORATION22+000015|DATAPOINT CORPORATION
23-000016|DU PONT PIXEL SYSTEMS .23+000016|DU PONT PIXEL SYSTEMS .
24-000017|Oracle24+000017|Oracle
25-000018|WEBSTER COMPUTER CORPORATION25+000018|WEBSTER COMPUTER CORPORATION
26-000019|APPLIED DYNAMICS INTERNATIONAL26+000019|APPLIED DYNAMICS INTERNATIONAL
27-00001A|ADVANCED MICRO DEVICES27+00001A|ADVANCED MICRO DEVICES
28-00001B|Novell, Inc.28+00001B|Novell, Inc.
29-00001C|BELL TECHNOLOGIES29+00001C|BELL TECHNOLOGIES
30-00001D|Cabletron Systems, Inc.30+00001D|Cabletron Systems, Inc.
31-00001E|TELSIST INDUSTRIA ELECTRONICA31+00001E|TELSIST INDUSTRIA ELECTRONICA
32-00001F|Telco Systems, Inc. 32+00001F|Telco Systems, Inc.
33-000020|DATAINDUSTRIER DIAB AB33+000020|DATAINDUSTRIER DIAB AB
34-000021|SUREMAN COMP. & COMMUN. CORP.34+000021|SUREMAN COMP. & COMMUN. CORP.
35-000022|VISUAL TECHNOLOGY INC.35+000022|VISUAL TECHNOLOGY INC.
36-000023|ABB INDUSTRIAL SYSTEMS AB36+000023|ABB INDUSTRIAL SYSTEMS AB
37-000024|CONNECT AS37+000024|CONNECT AS
38-000025|RAMTEK CORP.38+000025|RAMTEK CORP.
39-000026|SHA-KEN CO., LTD.39+000026|SHA-KEN CO., LTD.
40-000027|JAPAN RADIO COMPANY40+000027|JAPAN RADIO COMPANY
41-000028|PRODIGY SYSTEMS CORPORATION41+000028|PRODIGY SYSTEMS CORPORATION
42-000029|IMC NETWORKS CORP.42+000029|IMC NETWORKS CORP.
43-00002A|TRW - SEDD/INP43+00002A|TRW - SEDD/INP
44-00002B|CRISP AUTOMATION, INC44+00002B|CRISP AUTOMATION, INC
45-00002C|AUTOTOTE LIMITED45+00002C|AUTOTOTE LIMITED
46-00002D|CHROMATICS INC46+00002D|CHROMATICS INC
47-00002E|SOCIETE EVIRA47+00002E|SOCIETE EVIRA
48-00002F|TIMEPLEX INC.48+00002F|TIMEPLEX INC.
49-000030|VG LABORATORY SYSTEMS LTD49+000030|VG LABORATORY SYSTEMS LTD
50-000031|QPSX COMMUNICATIONS, LTD.50+000031|QPSX COMMUNICATIONS, LTD.
51-000032|Marconi plc51+000032|Marconi plc
52-000033|EGAN MACHINERY COMPANY52+000033|EGAN MACHINERY COMPANY
53-000034|NETWORK RESOURCES CORPORATION53+000034|NETWORK RESOURCES CORPORATION
54-000035|SPECTRAGRAPHICS CORPORATION54+000035|SPECTRAGRAPHICS CORPORATION
55-000036|ATARI CORPORATION55+000036|ATARI CORPORATION
56-000037|OXFORD METRICS LIMITED56+000037|OXFORD METRICS LIMITED
57-000038|CSS LABS57+000038|CSS LABS
58-000039|TOSHIBA CORPORATION58+000039|TOSHIBA CORPORATION
59-00003A|CHYRON CORPORATION59+00003A|CHYRON CORPORATION
60-00003B|i Controls, Inc.60+00003B|i Controls, Inc.
61-00003C|AUSPEX SYSTEMS INC.61+00003C|AUSPEX SYSTEMS INC.
62-00003D|UNISYS62+00003D|UNISYS
63-00003E|SIMPACT63+00003E|SIMPACT
64-00003F|SYNTREX, INC.64+00003F|SYNTREX, INC.
65-000040|APPLICON, INC.65+000040|APPLICON, INC.
66-000041|ICE CORPORATION66+000041|ICE CORPORATION
67-000042|METIER MANAGEMENT SYSTEMS LTD.67+000042|METIER MANAGEMENT SYSTEMS LTD.
68-000043|MICRO TECHNOLOGY68+000043|MICRO TECHNOLOGY
69-000044|CASTELLE CORPORATION69+000044|CASTELLE CORPORATION
70-000045|FORD AEROSPACE & COMM. CORP.70+000045|FORD AEROSPACE & COMM. CORP.
71-000046|OLIVETTI NORTH AMERICA71+000046|OLIVETTI NORTH AMERICA
72-000047|NICOLET INSTRUMENTS CORP.72+000047|NICOLET INSTRUMENTS CORP.
73-000048|Seiko Epson Corporation73+000048|Seiko Epson Corporation
74-000049|APRICOT COMPUTERS, LTD74+000049|APRICOT COMPUTERS, LTD
75-00004A|ADC CODENOLL TECHNOLOGY CORP.75+00004A|ADC CODENOLL TECHNOLOGY CORP.
76-00004B|ICL DATA OY76+00004B|ICL DATA OY
77-00004C|NEC Corporation77+00004C|NEC Corporation
78-00004D|DCI CORPORATION78+00004D|DCI CORPORATION
79-00004E|AMPEX CORPORATION79+00004E|AMPEX CORPORATION
80-00004F|LOGICRAFT, INC.80+00004F|LOGICRAFT, INC.
81-000050|RADISYS CORPORATION81+000050|RADISYS CORPORATION
82-000051|HOB ELECTRONIC GMBH & CO. KG82+000051|HOB ELECTRONIC GMBH & CO. KG
83-000052|Intrusion.com, Inc.83+000052|Intrusion.com, Inc.
84-000053|COMPUCORP84+000053|COMPUCORP
85-000054|Schneider Electric85+000054|Schneider Electric
86-000055|COMMISSARIAT A L`ENERGIE ATOM.86+000055|COMMISSARIAT A L`ENERGIE ATOM.
87-000056|DR. B. STRUCK87+000056|DR. B. STRUCK
88-000057|SCITEX CORPORATION LTD.88+000057|SCITEX CORPORATION LTD.
89-000058|RACORE COMPUTER PRODUCTS INC.89+000058|RACORE COMPUTER PRODUCTS INC.
90-000059|Hellige GMBH90+000059|Hellige GMBH
91-00005A|SysKonnect GmbH91+00005A|SysKonnect GmbH
92-00005B|ELTEC ELEKTRONIK AG92+00005B|ELTEC ELEKTRONIK AG
93-00005C|TELEMATICS INTERNATIONAL INC.93+00005C|TELEMATICS INTERNATIONAL INC.
94-00005D|CS TELECOM94+00005D|CS TELECOM
95-00005E|ICANN, IANA Department95+00005E|ICANN, IANA Department
96 00005F|Sumitomo Electric Industries, Lt96 00005F|Sumitomo Electric Industries, Lt
97-000060|Kontron Europe GmbH97+000060|Kontron Europe GmbH
98-000061|GATEWAY COMMUNICATIONS98+000061|GATEWAY COMMUNICATIONS
99-000062|BULL HN INFORMATION SYSTEMS99+000062|BULL HN INFORMATION SYSTEMS
100-000063|BARCO CONTROL ROOMS GMBH100+000063|BARCO CONTROL ROOMS GMBH
101-000064|DTS INSIGHT Corporation101+000064|DTS INSIGHT Corporation
102-000065|Network General Corporation102+000065|Network General Corporation
103-000066|TALARIS SYSTEMS, INC.103+000066|TALARIS SYSTEMS, INC.
104-000067|SOFT * RITE, INC.104+000067|SOFT * RITE, INC.
105-000068|ROSEMOUNT CONTROLS105+000068|ROSEMOUNT CONTROLS
106-000069|CONCORD COMMUNICATIONS INC106+000069|CONCORD COMMUNICATIONS INC
107-00006A|COMPUTER CONSOLES INC.107+00006A|COMPUTER CONSOLES INC.
108-00006B|Silicon Graphics108+00006B|Silicon Graphics
109-00006C|Schneider Electric109+00006C|Schneider Electric
110-00006D|CRAY COMMUNICATIONS, LTD.110+00006D|CRAY COMMUNICATIONS, LTD.
111-00006E|Artisoft Inc.111+00006E|Artisoft Inc.
112-00006F|Madge Ltd.112+00006F|Madge Ltd.
113-000070|HCL LIMITED113+000070|HCL LIMITED
114-000071|ADRA SYSTEMS INC.114+000071|ADRA SYSTEMS INC.
115-000072|MINIWARE TECHNOLOGY115+000072|MINIWARE TECHNOLOGY
116-000073|SIECOR CORPORATION116+000073|SIECOR CORPORATION
117-000074|RICOH COMPANY LTD.117+000074|RICOH COMPANY LTD.
118-000075|Nortel Networks118+000075|Nortel Networks
119-000076|ABEKAS VIDEO SYSTEM119+000076|ABEKAS VIDEO SYSTEM
120-000077|INTERPHASE CORPORATION120+000077|INTERPHASE CORPORATION
121-000078|LABTAM LIMITED121+000078|LABTAM LIMITED
122-000079|NETWORTH INCORPORATED122+000079|NETWORTH INCORPORATED
123-00007A|DANA COMPUTER INC.123+00007A|DANA COMPUTER INC.
124-00007B|RESEARCH MACHINES124+00007B|RESEARCH MACHINES
125-00007C|AMPERE INCORPORATED125+00007C|AMPERE INCORPORATED
126-00007D|Oracle Corporation126+00007D|Oracle Corporation
127-00007E|CLUSTRIX CORPORATION127+00007E|CLUSTRIX CORPORATION
128-00007F|LINOTYPE-HELL AG128+00007F|LINOTYPE-HELL AG
129-000080|CRAY COMMUNICATIONS A/S129+000080|CRAY COMMUNICATIONS A/S
130-000081|Bay Networks130+000081|Bay Networks
131-000082|LECTRA SYSTEMES SA131+000082|LECTRA SYSTEMES SA
132-000083|TADPOLE TECHNOLOGY PLC132+000083|TADPOLE TECHNOLOGY PLC
133-000084|SUPERNET133+000084|SUPERNET
134-000085|CANON INC.134+000085|CANON INC.
135-000086|MEGAHERTZ CORPORATION135+000086|MEGAHERTZ CORPORATION
136-000087|HITACHI, LTD.136+000087|HITACHI, LTD.
137 000088|Brocade Communications Systems L137 000088|Brocade Communications Systems L
138-000089|CAYMAN SYSTEMS INC.138+000089|CAYMAN SYSTEMS INC.
139-00008A|DATAHOUSE INFORMATION SYSTEMS139+00008A|DATAHOUSE INFORMATION SYSTEMS
140-00008B|INFOTRON140+00008B|INFOTRON
141 00008C|Alloy Computer Products (Austral141 00008C|Alloy Computer Products (Austral
142-00008D|Cryptek Inc.142+00008D|Cryptek Inc.
143-00008E|SOLBOURNE COMPUTER, INC.143+00008E|SOLBOURNE COMPUTER, INC.
144-00008F|Raytheon144+00008F|Raytheon
145-000090|MICROCOM145+000090|MICROCOM
146-000091|ANRITSU CORPORATION146+000091|ANRITSU CORPORATION
147-000092|COGENT DATA TECHNOLOGIES147+000092|COGENT DATA TECHNOLOGIES
148-000093|PROTEON INC.148+000093|PROTEON INC.
149-000094|ASANTE TECHNOLOGIES149+000094|ASANTE TECHNOLOGIES
150-000095|SONY TEKTRONIX CORP.150+000095|SONY TEKTRONIX CORP.
151-000096|MARCONI ELECTRONICS LTD.151+000096|MARCONI ELECTRONICS LTD.
152-000097|Dell EMC152+000097|Dell EMC
153-000098|CROSSCOMM CORPORATION153+000098|CROSSCOMM CORPORATION
154-000099|MTX, INC.154+000099|MTX, INC.
155-00009A|RC COMPUTER A/S155+00009A|RC COMPUTER A/S
156-00009B|INFORMATION INTERNATIONAL, INC156+00009B|INFORMATION INTERNATIONAL, INC
157-00009C|ROLM MIL-SPEC COMPUTERS157+00009C|ROLM MIL-SPEC COMPUTERS
158-00009D|LOCUS COMPUTING CORPORATION158+00009D|LOCUS COMPUTING CORPORATION
159-00009E|MARLI S.A.159+00009E|MARLI S.A.
160-00009F|AMERISTAR TECHNOLOGIES INC.160+00009F|AMERISTAR TECHNOLOGIES INC.
161-0000A0|SANYO Electric Co., Ltd.161+0000A0|SANYO Electric Co., Ltd.
162-0000A1|MARQUETTE ELECTRIC CO.162+0000A1|MARQUETTE ELECTRIC CO.
163-0000A2|Bay Networks163+0000A2|Bay Networks
164-0000A3|NETWORK APPLICATION TECHNOLOGY164+0000A3|NETWORK APPLICATION TECHNOLOGY
165-0000A4|ACORN COMPUTERS LIMITED165+0000A4|ACORN COMPUTERS LIMITED
166-0000A5|Tattile SRL 166+0000A5|Tattile SRL
167-0000A6|NETWORK GENERAL CORPORATION167+0000A6|NETWORK GENERAL CORPORATION
168-0000A7|NETWORK COMPUTING DEVICES INC.168+0000A7|NETWORK COMPUTING DEVICES INC.
169-0000A8|Stratus Technologies169+0000A8|Stratus Technologies
170-0000A9|NETWORK SYSTEMS CORP.170+0000A9|NETWORK SYSTEMS CORP.
171-0000AA|XEROX CORPORATION171+0000AA|XEROX CORPORATION
172-0000AB|LOGIC MODELING CORPORATION172+0000AB|LOGIC MODELING CORPORATION
173-0000AC|CONWARE COMPUTER CONSULTING173+0000AC|CONWARE COMPUTER CONSULTING
174-0000AD|BRUKER INSTRUMENTS INC.174+0000AD|BRUKER INSTRUMENTS INC.
175-0000AE|DASSAULT ELECTRONIQUE175+0000AE|DASSAULT ELECTRONIQUE
176-0000AF|Canberra Industries, Inc.176+0000AF|Canberra Industries, Inc.
177-0000B0|RND-RAD NETWORK DEVICES177+0000B0|RND-RAD NETWORK DEVICES
178-0000B1|Alpha Micro178+0000B1|Alpha Micro
179-0000B2|TELEVIDEO SYSTEMS, INC.179+0000B2|TELEVIDEO SYSTEMS, INC.
180-0000B3|CIMLINC INCORPORATED180+0000B3|CIMLINC INCORPORATED
181-0000B4|Edimax Technology Co. Ltd.181+0000B4|Edimax Technology Co. Ltd.
182-0000B5|DATABILITY SOFTWARE SYS. INC.182+0000B5|DATABILITY SOFTWARE SYS. INC.
183-0000B6|MICRO-MATIC RESEARCH183+0000B6|MICRO-MATIC RESEARCH
184-0000B7|DOVE COMPUTER CORPORATION184+0000B7|DOVE COMPUTER CORPORATION
185-0000B8|SEIKOSHA CO., LTD.185+0000B8|SEIKOSHA CO., LTD.
186-0000B9|MCDONNELL DOUGLAS COMPUTER SYS186+0000B9|MCDONNELL DOUGLAS COMPUTER SYS
187-0000BA|SIIG, INC.187+0000BA|SIIG, INC.
188-0000BB|TRI-DATA188+0000BB|TRI-DATA
189-0000BC|Rockwell Automation189+0000BC|Rockwell Automation
190-0000BD|RYOSEI, Ltd.190+0000BD|RYOSEI, Ltd.
191-0000BE|THE NTI GROUP191+0000BE|THE NTI GROUP
192-0000BF|SYMMETRIC COMPUTER SYSTEMS192+0000BF|SYMMETRIC COMPUTER SYSTEMS
193-0000C0|WESTERN DIGITAL CORPORATION193+0000C0|WESTERN DIGITAL CORPORATION
194-0000C1|Madge Ltd.194+0000C1|Madge Ltd.
195-0000C2|INFORMATION PRESENTATION TECH.195+0000C2|INFORMATION PRESENTATION TECH.
196-0000C3|Harris Corporation196+0000C3|Harris Corporation
197-0000C4|WATERS DIV. OF MILLIPORE197+0000C4|WATERS DIV. OF MILLIPORE
198-0000C5|Commscope198+0000C5|Commscope
199-0000C6|EON SYSTEMS199+0000C6|EON SYSTEMS
200-0000C7|ARIX CORPORATION200+0000C7|ARIX CORPORATION
201-0000C8|ALTOS COMPUTER SYSTEMS201+0000C8|ALTOS COMPUTER SYSTEMS
202-0000C9|Emulex Corporation202+0000C9|Emulex Corporation
203-0000CA|Commscope203+0000CA|Commscope
204-0000CB|COMPU-SHACK ELECTRONIC GMBH204+0000CB|COMPU-SHACK ELECTRONIC GMBH
205-0000CC|DENSAN CO., LTD.205+0000CC|DENSAN CO., LTD.
206-0000CD|Allied Telesis Labs Ltd206+0000CD|Allied Telesis Labs Ltd
207-0000CE|MEGADATA CORP.207+0000CE|MEGADATA CORP.
208-0000CF|HAYES MICROCOMPUTER PRODUCTS208+0000CF|HAYES MICROCOMPUTER PRODUCTS
209-0000D0|DEVELCON ELECTRONICS LTD.209+0000D0|DEVELCON ELECTRONICS LTD.
210-0000D1|ADAPTEC INCORPORATED210+0000D1|ADAPTEC INCORPORATED
211-0000D2|SBE, INC.211+0000D2|SBE, INC.
212-0000D3|WANG LABORATORIES INC.212+0000D3|WANG LABORATORIES INC.
213-0000D4|PURE DATA LTD.213+0000D4|PURE DATA LTD.
214-0000D5|MICROGNOSIS INTERNATIONAL214+0000D5|MICROGNOSIS INTERNATIONAL
215-0000D6|PUNCH LINE HOLDING215+0000D6|PUNCH LINE HOLDING
216-0000D7|DARTMOUTH COLLEGE216+0000D7|DARTMOUTH COLLEGE
217-0000D8|Novell, Inc.217+0000D8|Novell, Inc.
218-0000D9|NIPPON TELEGRAPH & TELEPHONE218+0000D9|NIPPON TELEGRAPH & TELEPHONE
219-0000DA|ATEX219+0000DA|ATEX
220-0000DB|British Telecommunications plc220+0000DB|British Telecommunications plc
221-0000DC|HAYES MICROCOMPUTER PRODUCTS221+0000DC|HAYES MICROCOMPUTER PRODUCTS
222-0000DD|TCL INCORPORATED222+0000DD|TCL INCORPORATED
223-0000DE|CETIA223+0000DE|CETIA
224-0000DF|BELL & HOWELL PUB SYS DIV224+0000DF|BELL & HOWELL PUB SYS DIV
225-0000E0|QUADRAM CORP.225+0000E0|QUADRAM CORP.
226-0000E1|GRID SYSTEMS226+0000E1|GRID SYSTEMS
227-0000E2|ACER TECHNOLOGIES CORP.227+0000E2|ACER TECHNOLOGIES CORP.
228-0000E3|INTEGRATED MICRO PRODUCTS LTD228+0000E3|INTEGRATED MICRO PRODUCTS LTD
229-0000E4|IN2 GROUPE INTERTECHNIQUE229+0000E4|IN2 GROUPE INTERTECHNIQUE
230-0000E5|SIGMEX LTD.230+0000E5|SIGMEX LTD.
231-0000E6|APTOR PRODUITS DE COMM INDUST231+0000E6|APTOR PRODUITS DE COMM INDUST
232-0000E7|Star Gate Technologies232+0000E7|Star Gate Technologies
233-0000E8|ACCTON TECHNOLOGY CORP.233+0000E8|ACCTON TECHNOLOGY CORP.
234-0000E9|ISICAD, INC.234+0000E9|ISICAD, INC.
235-0000EA|UPNOD AB235+0000EA|UPNOD AB
236-0000EB|MATSUSHITA COMM. IND. CO. LTD.236+0000EB|MATSUSHITA COMM. IND. CO. LTD.
237-0000EC|MICROPROCESS237+0000EC|MICROPROCESS
238-0000ED|APRIL238+0000ED|APRIL
239-0000EE|NETWORK DESIGNERS, LTD.239+0000EE|NETWORK DESIGNERS, LTD.
240-0000EF|KTI240+0000EF|KTI
241-0000F0|Samsung Electronics Co.,Ltd241+0000F0|Samsung Electronics Co.,Ltd
242-0000F1|MAGNA COMPUTER CORPORATION242+0000F1|MAGNA COMPUTER CORPORATION
243-0000F2|SPIDER COMMUNICATIONS243+0000F2|SPIDER COMMUNICATIONS
244-0000F3|GANDALF DATA LIMITED244+0000F3|GANDALF DATA LIMITED
245-0000F4|Allied Telesis, Inc.245+0000F4|Allied Telesis, Inc.
246-0000F5|DIAMOND SALES LIMITED246+0000F5|DIAMOND SALES LIMITED
247-0000F6|APPLIED MICROSYSTEMS CORP.247+0000F6|APPLIED MICROSYSTEMS CORP.
248-0000F7|YOUTH KEEP ENTERPRISE CO LTD248+0000F7|YOUTH KEEP ENTERPRISE CO LTD
249-0000F8|DIGITAL EQUIPMENT CORPORATION249+0000F8|DIGITAL EQUIPMENT CORPORATION
250-0000F9|QUOTRON SYSTEMS INC.250+0000F9|QUOTRON SYSTEMS INC.
251-0000FA|MICROSAGE COMPUTER SYSTEMS INC251+0000FA|MICROSAGE COMPUTER SYSTEMS INC
252-0000FB|RECHNER ZUR KOMMUNIKATION252+0000FB|RECHNER ZUR KOMMUNIKATION
253-0000FC|MEIKO253+0000FC|MEIKO
254-0000FD|HIGH LEVEL HARDWARE254+0000FD|HIGH LEVEL HARDWARE
255-0000FE|Annapolis Micro Systems, Inc.255+0000FE|Annapolis Micro Systems, Inc.
256-0000FF|CAMTEC ELECTRONICS LTD.256+0000FF|CAMTEC ELECTRONICS LTD.
257-000100|EQUIP'TRANS257+000100|EQUIP'TRANS
258-000101|Private258+000101|Private
259-000102|3COM259+000102|3COM
260-000103|3COM260+000103|3COM
261-000104|DVICO Co., Ltd.261+000104|DVICO Co., Ltd.
262-000105|Beckhoff Automation GmbH262+000105|Beckhoff Automation GmbH
263-000106|Tews Datentechnik GmbH263+000106|Tews Datentechnik GmbH
264-000107|Leiser GmbH264+000107|Leiser GmbH
265-000108|AVLAB Technology, Inc.265+000108|AVLAB Technology, Inc.
266-000109|Nagano Japan Radio Co., Ltd.266+000109|Nagano Japan Radio Co., Ltd.
267-00010A|CIS TECHNOLOGY INC.267+00010A|CIS TECHNOLOGY INC.
268-00010B|Space CyberLink, Inc.268+00010B|Space CyberLink, Inc.
269-00010C|System Talks Inc.269+00010C|System Talks Inc.
270-00010D|Teledyne DALSA Inc.270+00010D|Teledyne DALSA Inc.
271-00010E|Bri-Link Technologies Co., Ltd271+00010E|Bri-Link Technologies Co., Ltd
272 00010F|Brocade Communications Systems L272 00010F|Brocade Communications Systems L
273-000110|Gotham Networks273+000110|Gotham Networks
274-000111|iDigm Inc.274+000111|iDigm Inc.
275-000112|Shark Multimedia Inc.275+000112|Shark Multimedia Inc.
276-000113|OLYMPUS CORPORATION276+000113|OLYMPUS CORPORATION
277-000114|KANDA TSUSHIN KOGYO CO., LTD.277+000114|KANDA TSUSHIN KOGYO CO., LTD.
278-000115|EXTRATECH CORPORATION278+000115|EXTRATECH CORPORATION
279-000116|Netspect Technologies, Inc.279+000116|Netspect Technologies, Inc.
280-000117|Canal +280+000117|Canal +
281-000118|EZ Digital Co., Ltd.281+000118|EZ Digital Co., Ltd.
282-000119|RTUnet (Australia)282+000119|RTUnet (Australia)
283-00011A|Hoffmann und Burmeister GbR283+00011A|Hoffmann und Burmeister GbR
284-00011B|Unizone Technologies, Inc.284+00011B|Unizone Technologies, Inc.
285-00011C|Universal Talkware Corporation285+00011C|Universal Talkware Corporation
286-00011D|Centillium Communications286+00011D|Centillium Communications
287-00011E|Precidia Technologies, Inc.287+00011E|Precidia Technologies, Inc.
288-00011F|RC Networks, Inc.288+00011F|RC Networks, Inc.
289-000120|OSCILLOQUARTZ S.A.289+000120|OSCILLOQUARTZ S.A.
290-000121|WatchGuard Technologies, Inc.290+000121|WatchGuard Technologies, Inc.
291-000122|Trend Communications, Ltd.291+000122|Trend Communications, Ltd.
292 000123|Schneider Electric Japan Holding292 000123|Schneider Electric Japan Holding
293-000124|Acer Incorporated293+000124|Acer Incorporated
294-000125|YAESU MUSEN CO., LTD.294+000125|YAESU MUSEN CO., LTD.
295-000126|PAC Labs295+000126|PAC Labs
296-000127|OPEN Networks Pty Ltd296+000127|OPEN Networks Pty Ltd
297-000128|EnjoyWeb, Inc.297+000128|EnjoyWeb, Inc.
298-000129|DFI Inc.298+000129|DFI Inc.
299-00012A|Telematica Sistems Inteligente299+00012A|Telematica Sistems Inteligente
300-00012B|TELENET Co., Ltd.300+00012B|TELENET Co., Ltd.
301-00012C|Aravox Technologies, Inc.301+00012C|Aravox Technologies, Inc.
302-00012D|Komodo Technology302+00012D|Komodo Technology
303-00012E|PC Partner Ltd.303+00012E|PC Partner Ltd.
304-00012F|Twinhead International Corp304+00012F|Twinhead International Corp
305-000130|Extreme Networks, Inc.305+000130|Extreme Networks, Inc.
306-000131|Bosch Security Systems, Inc.306+000131|Bosch Security Systems, Inc.
307-000132|Dranetz - BMI307+000132|Dranetz - BMI
308-000133|KYOWA Electronic Instruments C308+000133|KYOWA Electronic Instruments C
309-000134|Selectron Systems AG309+000134|Selectron Systems AG
310-000135|KDC Corp.310+000135|KDC Corp.
311-000136|CyberTAN Technology Inc.311+000136|CyberTAN Technology Inc.
312-000137|IT Farm Corporation312+000137|IT Farm Corporation
313-000138|XAVi Technologies Corp.313+000138|XAVi Technologies Corp.
314-000139|Point Multimedia Systems314+000139|Point Multimedia Systems
315-00013A|SHELCAD COMMUNICATIONS, LTD.315+00013A|SHELCAD COMMUNICATIONS, LTD.
316-00013B|BNA SYSTEMS316+00013B|BNA SYSTEMS
317-00013C|TIW SYSTEMS317+00013C|TIW SYSTEMS
318-00013D|RiscStation Ltd.318+00013D|RiscStation Ltd.
319-00013E|Ascom Tateco AB319+00013E|Ascom Tateco AB
320-00013F|Neighbor World Co., Ltd.320+00013F|Neighbor World Co., Ltd.
321-000140|Sendtek Corporation321+000140|Sendtek Corporation
322-000141|CABLE PRINT322+000141|CABLE PRINT
323-000142|Cisco Systems, Inc323+000142|Cisco Systems, Inc
324-000143|Cisco Systems, Inc324+000143|Cisco Systems, Inc
325-000144|Dell EMC325+000144|Dell EMC
326-000145|WINSYSTEMS, INC.326+000145|WINSYSTEMS, INC.
327-000146|Tesco Controls, Inc.327+000146|Tesco Controls, Inc.
328-000147|Zhone Technologies, Inc.328+000147|Zhone Technologies, Inc.
329-000148|X-traWeb Inc.329+000148|X-traWeb Inc.
330-000149|TDT AG330+000149|TDT AG
331-00014A|Sony Corporation331+00014A|Sony Corporation
332-00014B|Ennovate Networks, Inc.332+00014B|Ennovate Networks, Inc.
333-00014C|Berkeley Process Control333+00014C|Berkeley Process Control
334-00014D|Shin Kin Enterprises Co., Ltd334+00014D|Shin Kin Enterprises Co., Ltd
335-00014E|WIN Enterprises, Inc.335+00014E|WIN Enterprises, Inc.
336-00014F|Adtran Inc336+00014F|Adtran Inc
337-000150|GILAT COMMUNICATIONS, LTD.337+000150|GILAT COMMUNICATIONS, LTD.
338-000151|Ensemble Communications338+000151|Ensemble Communications
339-000152|CHROMATEK INC.339+000152|CHROMATEK INC.
340-000153|ARCHTEK TELECOM CORPORATION340+000153|ARCHTEK TELECOM CORPORATION
341-000154|G3M Corporation341+000154|G3M Corporation
342-000155|Promise Technology, Inc.342+000155|Promise Technology, Inc.
343-000156|FIREWIREDIRECT.COM, INC.343+000156|FIREWIREDIRECT.COM, INC.
344-000157|SYSWAVE CO., LTD344+000157|SYSWAVE CO., LTD
345-000158|Electro Industries/Gauge Tech345+000158|Electro Industries/Gauge Tech
346-000159|S1 Corporation346+000159|S1 Corporation
347-00015A|Digital Video Broadcasting347+00015A|Digital Video Broadcasting
348-00015B|ITALTEL S.p.A/RF-UP-I348+00015B|ITALTEL S.p.A/RF-UP-I
349-00015C|CADANT INC.349+00015C|CADANT INC.
350-00015D|Oracle Corporation 350+00015D|Oracle Corporation
351-00015E|BEST TECHNOLOGY CO., LTD.351+00015E|BEST TECHNOLOGY CO., LTD.
352-00015F|DIGITAL DESIGN GmbH352+00015F|DIGITAL DESIGN GmbH
353-000160|ELMEX Co., LTD.353+000160|ELMEX Co., LTD.
354-000161|Meta Machine Technology354+000161|Meta Machine Technology
355-000162|Cygnet Technologies, Inc.355+000162|Cygnet Technologies, Inc.
356-000163|Cisco Systems, Inc356+000163|Cisco Systems, Inc
357-000164|Cisco Systems, Inc357+000164|Cisco Systems, Inc
358-000165|AirSwitch Corporation358+000165|AirSwitch Corporation
359-000166|TC GROUP A/S359+000166|TC GROUP A/S
360-000167|HIOKI E.E. CORPORATION360+000167|HIOKI E.E. CORPORATION
361-000168|VITANA CORPORATION361+000168|VITANA CORPORATION
362-000169|Celestix Networks Pte Ltd.362+000169|Celestix Networks Pte Ltd.
363-00016A|ALITEC363+00016A|ALITEC
364-00016B|LightChip, Inc.364+00016B|LightChip, Inc.
365-00016C|FOXCONN365+00016C|FOXCONN
366-00016D|CarrierComm Inc.366+00016D|CarrierComm Inc.
367-00016E|Conklin Corporation367+00016E|Conklin Corporation
368-00016F|Inkel Corp.368+00016F|Inkel Corp.
369-000170|ESE Embedded System Engineer'g369+000170|ESE Embedded System Engineer'g
370-000171|Allied Data Technologies370+000171|Allied Data Technologies
371-000172|TechnoLand Co., LTD.371+000172|TechnoLand Co., LTD.
372-000173|AMCC372+000173|AMCC
373-000174|CyberOptics Corporation373+000174|CyberOptics Corporation
374-000175|Radiant Communications Corp.374+000175|Radiant Communications Corp.
375-000176|Orient Silver Enterprises375+000176|Orient Silver Enterprises
376-000177|EDSL376+000177|EDSL
377-000178|MARGI Systems, Inc.377+000178|MARGI Systems, Inc.
378-000179|WIRELESS TECHNOLOGY, INC.378+000179|WIRELESS TECHNOLOGY, INC.
379 00017A|Chengdu Maipu Electric Industria379 00017A|Chengdu Maipu Electric Industria
380-00017B|Heidelberger Druckmaschinen AG380+00017B|Heidelberger Druckmaschinen AG
381-00017C|AG-E GmbH381+00017C|AG-E GmbH
382-00017D|ThermoQuest382+00017D|ThermoQuest
383-00017E|ADTEK System Science Co., Ltd.383+00017E|ADTEK System Science Co., Ltd.
384-00017F|Experience Music Project384+00017F|Experience Music Project
385-000180|AOpen, Inc.385+000180|AOpen, Inc.
386-000181|Nortel Networks386+000181|Nortel Networks
387-000182|DICA TECHNOLOGIES AG387+000182|DICA TECHNOLOGIES AG
388-000183|ANITE TELECOMS388+000183|ANITE TELECOMS
389-000184|SIEB & MEYER AG389+000184|SIEB & MEYER AG
390-000185|Hitachi Aloka Medical, Ltd.390+000185|Hitachi Aloka Medical, Ltd.
391-000186|Uwe Disch391+000186|Uwe Disch
392-000187|I2SE GmbH392+000187|I2SE GmbH
393-000188|LXCO Technologies ag393+000188|LXCO Technologies ag
394-000189|Refraction Technology, Inc.394+000189|Refraction Technology, Inc.
395-00018A|ROI COMPUTER AG395+00018A|ROI COMPUTER AG
396-00018B|NetLinks Co., Ltd.396+00018B|NetLinks Co., Ltd.
397-00018C|Mega Vision397+00018C|Mega Vision
398-00018D|AudeSi Technologies398+00018D|AudeSi Technologies
399-00018E|Logitec Corporation399+00018E|Logitec Corporation
400-00018F|Kenetec, Inc.400+00018F|Kenetec, Inc.
401-000190|SMK-M401+000190|SMK-M
402-000191|SYRED Data Systems402+000191|SYRED Data Systems
403-000192|Texas Digital Systems403+000192|Texas Digital Systems
404-000193|Hanbyul Telecom Co., Ltd.404+000193|Hanbyul Telecom Co., Ltd.
405-000194|Capital Equipment Corporation405+000194|Capital Equipment Corporation
406-000195|Sena Technologies, Inc.406+000195|Sena Technologies, Inc.
407-000196|Cisco Systems, Inc407+000196|Cisco Systems, Inc
408-000197|Cisco Systems, Inc408+000197|Cisco Systems, Inc
409-000198|Darim Vision409+000198|Darim Vision
410-000199|HeiSei Electronics410+000199|HeiSei Electronics
411-00019A|LEUNIG GmbH411+00019A|LEUNIG GmbH
412-00019B|Kyoto Microcomputer Co., Ltd.412+00019B|Kyoto Microcomputer Co., Ltd.
413-00019C|Lumentum413+00019C|Lumentum
414-00019D|E-Control Systems, Inc.414+00019D|E-Control Systems, Inc.
415-00019E|ESS Technology, Inc.415+00019E|ESS Technology, Inc.
416-00019F|ReadyNet416+00019F|ReadyNet
417-0001A0|Infinilink Corporation417+0001A0|Infinilink Corporation
418-0001A1|Mag-Tek, Inc.418+0001A1|Mag-Tek, Inc.
419-0001A2|Logical Co., Ltd.419+0001A2|Logical Co., Ltd.
420-0001A3|GENESYS LOGIC, INC.420+0001A3|GENESYS LOGIC, INC.
421-0001A4|Microlink Corporation421+0001A4|Microlink Corporation
422-0001A5|Nextcomm, Inc.422+0001A5|Nextcomm, Inc.
423-0001A6|Scientific-Atlanta Arcodan A/S423+0001A6|Scientific-Atlanta Arcodan A/S
424-0001A7|UNEX TECHNOLOGY CORPORATION424+0001A7|UNEX TECHNOLOGY CORPORATION
425-0001A8|Welltech Computer Co., Ltd.425+0001A8|Welltech Computer Co., Ltd.
426-0001A9|BMW AG426+0001A9|BMW AG
427-0001AA|Airspan Communications, Ltd.427+0001AA|Airspan Communications, Ltd.
428-0001AB|Main Street Networks428+0001AB|Main Street Networks
429-0001AC|Sitara Networks, Inc.429+0001AC|Sitara Networks, Inc.
430 0001AD|Coach Master International d.b.430 0001AD|Coach Master International d.b.
431-0001AE|Trex Enterprises431+0001AE|Trex Enterprises
432-0001AF|Artesyn Embedded Technologies432+0001AF|Artesyn Embedded Technologies
433-0001B0|Fulltek Technology Co., Ltd.433+0001B0|Fulltek Technology Co., Ltd.
434-0001B1|General Bandwidth434+0001B1|General Bandwidth
435 0001B2|Digital Processing Systems, Inc.435 0001B2|Digital Processing Systems, Inc.
436 0001B3|Precision Electronic Manufacturi436 0001B3|Precision Electronic Manufacturi
437-0001B4|Wayport, Inc.437+0001B4|Wayport, Inc.
438-0001B5|Turin Networks, Inc.438+0001B5|Turin Networks, Inc.
439-0001B6|SAEJIN T&M Co., Ltd.439+0001B6|SAEJIN T&M Co., Ltd.
440-0001B7|Centos, Inc.440+0001B7|Centos, Inc.
441-0001B8|Netsensity, Inc.441+0001B8|Netsensity, Inc.
442-0001B9|SKF (U.K.) Limited442+0001B9|SKF (U.K.) Limited
443-0001BA|IC-Net, Inc.443+0001BA|IC-Net, Inc.
444-0001BB|Frequentis444+0001BB|Frequentis
445-0001BC|Brains Corporation445+0001BC|Brains Corporation
446 0001BD|Peterson Electro-Musical Product446 0001BD|Peterson Electro-Musical Product
447-0001BE|Gigalink Co., Ltd.447+0001BE|Gigalink Co., Ltd.
448-0001BF|Teleforce Co., Ltd.448+0001BF|Teleforce Co., Ltd.
449-0001C0|CompuLab, Ltd.449+0001C0|CompuLab, Ltd.
450 0001C1|Vitesse Semiconductor Corporatio450 0001C1|Vitesse Semiconductor Corporatio
451-0001C2|ARK Research Corp.451+0001C2|ARK Research Corp.
452-0001C3|Acromag, Inc.452+0001C3|Acromag, Inc.
453-0001C4|NeoWave, Inc.453+0001C4|NeoWave, Inc.
454-0001C5|Simpler Networks454+0001C5|Simpler Networks
455-0001C6|Quarry Technologies455+0001C6|Quarry Technologies
456-0001C7|Cisco Systems, Inc456+0001C7|Cisco Systems, Inc
457-0001C8|CONRAD CORP.457+0001C8|THOMAS CONRAD CORP.
458-0001C9|Cisco Systems, Inc458+0001C9|Cisco Systems, Inc
459-0001CA|Geocast Network Systems, Inc.459+0001CA|Geocast Network Systems, Inc.
460-0001CB|EVR460+0001CB|EVR
461-0001CC|Brand Maker Enabler Inc. 461+0001CC|Brand Maker Enabler Inc.
462-0001CD|ARtem462+0001CD|ARtem
463-0001CE|Custom Micro Products, Ltd.463+0001CE|Custom Micro Products, Ltd.
464 0001CF|Alpha Data Parallel Systems, Ltd464 0001CF|Alpha Data Parallel Systems, Ltd
465-0001D0|VitalPoint, Inc.465+0001D0|VitalPoint, Inc.
466-0001D1|CoNet Communications, Inc.466+0001D1|CoNet Communications, Inc.
467-0001D2|inXtron, Inc. 467+0001D2|inXtron, Inc.
468-0001D3|PAXCOMM, Inc.468+0001D3|PAXCOMM, Inc.
469-0001D4|Leisure Time, Inc.469+0001D4|Leisure Time, Inc.
470-0001D5|HAEDONG INFO & COMM CO., LTD470+0001D5|HAEDONG INFO & COMM CO., LTD
471-0001D6|manroland AG471+0001D6|manroland AG
472-0001D7|F5 Inc.472+0001D7|F5 Inc.
473-0001D8|Teltronics, Inc.473+0001D8|Teltronics, Inc.
474-0001D9|Sigma, Inc.474+0001D9|Sigma, Inc.
475-0001DA|WINCOMM Corporation475+0001DA|WINCOMM Corporation
476-0001DB|Freecom Technologies GmbH476+0001DB|Freecom Technologies GmbH
477-0001DC|Activetelco477+0001DC|Activetelco
478-0001DD|Avail Networks478+0001DD|Avail Networks
479-0001DE|Trango Systems, Inc.479+0001DE|Trango Systems, Inc.
480-0001DF|ISDN Communications, Ltd.480+0001DF|ISDN Communications, Ltd.
481-0001E0|Fast Systems, Inc.481+0001E0|Fast Systems, Inc.
482-0001E1|Kinpo Electronics, Inc.482+0001E1|Kinpo Electronics, Inc.
483-0001E2|Ando Electric Corporation483+0001E2|Ando Electric Corporation
484-0001E3|Siemens AG484+0001E3|Siemens AG
485-0001E4|Sitera, Inc.485+0001E4|Sitera, Inc.
486-0001E5|Supernet, Inc.486+0001E5|Supernet, Inc.
487-0001E6|Hewlett Packard487+0001E6|Hewlett Packard
488-0001E7|Hewlett Packard488+0001E7|Hewlett Packard
489-0001E8|Force10 Networks, Inc.489+0001E8|Force10 Networks, Inc.
490-0001E9|Litton Marine Systems B.V.490+0001E9|Litton Marine Systems B.V.
491-0001EA|Cirilium Corp.491+0001EA|Cirilium Corp.
492-0001EB|C-COM Corporation492+0001EB|C-COM Corporation
493-0001EC|Ericsson Group493+0001EC|Ericsson Group
494-0001ED|SETA Corp.494+0001ED|SETA Corp.
495-0001EE|Comtrol Europe, Ltd.495+0001EE|Comtrol Europe, Ltd.
496-0001EF|Camtel Technology Corp.496+0001EF|Camtel Technology Corp.
497-0001F0|Tridium, Inc.497+0001F0|Tridium, Inc.
498-0001F1|Innovative Concepts, Inc.498+0001F1|Innovative Concepts, Inc.
499-0001F2|Mark of the Unicorn, Inc.499+0001F2|Mark of the Unicorn, Inc.
500-0001F3|QPS, Inc.500+0001F3|QPS, Inc.
501-0001F4|Enterasys501+0001F4|Enterasys
502-0001F5|ERIM S.A.502+0001F5|ERIM S.A.
503 0001F6|Association of Musical Electroni503 0001F6|Association of Musical Electroni
504-0001F7|Image Display Systems, Inc.504+0001F7|Image Display Systems, Inc.
505-0001F8|TEXIO TECHNOLOGY CORPORATION505+0001F8|TEXIO TECHNOLOGY CORPORATION
506-0001F9|TeraGlobal Communications Corp.506+0001F9|TeraGlobal Communications Corp.
507-0001FA|HOROSCAS507+0001FA|HOROSCAS
508-0001FB|DoTop Technology, Inc.508+0001FB|DoTop Technology, Inc.
509-0001FC|Keyence Corporation509+0001FC|Keyence Corporation
510-0001FD|Digital Voice Systems, Inc.510+0001FD|Digital Voice Systems, Inc.
511-0001FE|DIGITAL EQUIPMENT CORPORATION511+0001FE|DIGITAL EQUIPMENT CORPORATION
512-0001FF|Data Direct Networks, Inc.512+0001FF|Data Direct Networks, Inc.
513-000200|Net & Sys Co., Ltd.513+000200|Net & Sys Co., Ltd.
514-000201|IFM Electronic gmbh514+000201|IFM Electronic gmbh
515-000202|Amino Communications, Ltd.515+000202|Amino Communications, Ltd.
516-000203|Woonsang Telecom, Inc.516+000203|Woonsang Telecom, Inc.
517 000204|Bodmann Industries Elektronik Gm517 000204|Bodmann Industries Elektronik Gm
518-000205|Hitachi Denshi, Ltd.518+000205|Hitachi Denshi, Ltd.
519-000206|Telital R&D Denmark A/S519+000206|Telital R&D Denmark A/S
520-000207|VisionGlobal Network Corp.520+000207|VisionGlobal Network Corp.
521-000208|Unify Networks, Inc.521+000208|Unify Networks, Inc.
522 000209|Shenzhen SED Information Technol522 000209|Shenzhen SED Information Technol
523-00020A|Gefran Spa523+00020A|Gefran Spa
524-00020B|Native Networks, Inc.524+00020B|Native Networks, Inc.
525-00020C|Metro-Optix525+00020C|Metro-Optix
526-00020D|Micronpc.com526+00020D|Micronpc.com
527-00020E|ECI Telecom Ltd.527+00020E|ECI Telecom Ltd.
528-00020F|AATR528+00020F|AATR
529-000210|Fenecom529+000210|Fenecom
530 000211|Nature Worldwide Technology Corp530 000211|Nature Worldwide Technology Corp
531-000212|SierraCom531+000212|SierraCom
532-000213|S.D.E.L.532+000213|S.D.E.L.
533-000214|DTVRO533+000214|DTVRO
534-000215|Cotas Computer Technology A/B534+000215|Cotas Computer Technology A/B
535-000216|Cisco Systems, Inc535+000216|Cisco Systems, Inc
536-000217|Cisco Systems, Inc536+000217|Cisco Systems, Inc
537-000218|Advanced Scientific Corp537+000218|Advanced Scientific Corp
538-000219|Paralon Technologies538+000219|Paralon Technologies
539-00021A|Zuma Networks539+00021A|Zuma Networks
540-00021B|Kollmorgen-Servotronix540+00021B|Kollmorgen-Servotronix
541-00021C|Network Elements, Inc.541+00021C|Network Elements, Inc.
542-00021D|Data General Communication Ltd.542+00021D|Data General Communication Ltd.
543-00021E|SIMTEL S.R.L.543+00021E|SIMTEL S.R.L.
544-00021F|Aculab PLC544+00021F|Aculab PLC
545-000220|CANON FINETECH INC.545+000220|CANON FINETECH INC.
546-000221|DSP Application, Ltd.546+000221|DSP Application, Ltd.
547-000222|Chromisys, Inc.547+000222|Chromisys, Inc.
548-000223|ClickTV548+000223|ClickTV
549-000224|C-COR549+000224|C-COR
550-000225|One Stop Systems550+000225|One Stop Systems
551-000226|XESystems, Inc.551+000226|XESystems, Inc.
552 000227|ESD Electronic System Design Gmb552 000227|ESD Electronic System Design Gmb
553-000228|Necsom, Ltd.553+000228|Necsom, Ltd.
554-000229|Adtec Corporation554+000229|Adtec Corporation
555-00022A|Asound Electronic555+00022A|Asound Electronic
556-00022B|SAXA, Inc.556+00022B|SAXA, Inc.
557-00022C|ABB Bomem, Inc.557+00022C|ABB Bomem, Inc.
558-00022D|Agere Systems558+00022D|Agere Systems
559-00022E|TEAC Corp. R& D559+00022E|TEAC Corp. R& D
560-00022F|P-Cube, Ltd.560+00022F|P-Cube, Ltd.
561-000230|Intersoft Electronics561+000230|Intersoft Electronics
562-000231|Ingersoll-Rand562+000231|Ingersoll-Rand
563-000232|Avision, Inc.563+000232|Avision, Inc.
564-000233|Mantra Communications, Inc.564+000233|Mantra Communications, Inc.
565-000234|Imperial Technology, Inc.565+000234|Imperial Technology, Inc.
566-000235|Paragon Networks International566+000235|Paragon Networks International
567-000236|INIT GmbH567+000236|INIT GmbH
568-000237|Cosmo Research Corp.568+000237|Cosmo Research Corp.
569-000238|Serome Technology, Inc.569+000238|Serome Technology, Inc.
570-000239|Visicom570+000239|Visicom
571-00023A|ZSK Stickmaschinen GmbH571+00023A|ZSK Stickmaschinen GmbH
572-00023B|Ericsson572+00023B|Ericsson
573-00023C|Creative Technology, Ltd.573+00023C|Creative Technology, Ltd.
574-00023D|Cisco Systems, Inc574+00023D|Cisco Systems, Inc
575-00023E|Selta Telematica S.p.a575+00023E|Selta Telematica S.p.a
576-00023F|Compal Electronics INC.576+00023F|Compal Electronics INC.
577-000240|Seedek Co., Ltd.577+000240|Seedek Co., Ltd.
578-000241|Amer.com578+000241|Amer.com
579-000242|Videoframe Systems579+000242|Videoframe Systems
580-000243|Raysis Co., Ltd.580+000243|Raysis Co., Ltd.
581-000244|SURECOM Technology Co.581+000244|SURECOM Technology Co.
582-000245|Lampus Co, Ltd.582+000245|Lampus Co, Ltd.
583-000246|All-Win Tech Co., Ltd.583+000246|All-Win Tech Co., Ltd.
584 000247|Great Dragon Information Technol584 000247|Great Dragon Information Technol
585-000248|Pilz GmbH & Co.585+000248|Pilz GmbH & Co.
586-000249|Aviv Infocom Co, Ltd.586+000249|Aviv Infocom Co, Ltd.
587-00024A|Cisco Systems, Inc587+00024A|Cisco Systems, Inc
588-00024B|Cisco Systems, Inc588+00024B|Cisco Systems, Inc
589-00024C|SiByte, Inc.589+00024C|SiByte, Inc.
590 00024D|Mannesman Dematic Colby Pty. Ltd590 00024D|Mannesman Dematic Colby Pty. Ltd
591-00024E|Datacard Group591+00024E|Datacard Group
592-00024F|IPM Datacom S.R.L.592+00024F|IPM Datacom S.R.L.
593-000250|Geyser Networks, Inc.593+000250|Geyser Networks, Inc.
594-000251|Soma Networks, Inc.594+000251|Soma Networks, Inc.
595-000252|Carrier Corporation595+000252|Carrier Corporation
596-000253|Televideo, Inc.596+000253|Televideo, Inc.
597-000254|WorldGate597+000254|WorldGate
598-000255|IBM Corp598+000255|IBM Corp
599-000256|Alpha Processor, Inc.599+000256|Alpha Processor, Inc.
600-000257|Microcom Corp.600+000257|Microcom Corp.
601-000258|Flying Packets Communications601+000258|Flying Packets Communications
602 000259|Tsann Kuen China (Shanghai)Enter602 000259|Tsann Kuen China (Shanghai)Enter
603-00025A|Catena Networks603+00025A|Catena Networks
604-00025B|Cambridge Silicon Radio604+00025B|Cambridge Silicon Radio
605-00025C|SCI Systems (Kunshan) Co., Ltd.605+00025C|SCI Systems (Kunshan) Co., Ltd.
606-00025D|Calix Networks606+00025D|Calix Networks
607-00025E|High Technology Ltd607+00025E|High Technology Ltd
608-00025F|Nortel Networks608+00025F|Nortel Networks
609-000260|Accordion Networks, Inc.609+000260|Accordion Networks, Inc.
610-000261|Tilgin AB610+000261|Tilgin AB
611 000262|Soyo Group Soyo Com Tech Co., Lt611 000262|Soyo Group Soyo Com Tech Co., Lt
612-000263|RPS S.p.A.612+000263|RPS S.p.A.
613-000264|AudioRamp.com613+000264|AudioRamp.com
614-000265|Virditech Co. Ltd.614+000265|Virditech Co. Ltd.
615-000266|Thermalogic Corporation615+000266|Thermalogic Corporation
616-000267|NODE RUNNER, INC.616+000267|NODE RUNNER, INC.
617 000268|Harris Government Communications617 000268|Harris Government Communications
618-000269|Nadatel Co., Ltd618+000269|Nadatel Co., Ltd
619-00026A|Cocess Telecom Co., Ltd.619+00026A|Cocess Telecom Co., Ltd.
620-00026B|BCM Computers Co., Ltd.620+00026B|BCM Computers Co., Ltd.
621-00026C|Philips CFT621+00026C|Philips CFT
622-00026D|Adept Telecom622+00026D|Adept Telecom
623-00026E|NeGeN Access, Inc.623+00026E|NeGeN Access, Inc.
624-00026F|Senao International Co., Ltd.624+00026F|Senao International Co., Ltd.
625-000270|Crewave Co., Ltd.625+000270|Crewave Co., Ltd.
626-000271|Zhone Technologies, Inc.626+000271|Zhone Technologies, Inc.
627-000272|CC&C Technologies, Inc.627+000272|CC&C Technologies, Inc.
628-000273|Coriolis Networks628+000273|Coriolis Networks
629-000274|Tommy Technologies Corp.629+000274|Tommy Technologies Corp.
630-000275|SMART Technologies, Inc.630+000275|SMART Technologies, Inc.
631-000276|Primax Electronics Ltd.631+000276|Primax Electronics Ltd.
632-000277|Cash Systemes Industrie632+000277|Cash Systemes Industrie
633 000278|SAMSUNG ELECTRO MECHANICS CO., L633 000278|SAMSUNG ELECTRO MECHANICS CO., L
634-000279|Control Applications, Ltd.634+000279|Control Applications, Ltd.
635-00027A|IOI Technology Corporation635+00027A|IOI Technology Corporation
636-00027B|Amplify Net, Inc.636+00027B|Amplify Net, Inc.
637-00027C|Trilithic, Inc.637+00027C|Trilithic, Inc.
638-00027D|Cisco Systems, Inc638+00027D|Cisco Systems, Inc
639-00027E|Cisco Systems, Inc639+00027E|Cisco Systems, Inc
640-00027F|ask-technologies.com640+00027F|ask-technologies.com
641-000280|Mu Net, Inc.641+000280|Mu Net, Inc.
642-000281|Madge Ltd.642+000281|Madge Ltd.
643-000282|ViaClix, Inc.643+000282|ViaClix, Inc.
644-000283|Spectrum Controls, Inc.644+000283|Spectrum Controls, Inc.
645-000284|UK Grid Solutions Limited645+000284|UK Grid Solutions Limited
646-000285|Riverstone Networks646+000285|Riverstone Networks
647-000286|Occam Networks647+000286|Occam Networks
648-000287|Adapcom648+000287|Adapcom
649-000288|GLOBAL VILLAGE COMMUNICATION649+000288|GLOBAL VILLAGE COMMUNICATION
650-000289|DNE Technologies650+000289|DNE Technologies
651-00028A|Ambit Microsystems Corporation651+00028A|Ambit Microsystems Corporation
652-00028B|VDSL Systems OY652+00028B|VDSL Systems OY
653-00028C|Micrel-Synergy Semiconductor653+00028C|Micrel-Synergy Semiconductor
654-00028D|Movita Technologies, Inc.654+00028D|Movita Technologies, Inc.
655-00028E|Rapid 5 Networks, Inc.655+00028E|Rapid 5 Networks, Inc.
656-00028F|Globetek, Inc.656+00028F|Globetek, Inc.
657-000290|Woorigisool, Inc.657+000290|Woorigisool, Inc.
658-000291|Open Network Co., Ltd.658+000291|Open Network Co., Ltd.
659-000292|Logic Innovations, Inc.659+000292|Logic Innovations, Inc.
660-000293|Solid Data Systems660+000293|Solid Data Systems
661-000294|Tokyo Sokushin Co., Ltd.661+000294|Tokyo Sokushin Co., Ltd.
662-000295|MAVENIR IPA UK LTD662+000295|MAVENIR IPA UK LTD
663-000296|Lectron Co,. Ltd.663+000296|Lectron Co,. Ltd.
664-000297|C-COR.net664+000297|C-COR.net
665-000298|Broadframe Corporation665+000298|Broadframe Corporation
666-000299|Apex, Inc.666+000299|Apex, Inc.
667-00029A|Storage Apps667+00029A|Storage Apps
668-00029B|Kreatel Communications AB668+00029B|Kreatel Communications AB
669-00029C|3COM669+00029C|3COM
670-00029D|Merix Corp.670+00029D|Merix Corp.
671-00029E|Information Equipment Co., Ltd.671+00029E|Information Equipment Co., Ltd.
672 00029F|L-3 Communication Aviation Recor672 00029F|L-3 Communication Aviation Recor
673-0002A0|Flatstack Ltd.673+0002A0|Flatstack Ltd.
674-0002A1|World Wide Packets674+0002A1|World Wide Packets
675-0002A2|Hilscher GmbH675+0002A2|Hilscher GmbH
676-0002A3|Hitachi Energy Switzerland Ltd676+0002A3|Hitachi Energy Switzerland Ltd
677-0002A4|AddPac Technology Co., Ltd.677+0002A4|AddPac Technology Co., Ltd.
678-0002A5|Hewlett Packard678+0002A5|Hewlett Packard
679-0002A6|Effinet Systems Co., Ltd.679+0002A6|Effinet Systems Co., Ltd.
680-0002A7|Vivace Networks680+0002A7|Vivace Networks
681-0002A8|Air Link Technology681+0002A8|Air Link Technology
682-0002A9|RACOM, s.r.o.682+0002A9|RACOM, s.r.o.
683-0002AA|PLcom Co., Ltd.683+0002AA|PLcom Co., Ltd.
684 0002AB|CTC Union Technologies Co., Ltd.684 0002AB|CTC Union Technologies Co., Ltd.
685-0002AC|3PAR data685+0002AC|3PAR data
686-0002AD|HOYA Corporation686+0002AD|HOYA Corporation
687-0002AE|Scannex Electronics Ltd.687+0002AE|Scannex Electronics Ltd.
688-0002AF|TeleCruz Technology, Inc.688+0002AF|TeleCruz Technology, Inc.
689 0002B0|Hokubu Communication & Industria689 0002B0|Hokubu Communication & Industria
690-0002B1|Anritsu, Ltd.690+0002B1|Anritsu, Ltd.
691-0002B2|Cablevision691+0002B2|Cablevision
692-0002B3|Intel Corporation692+0002B3|Intel Corporation
693-0002B4|DAPHNE693+0002B4|DAPHNE
694-0002B5|Avnet, Inc.694+0002B5|Avnet, Inc.
695-0002B6|Acrosser Technology Co., Ltd.695+0002B6|Acrosser Technology Co., Ltd.
696 0002B7|Watanabe Electric Industry Co., 696 0002B7|Watanabe Electric Industry Co.,
697-0002B8|WHI KONSULT AB697+0002B8|WHI KONSULT AB
698-0002B9|Cisco Systems, Inc698+0002B9|Cisco Systems, Inc
699-0002BA|Cisco Systems, Inc699+0002BA|Cisco Systems, Inc
700-0002BB|Continuous Computing Corp700+0002BB|Continuous Computing Corp
701-0002BC|LVL 7 Systems, Inc.701+0002BC|LVL 7 Systems, Inc.
702-0002BD|Bionet Co., Ltd.702+0002BD|Bionet Co., Ltd.
703-0002BE|Totsu Engineering, Inc.703+0002BE|Totsu Engineering, Inc.
704-0002BF|dotRocket, Inc.704+0002BF|dotRocket, Inc.
705 0002C0|Bencent Tzeng Industry Co., Ltd.705 0002C0|Bencent Tzeng Industry Co., Ltd.
706 0002C1|Innovative Electronic Designs, I706 0002C1|Innovative Electronic Designs, I
707-0002C2|Net Vision Telecom707+0002C2|Net Vision Telecom
708-0002C3|Arelnet Ltd.708+0002C3|Arelnet Ltd.
709 0002C4|OPT Machine Vision Tech Co., Ltd709 0002C4|OPT Machine Vision Tech Co., Ltd
710-0002C5|Evertz Microsystems Ltd.710+0002C5|Evertz Microsystems Ltd.
711-0002C6|Data Track Technology PLC711+0002C6|Data Track Technology PLC
712-0002C7|ALPSALPINE CO,.LTD712+0002C7|ALPSALPINE CO,.LTD
713 0002C8|Technocom Communications Technol713 0002C8|Technocom Communications Technol
714-0002C9|Mellanox Technologies, Inc.714+0002C9|Mellanox Technologies, Inc.
715-0002CA|EndPoints, Inc.715+0002CA|EndPoints, Inc.
716-0002CB|TriState Ltd.716+0002CB|TriState Ltd.
717-0002CC|M.C.C.I717+0002CC|M.C.C.I
718-0002CD|TeleDream, Inc.718+0002CD|TeleDream, Inc.
719-0002CE|FoxJet, Inc.719+0002CE|FoxJet, Inc.
720-0002CF|ZyGate Communications, Inc.720+0002CF|ZyGate Communications, Inc.
721-0002D0|Comdial Corporation721+0002D0|Comdial Corporation
722-0002D1|Vivotek, Inc.722+0002D1|Vivotek, Inc.
723-0002D2|Workstation AG723+0002D2|Workstation AG
724-0002D3|NetBotz, Inc.724+0002D3|NetBotz, Inc.
725-0002D4|PDA Peripherals, Inc.725+0002D4|PDA Peripherals, Inc.
726-0002D5|ACR726+0002D5|ACR
727-0002D6|NICE Systems727+0002D6|NICE Systems
728-0002D7|EMPEG Ltd728+0002D7|EMPEG Ltd
729 0002D8|BRECIS Communications Corporatio729 0002D8|BRECIS Communications Corporatio
730-0002D9|Reliable Controls730+0002D9|Reliable Controls
731-0002DA|ExiO Communications, Inc.731+0002DA|ExiO Communications, Inc.
732-0002DB|NETSEC732+0002DB|NETSEC
733-0002DC|GENERAL Inc.733+0002DC|GENERAL Inc.
734-0002DD|Bromax Communications, Ltd.734+0002DD|Bromax Communications, Ltd.
735-0002DE|Astrodesign, Inc.735+0002DE|Astrodesign, Inc.
736-0002DF|Net Com Systems, Inc.736+0002DF|Net Com Systems, Inc.
737-0002E0|ETAS GmbH737+0002E0|ETAS GmbH
738-0002E1|Integrated Network Corporation738+0002E1|Integrated Network Corporation
739-0002E2|NDC Infared Engineering739+0002E2|NDC Infared Engineering
740-0002E3|LITE-ON Communications, Inc.740+0002E3|LITE-ON Communications, Inc.
741-0002E4|JC HYUN Systems, Inc.741+0002E4|JC HYUN Systems, Inc.
742-0002E5|Timeware Ltd.742+0002E5|Timeware Ltd.
743-0002E6|Gould Instrument Systems, Inc.743+0002E6|Gould Instrument Systems, Inc.
744-0002E7|CAB GmbH & Co KG744+0002E7|CAB GmbH & Co KG
745-0002E8|E.D.&A.745+0002E8|E.D.&A.
746-0002E9|CS Systemes De Securite - C3S746+0002E9|CS Systemes De Securite - C3S
747-0002EA|Focus Enhancements747+0002EA|Focus Enhancements
748-0002EB|Pico Communications748+0002EB|Pico Communications
749-0002EC|Maschoff Design Engineering749+0002EC|Maschoff Design Engineering
750-0002ED|DXO Telecom Co., Ltd.750+0002ED|DXO Telecom Co., Ltd.
751-0002EE|Nokia Danmark A/S751+0002EE|Nokia Danmark A/S
752-0002EF|CCC Network Systems Group Ltd.752+0002EF|CCC Network Systems Group Ltd.
753 0002F0|AME Optimedia Technology Co., Lt753 0002F0|AME Optimedia Technology Co., Lt
754-0002F1|Pinetron Co., Ltd.754+0002F1|Pinetron Co., Ltd.
755-0002F2|eDevice, Inc.755+0002F2|eDevice, Inc.
756-0002F3|Media Serve Co., Ltd.756+0002F3|Media Serve Co., Ltd.
757-0002F4|PCTEL, Inc.757+0002F4|PCTEL, Inc.
758-0002F5|VIVE Synergies, Inc.758+0002F5|VIVE Synergies, Inc.
759-0002F6|Equipe Communications759+0002F6|Equipe Communications
760-0002F7|ARM760+0002F7|ARM
761-0002F8|SEAKR Engineering, Inc.761+0002F8|SEAKR Engineering, Inc.
762-0002F9|MIMOS Berhad762+0002F9|MIMOS Berhad
763-0002FA|DX Antenna Co., Ltd.763+0002FA|DX Antenna Co., Ltd.
764 0002FB|Baumuller Aulugen-Systemtechnik 764 0002FB|Baumuller Aulugen-Systemtechnik
765-0002FC|Cisco Systems, Inc765+0002FC|Cisco Systems, Inc
766-0002FD|Cisco Systems, Inc766+0002FD|Cisco Systems, Inc
767-0002FE|Viditec, Inc.767+0002FE|Viditec, Inc.
768-0002FF|Handan BroadInfoCom768+0002FF|Handan BroadInfoCom
769-000300|Barracuda Networks, Inc.769+000300|Barracuda Networks, Inc.
770-000301|EXFO770+000301|EXFO
771-000302|Charles Industries771+000302|Charles Industries
772-000303|JAMA Electronics Co., Ltd.772+000303|JAMA Electronics Co., Ltd.
773 000304|Pacific Broadband Communications773 000304|Pacific Broadband Communications
774-000305|MSC Vertriebs GmbH774+000305|MSC Vertriebs GmbH
775-000306|Fusion In Tech Co., Ltd.775+000306|Fusion In Tech Co., Ltd.
776-000307|Secure Works, Inc.776+000307|Secure Works, Inc.
777-000308|AM Communications, Inc.777+000308|AM Communications, Inc.
778-000309|Texcel Technology PLC778+000309|Texcel Technology PLC
779-00030A|Argus Technologies779+00030A|Argus Technologies
780-00030B|Hunter Technology, Inc.780+00030B|Hunter Technology, Inc.
781-00030C|Telesoft Technologies Ltd.781+00030C|Telesoft Technologies Ltd.
782-00030D|Uniwill Computer Corp.782+00030D|Uniwill Computer Corp.
783-00030E|Core Communications Co., Ltd.783+00030E|Core Communications Co., Ltd.
784 00030F|Digital China (Shanghai) Network784 00030F|Digital China (Shanghai) Network
785-000310|E-Globaledge Corporation785+000310|E-Globaledge Corporation
786-000311|Micro Technology Co., Ltd.786+000311|Micro Technology Co., Ltd.
787-000312|TRsystems GmbH787+000312|TRsystems GmbH
788-000313|Access Media SPA788+000313|Access Media SPA
789-000314|Teleware Network Systems789+000314|Teleware Network Systems
790-000315|Cidco Incorporated790+000315|Cidco Incorporated
791-000316|Nobell Communications, Inc.791+000316|Nobell Communications, Inc.
792-000317|Merlin Systems, Inc.792+000317|Merlin Systems, Inc.
793-000318|Cyras Systems, Inc.793+000318|Cyras Systems, Inc.
794-000319|Infineon AG794+000319|Infineon AG
795 00031A|Beijing Broad Telecom Ltd., Chin795 00031A|Beijing Broad Telecom Ltd., Chin
796-00031B|Cellvision Systems, Inc.796+00031B|Cellvision Systems, Inc.
797-00031C|Svenska Hardvarufabriken AB797+00031C|Svenska Hardvarufabriken AB
798-00031D|Taiwan Commate Computer, Inc.798+00031D|Taiwan Commate Computer, Inc.
799-00031E|Optranet, Inc.799+00031E|Optranet, Inc.
800-00031F|Condev Ltd.800+00031F|Condev Ltd.
801-000320|Xpeed, Inc.801+000320|Xpeed, Inc.
802-000321|Reco Research Co., Ltd.802+000321|Reco Research Co., Ltd.
803-000322|IDIS Co., Ltd.803+000322|IDIS Co., Ltd.
804-000323|Cornet Technology, Inc.804+000323|Cornet Technology, Inc.
805-000324|LIMNO Co., Ltd.805+000324|LIMNO Co., Ltd.
806-000325|Arima Computer Corp.806+000325|Arima Computer Corp.
807 000326|Iwasaki Information Systems Co.,807 000326|Iwasaki Information Systems Co.,
808-000327|HMS Industrial Networks808+000327|HMS Industrial Networks
809-000328|Mace Group, Inc.809+000328|Mace Group, Inc.
810-000329|F3, Inc.810+000329|F3, Inc.
811 00032A|UniData Communication Systems, I811 00032A|UniData Communication Systems, I
812-00032B|GAI Datenfunksysteme GmbH812+00032B|GAI Datenfunksysteme GmbH
813-00032C|ABB Switzerland Ltd813+00032C|ABB Switzerland Ltd
814-00032D|IBASE Technology, Inc.814+00032D|IBASE Technology, Inc.
815 00032E|Scope Information Management, Lt815 00032E|Scope Information Management, Lt
816-00032F|Global Sun Technology, Inc.816+00032F|Global Sun Technology, Inc.
817-000330|Imagenics, Co., Ltd.817+000330|Imagenics, Co., Ltd.
818-000331|Cisco Systems, Inc818+000331|Cisco Systems, Inc
819-000332|Cisco Systems, Inc819+000332|Cisco Systems, Inc
820-000333|Digitel Co., Ltd.820+000333|Digitel Co., Ltd.
821-000334|Omega Engineering Inc.821+000334|Omega Engineering Inc.
822-000335|Mirae Technology822+000335|Mirae Technology
823-000336|Zetes Technologies823+000336|Zetes Technologies
824-000337|Vaone, Inc.824+000337|Vaone, Inc.
825-000338|Oak Technology825+000338|Oak Technology
826-000339|Eurologic Systems, Ltd.826+000339|Eurologic Systems, Ltd.
827-00033A|Silicon Wave, Inc.827+00033A|Silicon Wave, Inc.
828-00033B|TAMI Tech Co., Ltd.828+00033B|TAMI Tech Co., Ltd.
829-00033C|Daiden Co., Ltd.829+00033C|Daiden Co., Ltd.
830-00033D|ILSHin Lab830+00033D|ILSHin Lab
831 00033E|Tateyama System Laboratory Co., 831 00033E|Tateyama System Laboratory Co.,
832-00033F|BigBand Networks, Ltd.832+00033F|BigBand Networks, Ltd.
833-000340|Floware Wireless Systems, Ltd.833+000340|Floware Wireless Systems, Ltd.
834-000341|EVS Broadcast Equipment834+000341|EVS Broadcast Equipment
835-000342|Nortel Networks835+000342|Nortel Networks
836-000343|Martin Professional A/S836+000343|Martin Professional A/S
837-000344|Tietech.Co., Ltd.837+000344|Tietech.Co., Ltd.
838-000345|Routrek Networks Corporation838+000345|Routrek Networks Corporation
839-000346|KOKUSAI DENKI Electric Inc.839+000346|KOKUSAI DENKI Electric Inc.
840-000347|Intel Corporation840+000347|Intel Corporation
841-000348|Norscan Instruments, Ltd.841+000348|Norscan Instruments, Ltd.
842-000349|Vidicode Datacommunicatie B.V.842+000349|Vidicode Datacommunicatie B.V.
843-00034A|RIAS Corporation843+00034A|RIAS Corporation
844-00034B|Nortel Networks844+00034B|Nortel Networks
845 00034C|Shanghai DigiVision Technology C845 00034C|Shanghai DigiVision Technology C
846-00034D|Chiaro Networks, Ltd.846+00034D|Chiaro Networks, Ltd.
847-00034E|Pos Data Company, Ltd.847+00034E|Pos Data Company, Ltd.
848-00034F|Sur-Gard Security848+00034F|Sur-Gard Security
849-000350|BTICINO SPA849+000350|BTICINO SPA
850-000351|Diebold Nixdorf850+000351|Diebold Nixdorf
851-000352|Colubris Networks851+000352|Colubris Networks
852-000353|Mitac, Inc.852+000353|Mitac, Inc.
853-000354|Fiber Logic Communications853+000354|Fiber Logic Communications
854-000355|TeraBeam Internet Systems854+000355|TeraBeam Internet Systems
855-000356|Diebold Nixdorf855+000356|Diebold Nixdorf
856-000357|Intervoice-Brite, Inc.856+000357|Intervoice-Brite, Inc.
857-000358|Hanyang Digitech Co.Ltd857+000358|Hanyang Digitech Co.Ltd
858-000359|DigitalSis858+000359|DigitalSis
859-00035A|Photron Limited859+00035A|Photron Limited
860-00035B|BridgeWave Communications860+00035B|BridgeWave Communications
861-00035C|Saint Song Corp.861+00035C|Saint Song Corp.
862-00035D|Bosung Hi-Net Co., Ltd.862+00035D|Bosung Hi-Net Co., Ltd.
863 00035E|Metropolitan Area Networks, Inc.863 00035E|Metropolitan Area Networks, Inc.
864 00035F|Prüftechnik Condition Monitoring864 00035F|Prüftechnik Condition Monitoring
865 000360|PAC Interactive Technology, Inc.865 000360|PAC Interactive Technology, Inc.
866-000361|Widcomm, Inc.866+000361|Widcomm, Inc.
867-000362|Vodtel Communications, Inc.867+000362|Vodtel Communications, Inc.
868-000363|Miraesys Co., Ltd.868+000363|Miraesys Co., Ltd.
869-000364|Scenix Semiconductor, Inc.869+000364|Scenix Semiconductor, Inc.
870 000365|Kira Information & Communication870 000365|Kira Information & Communication
871-000366|ASM Pacific Technology871+000366|ASM Pacific Technology
872-000367|Jasmine Networks, Inc.872+000367|Jasmine Networks, Inc.
873-000368|Embedone Co., Ltd.873+000368|Embedone Co., Ltd.
874-000369|Nippon Antenna Co., Ltd.874+000369|Nippon Antenna Co., Ltd.
875-00036A|Mainnet, Ltd.875+00036A|Mainnet, Ltd.
876-00036B|Cisco Systems, Inc876+00036B|Cisco Systems, Inc
877-00036C|Cisco Systems, Inc877+00036C|Cisco Systems, Inc
878-00036D|Runtop, Inc.878+00036D|Runtop, Inc.
879-00036E|Nicon Systems (Pty) Limited879+00036E|Nicon Systems (Pty) Limited
880-00036F|Telsey SPA880+00036F|Telsey SPA
881-000370|NXTV, Inc.881+000370|NXTV, Inc.
882-000371|Acomz Networks Corp.882+000371|Acomz Networks Corp.
883-000372|ULAN883+000372|ULAN
884-000373|Aselsan A.S884+000373|Aselsan A.S
885-000374|Schneider Electric885+000374|Schneider Electric
886-000375|NetMedia, Inc.886+000375|NetMedia, Inc.
887-000376|Graphtec Technology, Inc.887+000376|Graphtec Technology, Inc.
888-000377|Gigabit Wireless888+000377|Gigabit Wireless
889-000378|HUMAX Co., Ltd.889+000378|HUMAX Co., Ltd.
890-000379|Proscend Communications, Inc.890+000379|Proscend Communications, Inc.
891-00037A|Taiyo Yuden Co., Ltd.891+00037A|Taiyo Yuden Co., Ltd.
892-00037B|IDEC IZUMI Corporation892+00037B|IDEC IZUMI Corporation
893-00037C|Coax Media893+00037C|Coax Media
894-00037D|Stellcom894+00037D|Stellcom
895-00037E|PORTech Communications, Inc.895+00037E|PORTech Communications, Inc.
896-00037F|Atheros Communications, Inc.896+00037F|Atheros Communications, Inc.
897 000380|SSH Communications Security Corp897 000380|SSH Communications Security Corp
898-000381|Ingenico International898+000381|Ingenico International
899-000382|A-One Co., Ltd.899+000382|A-One Co., Ltd.
900-000383|Metera Networks, Inc.900+000383|Metera Networks, Inc.
901-000384|AETA901+000384|AETA
902-000385|Actelis Networks, Inc.902+000385|Actelis Networks, Inc.
903-000386|Ho Net, Inc.903+000386|Ho Net, Inc.
904-000387|Blaze Network Products904+000387|Blaze Network Products
905-000388|Fastfame Technology Co., Ltd.905+000388|Fastfame Technology Co., Ltd.
906-000389|PLANTRONICS, INC.906+000389|PLANTRONICS, INC.
907-00038A|America Online, Inc.907+00038A|America Online, Inc.
908-00038B|PLUS-ONE I&T, Inc.908+00038B|PLUS-ONE I&T, Inc.
909-00038C|Total Impact909+00038C|Total Impact
910 00038D|PCS Revenue Control Systems, Inc910 00038D|PCS Revenue Control Systems, Inc
911-00038E|Atoga Systems, Inc.911+00038E|Atoga Systems, Inc.
912-00038F|Weinschel Corporation912+00038F|Weinschel Corporation
913 000390|Digital Video Communications, In913 000390|Digital Video Communications, In
914 000391|Advanced Digital Broadcast, Ltd.914 000391|Advanced Digital Broadcast, Ltd.
915-000392|Hyundai Teletek Co., Ltd.915+000392|Hyundai Teletek Co., Ltd.
916-000393|Apple, Inc.916+000393|Apple, Inc.
917-000394|Connect One917+000394|Connect One
918-000395|California Amplifier918+000395|California Amplifier
919-000396|EZ Cast Co., Ltd.919+000396|EZ Cast Co., Ltd.
920-000397|FireBrick Limited920+000397|FireBrick Limited
921-000398|WISI921+000398|WISI
922 000399|Dongju Informations & Communicat922 000399|Dongju Informations & Communicat
923-00039A|SiConnect923+00039A|SiConnect
924-00039B|NetChip Technology, Inc.924+00039B|NetChip Technology, Inc.
925-00039C|OptiMight Communications, Inc.925+00039C|OptiMight Communications, Inc.
926-00039D|Qisda Corporation926+00039D|Qisda Corporation
927-00039E|Tera System Co., Ltd.927+00039E|Tera System Co., Ltd.
928-00039F|Cisco Systems, Inc928+00039F|Cisco Systems, Inc
929-0003A0|Cisco Systems, Inc929+0003A0|Cisco Systems, Inc
930 0003A1|HIPER Information & Communicatio930 0003A1|HIPER Information & Communicatio
931-0003A2|Catapult Communications931+0003A2|Catapult Communications
932-0003A3|MAVIX, Ltd.932+0003A3|MAVIX, Ltd.
933-0003A4|Imation Corp.933+0003A4|Imation Corp.
934-0003A5|Medea Corporation934+0003A5|Medea Corporation
935-0003A6|Traxit Technology, Inc.935+0003A6|Traxit Technology, Inc.
936-0003A7|Unixtar Technology, Inc.936+0003A7|Unixtar Technology, Inc.
937-0003A8|IDOT Computers, Inc.937+0003A8|IDOT Computers, Inc.
938-0003A9|AXCENT Media AG938+0003A9|AXCENT Media AG
939-0003AA|Watlow939+0003AA|Watlow
940-0003AB|Bridge Information Systems940+0003AB|Bridge Information Systems
941-0003AC|Fronius Schweissmaschinen941+0003AC|Fronius Schweissmaschinen
942-0003AD|Emerson Energy Systems AB942+0003AD|Emerson Energy Systems AB
943 0003AE|Allied Advanced Manufacturing Pt943 0003AE|Allied Advanced Manufacturing Pt
944-0003AF|Paragea Communications944+0003AF|Paragea Communications
945-0003B0|Xsense Technology Corp.945+0003B0|Xsense Technology Corp.
946-0003B1|ICU Medical, Inc.946+0003B1|ICU Medical, Inc.
947-0003B2|Radware947+0003B2|Radware
948-0003B3|IA Link Systems Co., Ltd.948+0003B3|IA Link Systems Co., Ltd.
949-0003B4|Macrotek International Corp.949+0003B4|Macrotek International Corp.
950-0003B5|Entra Technology Co.950+0003B5|Entra Technology Co.
951-0003B6|QSI Corporation951+0003B6|QSI Corporation
952-0003B7|ZACCESS Systems952+0003B7|ZACCESS Systems
953-0003B8|NetKit Solutions, LLC953+0003B8|NetKit Solutions, LLC
954-0003B9|Hualong Telecom Co., Ltd.954+0003B9|Hualong Telecom Co., Ltd.
955-0003BA|Oracle Corporation955+0003BA|Oracle Corporation
956-0003BB|Signal Communications Limited956+0003BB|Signal Communications Limited
957-0003BC|COT GmbH957+0003BC|COT GmbH
958-0003BD|OmniCluster Technologies, Inc.958+0003BD|OmniCluster Technologies, Inc.
959-0003BE|Netility959+0003BE|Netility
960 0003BF|Centerpoint Broadband Technologi960 0003BF|Centerpoint Broadband Technologi
961-0003C0|RFTNC Co., Ltd.961+0003C0|RFTNC Co., Ltd.
962-0003C1|Packet Dynamics Ltd962+0003C1|Packet Dynamics Ltd
963-0003C2|Solphone K.K.963+0003C2|Solphone K.K.
964-0003C3|Micronik Multimedia964+0003C3|Micronik Multimedia
965-0003C4|Tomra Systems ASA965+0003C4|Tomra Systems ASA
966-0003C5|Mobotix AG966+0003C5|Mobotix AG
967-0003C6|ICUE Systems, Inc.967+0003C6|ICUE Systems, Inc.
968-0003C7|hopf Elektronik GmbH968+0003C7|hopf Elektronik GmbH
969-0003C8|CML Emergency Services969+0003C8|CML Emergency Services
970-0003C9|TECOM Co., Ltd.970+0003C9|TECOM Co., Ltd.
971-0003CA|Temposonics, LLC971+0003CA|Temposonics, LLC
972-0003CB|SystemGear Co., Ltd.972+0003CB|SystemGear Co., Ltd.
973-0003CC|Momentum Computer, Inc.973+0003CC|Momentum Computer, Inc.
974-0003CD|Clovertech, Inc.974+0003CD|Clovertech, Inc.
975-0003CE|ETEN Technologies, Inc.975+0003CE|ETEN Technologies, Inc.
976-0003CF|Muxcom, Inc.976+0003CF|Muxcom, Inc.
977-0003D0|KOANKEISO Co., Ltd.977+0003D0|KOANKEISO Co., Ltd.
978-0003D1|Takaya Corporation978+0003D1|Takaya Corporation
979-0003D2|Crossbeam Systems, Inc.979+0003D2|Crossbeam Systems, Inc.
980-0003D3|Internet Energy Systems, Inc.980+0003D3|Internet Energy Systems, Inc.
981-0003D4|Alloptic, Inc.981+0003D4|Alloptic, Inc.
982 0003D5|Advanced Communications Co., Ltd982 0003D5|Advanced Communications Co., Ltd
983-0003D6|RADVision, Ltd.983+0003D6|RADVision, Ltd.
984-0003D7|NextNet Wireless, Inc.984+0003D7|NextNet Wireless, Inc.
985-0003D8|iMPath Networks, Inc.985+0003D8|iMPath Networks, Inc.
986-0003D9|Secheron SA986+0003D9|Secheron SA
987 0003DA|Takamisawa Cybernetics Co., Ltd.987 0003DA|Takamisawa Cybernetics Co., Ltd.
988-0003DB|Apogee Electronics Corp.988+0003DB|Apogee Electronics Corp.
989-0003DC|Lexar Media, Inc.989+0003DC|Lexar Media, Inc.
990-0003DD|Comark Interactive Solutions990+0003DD|Comark Interactive Solutions
991-0003DE|OTC Wireless991+0003DE|OTC Wireless
992-0003DF|Desana Systems992+0003DF|Desana Systems
993-0003E0|Commscope993+0003E0|Commscope
994-0003E1|Winmate Communication, Inc.994+0003E1|Winmate Communication, Inc.
995-0003E2|Comspace Corporation995+0003E2|Comspace Corporation
996-0003E3|Cisco Systems, Inc996+0003E3|Cisco Systems, Inc
997-0003E4|Cisco Systems, Inc997+0003E4|Cisco Systems, Inc
998-0003E5|Hermstedt SG998+0003E5|Hermstedt SG
999-0003E6|Entone, Inc.999+0003E6|Entone, Inc.
1000-0003E7|Logostek Co. Ltd.1000+0003E7|Logostek Co. Ltd.
1001-0003E8|Wavesight Limited1001+0003E8|Wavesight Limited
1002-0003E9|Akara Canada, Inc.1002+0003E9|Akara Canada, Inc.
1003-0003EA|Mega System Technologies, Inc.1003+0003EA|Mega System Technologies, Inc.
1004-0003EB|Atrica1004+0003EB|Atrica
1005-0003EC|ICG Research, Inc.1005+0003EC|ICG Research, Inc.
1006-0003ED|Shinkawa Electric Co., Ltd.1006+0003ED|Shinkawa Electric Co., Ltd.
1007-0003EE|MKNet Corporation1007+0003EE|MKNet Corporation
1008-0003EF|Oneline AG1008+0003EF|Oneline AG
1009-0003F0|Redfern Broadband Networks1009+0003F0|Redfern Broadband Networks
1010-0003F1|Cicada Semiconductor, Inc.1010+0003F1|Cicada Semiconductor, Inc.
1011-0003F2|Seneca Networks1011+0003F2|Seneca Networks
1012-0003F3|Dazzle Multimedia, Inc.1012+0003F3|Dazzle Multimedia, Inc.
1013-0003F4|NetBurner1013+0003F4|NetBurner
1014-0003F5|Chip2Chip1014+0003F5|Chip2Chip
1015-0003F6|Allegro Networks, Inc.1015+0003F6|Allegro Networks, Inc.
1016-0003F7|Plast-Control GmbH1016+0003F7|Plast-Control GmbH
1017-0003F8|SanCastle Technologies, Inc.1017+0003F8|SanCastle Technologies, Inc.
1018-0003F9|Pleiades Communications, Inc.1018+0003F9|Pleiades Communications, Inc.
1019-0003FA|TiMetra Networks1019+0003FA|TiMetra Networks
1020-0003FB|ENEGATE Co.,Ltd.1020+0003FB|ENEGATE Co.,Ltd.
1021-0003FC|Intertex Data AB1021+0003FC|Intertex Data AB
1022-0003FD|Cisco Systems, Inc1022+0003FD|Cisco Systems, Inc
1023-0003FE|Cisco Systems, Inc1023+0003FE|Cisco Systems, Inc
1024-0003FF|Microsoft Corporation1024+0003FF|Microsoft Corporation
1025-000400|LEXMARK INTERNATIONAL, INC.1025+000400|LEXMARK INTERNATIONAL, INC.
1026-000401|Osaki Electric Co., Ltd.1026+000401|Osaki Electric Co., Ltd.
1027-000402|Nexsan Technologies, Ltd.1027+000402|Nexsan Technologies, Ltd.
1028-000403|Nexsi Corporation1028+000403|Nexsi Corporation
src/data/oui28.txtmodified+97 -0
@@ -13,6 +13,7 @@
13 0055DAC|Donguan WideLink Communication T13 0055DAC|Donguan WideLink Communication T
14 0055DAD|Arrow Electronics,Inc.14 0055DAD|Arrow Electronics,Inc.
15 0055DAE|Victorsure Limited15 0055DAE|Victorsure Limited
16+0055DAF|Private
16 0069670|Annapurna labs17 0069670|Annapurna labs
17 0069671|miliwave18 0069671|miliwave
18 0069672|Ningbo Shen Link Communication T19 0069672|Ningbo Shen Link Communication T
@@ -172,6 +173,7 @@
172 04ECA96|SHANGHAI CHENZHU INSTRUMENT CO.,173 04ECA96|SHANGHAI CHENZHU INSTRUMENT CO.,
173 04ECA97|CORETEC Inc.174 04ECA97|CORETEC Inc.
174 04ECA98|Guangzhou Xinhong Communication 175 04ECA98|Guangzhou Xinhong Communication
176+04ECA99|Private
175 04ECA9A|Leegiot Intelligent Technology C177 04ECA9A|Leegiot Intelligent Technology C
176 04ECA9B|Maple Jet Limited178 04ECA9B|Maple Jet Limited
177 04ECA9C|Broadcom Corporation179 04ECA9C|Broadcom Corporation
@@ -233,6 +235,7 @@
233 083C038|GS Industrie-Elektronik GmbH235 083C038|GS Industrie-Elektronik GmbH
234 083C039|INNOS TECHNOLOGIES INC.236 083C039|INNOS TECHNOLOGIES INC.
235 083C03A|Luxshare Precision Industry Co.,237 083C03A|Luxshare Precision Industry Co.,
238+083C03B|Private
236 083C03C|Dongguan Development Security In239 083C03C|Dongguan Development Security In
237 083C03D|Yinglian Technology Co.,Ltd240 083C03D|Yinglian Technology Co.,Ltd
238 083C03E|Prozone241 083C03E|Prozone
@@ -315,6 +318,7 @@
315 0C47A91|Shanghai BST Electric Co.,ltd318 0C47A91|Shanghai BST Electric Co.,ltd
316 0C47A92|Annapurna labs319 0C47A92|Annapurna labs
317 0C47A93|HONGKONG STONEOIM TECHNOLOGY LIM320 0C47A93|HONGKONG STONEOIM TECHNOLOGY LIM
321+0C47A94|Private
318 0C47A95|Everon Co., Ltd.322 0C47A95|Everon Co., Ltd.
319 0C47A96|Shenzhen Hahappylife Innovations323 0C47A96|Shenzhen Hahappylife Innovations
320 0C47A97|Annapurna labs324 0C47A97|Annapurna labs
@@ -430,6 +434,7 @@
430 0CEFAFC|GainStrong Industry Co.,Ltd434 0CEFAFC|GainStrong Industry Co.,Ltd
431 0CEFAFD|CJSC «Svyaz Engineering»435 0CEFAFD|CJSC «Svyaz Engineering»
432 0CEFAFE|Infinisource Inc.436 0CEFAFE|Infinisource Inc.
437+0CEFAFF|Private
433 0CFE5D0|Chengdu Ledong Information & Tec438 0CFE5D0|Chengdu Ledong Information & Tec
434 0CFE5D1|Fender Musical Instrument439 0CFE5D1|Fender Musical Instrument
435 0CFE5D2|Dspread International Co.,Limite440 0CFE5D2|Dspread International Co.,Limite
@@ -474,6 +479,7 @@
474 100723B|Fujian Quanzhou Dong Ang Electro479 100723B|Fujian Quanzhou Dong Ang Electro
475 100723C|Shenzhen Xinfa Electronic Co.,lt480 100723C|Shenzhen Xinfa Electronic Co.,lt
476 100723E|First Chair Acoustics Co., Ltd.481 100723E|First Chair Acoustics Co., Ltd.
482+100723F|Private
477 1054D20|GIPS Technology Co., Ltd.483 1054D20|GIPS Technology Co., Ltd.
478 1054D21|Jiangxi Ofilm&Jvneng IoT Tech Co484 1054D21|Jiangxi Ofilm&Jvneng IoT Tech Co
479 1054D22|ComNav Technology Ltd.485 1054D22|ComNav Technology Ltd.
@@ -522,6 +528,7 @@
522 141FBA0|Shenzhen Mining Technology Co.,L528 141FBA0|Shenzhen Mining Technology Co.,L
523 141FBA1|GloQuad529 141FBA1|GloQuad
524 141FBA2|Deutsche Energieversorgung GmbH530 141FBA2|Deutsche Energieversorgung GmbH
531+141FBA3|Private
525 141FBA4|BYZERO532 141FBA4|BYZERO
526 141FBA5|Inttelix Brasil Tecnologia e Sis533 141FBA5|Inttelix Brasil Tecnologia e Sis
527 141FBA6|Hitachi Rail RCS France SAS534 141FBA6|Hitachi Rail RCS France SAS
@@ -533,6 +540,7 @@
533 141FBAC|Swiss Electronic (Shenzhen) Co.,540 141FBAC|Swiss Electronic (Shenzhen) Co.,
534 141FBAD|AJIS(DALIAN)co.,LTD541 141FBAD|AJIS(DALIAN)co.,LTD
535 141FBAE|POS Systema LLC542 141FBAE|POS Systema LLC
543+141FBAF|Private
536 144FD70|Annapurna labs544 144FD70|Annapurna labs
537 144FD71|Zehnder Group AG545 144FD71|Zehnder Group AG
538 144FD72|FedEx Services OTI546 144FD72|FedEx Services OTI
@@ -680,6 +688,7 @@
680 18D7939|Clarity Medical Pvt Ltd688 18D7939|Clarity Medical Pvt Ltd
681 18D793A|zhejiang Anhong technology co.,l689 18D793A|zhejiang Anhong technology co.,l
682 18D793B|EcoG690 18D793B|EcoG
691+18D793C|Private
683 18D793D|Kraken Technologies Ltd692 18D793D|Kraken Technologies Ltd
684 18D793E|Teegarden Applied Science Inc693 18D793E|Teegarden Applied Science Inc
685 18FDCB0|Shenzhen Rui jiali Electronic Te694 18FDCB0|Shenzhen Rui jiali Electronic Te
@@ -709,8 +718,10 @@
709 1C21D19|Dynojet Research718 1C21D19|Dynojet Research
710 1C21D1A|LG CNS719 1C21D1A|LG CNS
711 1C21D1B|Global Design Solutions Ltd720 1C21D1B|Global Design Solutions Ltd
721+1C21D1C|Private
712 1C21D1D|Liscotech System Co., Ltd.722 1C21D1D|Liscotech System Co., Ltd.
713 1C21D1E|p2-plus inc.723 1C21D1E|p2-plus inc.
724+1C21D1F|Private
714 1C59740|Shenzhen Hanshine Technology Co.725 1C59740|Shenzhen Hanshine Technology Co.
715 1C59741|Logical Infrastructure PTY LTD726 1C59741|Logical Infrastructure PTY LTD
716 1C59742|Chongqing Taishan Cable Co., Ltd727 1C59742|Chongqing Taishan Cable Co., Ltd
@@ -861,6 +872,7 @@
861 1CC0E1C|Nitto Seiko872 1CC0E1C|Nitto Seiko
862 1CC0E1D|NewLand (NZ) Communication Tech 873 1CC0E1D|NewLand (NZ) Communication Tech
863 1CC0E1E|Yun Yang Fire Safety Equipment C874 1CC0E1E|Yun Yang Fire Safety Equipment C
875+1CCAE30|Private
864 1CCAE31|PGA ELECTRONIC876 1CCAE31|PGA ELECTRONIC
865 1CCAE32|Insigma Inc877 1CCAE32|Insigma Inc
866 1CCAE33|Shenzhen Smart Device Technology878 1CCAE33|Shenzhen Smart Device Technology
@@ -875,6 +887,7 @@
875 1CCAE3C|Gahdeung Elecom887 1CCAE3C|Gahdeung Elecom
876 1CCAE3D|eSight Corporation888 1CCAE3D|eSight Corporation
877 1CCAE3E|Dabi Atlante S/A Industrias Medi889 1CCAE3E|Dabi Atlante S/A Industrias Medi
890+1CCAE3F|Private
878 1CFD080|InSeat Solutions, LLC891 1CFD080|InSeat Solutions, LLC
879 1CFD081|Shenzhen SEWO Technology Co.,Ltd892 1CFD081|Shenzhen SEWO Technology Co.,Ltd
880 1CFD082|HiHi Ltd893 1CFD082|HiHi Ltd
@@ -1036,6 +1049,7 @@
1036 24A10D8|Luxvisions lnnovation Technology1049 24A10D8|Luxvisions lnnovation Technology
1037 24A10D9|Tecnojest SrL1050 24A10D9|Tecnojest SrL
1038 24A10DA|Detroit Defense Inc.1051 24A10DA|Detroit Defense Inc.
1052+24A10DB|Private
1039 24A10DC|REVUPTECH PRIVATE LIMITED1053 24A10DC|REVUPTECH PRIVATE LIMITED
1040 24A10DD|Amina Distribution AS1054 24A10DD|Amina Distribution AS
1041 24A10DE|Gönnheimer Elektronic GmbH1055 24A10DE|Gönnheimer Elektronic GmbH
@@ -1159,6 +1173,7 @@
1159 28FD80C|Airbus Defence and Space Oy1173 28FD80C|Airbus Defence and Space Oy
1160 28FD80D|Grandway Technology (Shenzhen) L1174 28FD80D|Grandway Technology (Shenzhen) L
1161 28FD80E|T-Radio AS1175 28FD80E|T-Radio AS
1176+28FD80F|Private
1162 2C16BD0|Beijing Jishi Huitong Technology1177 2C16BD0|Beijing Jishi Huitong Technology
1163 2C16BD1|Curtiss-Wright Drive Technology1178 2C16BD1|Curtiss-Wright Drive Technology
1164 2C16BD2|AIMCO1179 2C16BD2|AIMCO
@@ -1189,9 +1204,11 @@
1189 2C265FC|AATON DIGITAL1204 2C265FC|AATON DIGITAL
1190 2C265FD|E Core Corporation1205 2C265FD|E Core Corporation
1191 2C265FE|Hysentel Technology Co., Ltd1206 2C265FE|Hysentel Technology Co., Ltd
1207+2C265FF|Private
1192 2C279E0|Changzhou WEBO Weighing Device &1208 2C279E0|Changzhou WEBO Weighing Device &
1193 2C279E1|Electronique Bluewave Inc.1209 2C279E1|Electronique Bluewave Inc.
1194 2C279E2|Kunyi electronic technology (Sha1210 2C279E2|Kunyi electronic technology (Sha
1211+2C279E3|Private
1195 2C279E4|Shijiazhuang King Transportation1212 2C279E4|Shijiazhuang King Transportation
1196 2C279E5|AudioNord Distribution A/S1213 2C279E5|AudioNord Distribution A/S
1197 2C279E6|Rutledge Omni Services Pte Ltd1214 2C279E6|Rutledge Omni Services Pte Ltd
@@ -1248,6 +1265,7 @@
1248 2C6A6FC|Sensity Systems1265 2C6A6FC|Sensity Systems
1249 2C6A6FD|Holjeron1266 2C6A6FD|Holjeron
1250 2C6A6FE|EATON FHF Funke + Huster Fernsig1267 2C6A6FE|EATON FHF Funke + Huster Fernsig
1268+2C6A6FF|Private
1251 2C7AF40|Annapurna labs1269 2C7AF40|Annapurna labs
1252 2C7AF41|Annapurna labs1270 2C7AF41|Annapurna labs
1253 2C7AF42|Delmatic Limited1271 2C7AF42|Delmatic Limited
@@ -1293,6 +1311,7 @@
1293 2CD141C|PIN SHANG LED Co., LTD.1311 2CD141C|PIN SHANG LED Co., LTD.
1294 2CD141D|Square Inc.1312 2CD141D|Square Inc.
1295 2CD141E|CITA SMART SOLUTIONS LTD1313 2CD141E|CITA SMART SOLUTIONS LTD
1314+2CD141F|Private
1296 3009F90|Hurray Cloud Technology Co., Ltd1315 3009F90|Hurray Cloud Technology Co., Ltd
1297 3009F91|Shenzhen Sunvell Electronics Co.1316 3009F91|Shenzhen Sunvell Electronics Co.
1298 3009F92|Beijing Netswift Technology Co.,1317 3009F92|Beijing Netswift Technology Co.,
@@ -1547,6 +1566,7 @@
1547 380525B|CAMMAX OPTRONICS CO., LTD.1566 380525B|CAMMAX OPTRONICS CO., LTD.
1548 380525C|Christeyns Engineering Kft.1567 380525C|Christeyns Engineering Kft.
1549 380525D|Halliday Holdings PTE. LTD.1568 380525D|Halliday Holdings PTE. LTD.
1569+380525E|Private
1550 381F260|JAESUNG INFORMATION & COMMUNICAT1570 381F260|JAESUNG INFORMATION & COMMUNICAT
1551 381F261|SERNET (SUZHOU) TECHNOLOGIES COR1571 381F261|SERNET (SUZHOU) TECHNOLOGIES COR
1552 381F262|Synamedia1572 381F262|Synamedia
@@ -1620,6 +1640,7 @@
1620 38B14EA|Amissiontech Co., Ltd1640 38B14EA|Amissiontech Co., Ltd
1621 38B14EB|Huizhou GYXX Technology Co., Ltd1641 38B14EB|Huizhou GYXX Technology Co., Ltd
1622 38B14EC|Guangzhou Sunrise Technology Co.1642 38B14EC|Guangzhou Sunrise Technology Co.
1643+38B14ED|Private
1623 38B14EE|Zoho Business Services LLP - ZBS1644 38B14EE|Zoho Business Services LLP - ZBS
1624 38B19E0|Triple Jump Medical1645 38B19E0|Triple Jump Medical
1625 38B19E1|Freedompro Srl1646 38B19E1|Freedompro Srl
@@ -1710,6 +1731,7 @@
1710 3C39E7B|chipsguide technology Co.,LTD1731 3C39E7B|chipsguide technology Co.,LTD
1711 3C39E7C|VANSTONE ELECTRONIC (BEIJING)CO,1732 3C39E7C|VANSTONE ELECTRONIC (BEIJING)CO,
1712 3C39E7E|MARPOSS SPA1733 3C39E7E|MARPOSS SPA
1734+3C39E7F|Private
1713 3C427E0|Grandway Technology (Shenzhen) L1735 3C427E0|Grandway Technology (Shenzhen) L
1714 3C427E1|Dongguan Taide Industrial Co.,Lt1736 3C427E1|Dongguan Taide Industrial Co.,Lt
1715 3C427E2|Starloop Tech Co., Ltd.1737 3C427E2|Starloop Tech Co., Ltd.
@@ -2058,6 +2080,7 @@
2058 4C6E441|Shenzhen Xmitech Electronic Co.,2080 4C6E441|Shenzhen Xmitech Electronic Co.,
2059 4C6E442|Accutrol LLC2081 4C6E442|Accutrol LLC
2060 4C6E443|Qingting Intelligent Technology(2082 4C6E443|Qingting Intelligent Technology(
2083+4C6E444|Private
2061 4C6E445|Shenzhen Langji Guangnian Techno2084 4C6E445|Shenzhen Langji Guangnian Techno
2062 4C6E446|Panache DigiLife Limited2085 4C6E446|Panache DigiLife Limited
2063 4C6E447|Luxshare Electronic Technology (2086 4C6E447|Luxshare Electronic Technology (
@@ -2194,6 +2217,7 @@
2194 5019113|Ingersoll-Rand2217 5019113|Ingersoll-Rand
2195 5019114|Stavecho Intelligence Technology2218 5019114|Stavecho Intelligence Technology
2196 5019115|Shenzhen COI Technology Co.,LTD2219 5019115|Shenzhen COI Technology Co.,LTD
2220+5019116|Private
2197 5019117|Guanghe Zhida Technology (Beijin2221 5019117|Guanghe Zhida Technology (Beijin
2198 5019118|ART LLC2222 5019118|ART LLC
2199 5019119|Rugged Logic, Inc.2223 5019119|Rugged Logic, Inc.
@@ -2352,6 +2376,7 @@
2352 549A11C|Xi'an Hua Fan Technology Co.,Ltd2376 549A11C|Xi'an Hua Fan Technology Co.,Ltd
2353 549A11D|Hangzhou duotin Technology Co., 2377 549A11D|Hangzhou duotin Technology Co.,
2354 549A11E|Beijing HTSmartech Co.,Ltd2378 549A11E|Beijing HTSmartech Co.,Ltd
2379+549A11F|Private
2355 54A4930|Intelligent Surveillance Corp2380 54A4930|Intelligent Surveillance Corp
2356 54A4931|ShenZhen Smart&Aspiration Co.,LT2381 54A4931|ShenZhen Smart&Aspiration Co.,LT
2357 54A4932|genua GmbH2382 54A4932|genua GmbH
@@ -2517,6 +2542,7 @@
2517 58FCDBC|Excenon Mobile Technology Co., L2542 58FCDBC|Excenon Mobile Technology Co., L
2518 58FCDBD|XIAMEN LEELEN TECHNOLOGY CO.,LTD2543 58FCDBD|XIAMEN LEELEN TECHNOLOGY CO.,LTD
2519 58FCDBE|Applied Device Technologies2544 58FCDBE|Applied Device Technologies
2545+58FCDBF|Private
2520 5C5A4C0|Jinchuan Group Co.,Ltd2546 5C5A4C0|Jinchuan Group Co.,Ltd
2521 5C5A4C1|Orchid Products Limited2547 5C5A4C1|Orchid Products Limited
2522 5C5A4C2|ITS Partner (O.B.S) S.L.2548 5C5A4C2|ITS Partner (O.B.S) S.L.
@@ -2592,6 +2618,18 @@
2592 5C87D8C|DRAGONGLASS TECHNOLOGY(SHENZHEN)2618 5C87D8C|DRAGONGLASS TECHNOLOGY(SHENZHEN)
2593 5C87D8D|Zilia Technologies2619 5C87D8D|Zilia Technologies
2594 5C87D8E|Beijing Townsky Technology Co.,L2620 5C87D8E|Beijing Townsky Technology Co.,L
2621+5CAB220|InfraShield Inc.
2622+5CAB222|Santiam Labs
2623+5CAB223|Xiamen Joint Tech. CO.,Ltd.
2624+5CAB224|Comet Technologies Denmark A/S
2625+5CAB226|Shanghai Jiweijiu Intelligent Te
2626+5CAB227|Chubb France
2627+5CAB228|FEEL Group LLC
2628+5CAB229|KIWEE BROADBAND
2629+5CAB22A|Wuxi Bravechip Technologies Co.,
2630+5CAB22B|Digicare Biomedical Technology,
2631+5CAB22C|Link-Card Tech Co.Ltd.
2632+5CAB22D|Stadium Grow Lighting B.V
2595 5CF2860|Hangzhou Signwei Electronics Tec2633 5CF2860|Hangzhou Signwei Electronics Tec
2596 5CF2861|iSon Tech2634 5CF2861|iSon Tech
2597 5CF2862|Shanghai Notion Information Tech2635 5CF2862|Shanghai Notion Information Tech
@@ -2757,6 +2795,7 @@
2757 64FB81C|Bridgeport Instruments, LLC2795 64FB81C|Bridgeport Instruments, LLC
2758 64FB81D|Dongyang unitech.co.ltd2796 64FB81D|Dongyang unitech.co.ltd
2759 64FB81E|ChengDu KeChuang LongXin Sci-tec2797 64FB81E|ChengDu KeChuang LongXin Sci-tec
2798+64FB81F|Private
2760 6879120|PCTEL, Inc.2799 6879120|PCTEL, Inc.
2761 6879121|Annapurna labs2800 6879121|Annapurna labs
2762 6879122|CNDI CO.,LTD2801 6879122|CNDI CO.,LTD
@@ -2855,6 +2894,8 @@
2855 6C47805|Monnit Corporation2894 6C47805|Monnit Corporation
2856 6C47806|CTHINGS.CO sp. z o.o.2895 6C47806|CTHINGS.CO sp. z o.o.
2857 6C47807|ONICON2896 6C47807|ONICON
2897+6C47808|Private
2898+6C47809|Private
2858 6C4780A|Prolink Surveillance Technology 2899 6C4780A|Prolink Surveillance Technology
2859 6C4780B|CARDIO SISTEMAS COMERCIAL E INDU2900 6C4780B|CARDIO SISTEMAS COMERCIAL E INDU
2860 6C4780C|ZVK GmbH2901 6C4780C|ZVK GmbH
@@ -3006,6 +3047,7 @@
3006 7419F8C|Bach Icon ApS3047 7419F8C|Bach Icon ApS
3007 7419F8D|Ansjer Electronics Co., Ltd.3048 7419F8D|Ansjer Electronics Co., Ltd.
3008 7419F8E|Volacomm Co., Ltd3049 7419F8E|Volacomm Co., Ltd
3050+7419F8F|Private
3009 741AE00|Huano International Technology L3051 741AE00|Huano International Technology L
3010 741AE01|Socionext Inc.3052 741AE01|Socionext Inc.
3011 741AE02|NURA HOLDINGS PTY LTD3053 741AE02|NURA HOLDINGS PTY LTD
@@ -3015,6 +3057,7 @@
3015 741AE06|Blocks Wearables Inc.3057 741AE06|Blocks Wearables Inc.
3016 741AE07|BÄR Bahnsicherung AG3058 741AE07|BÄR Bahnsicherung AG
3017 741AE08|Broadcast Wireless Systems Ltd3059 741AE08|Broadcast Wireless Systems Ltd
3060+741AE09|Private
3018 741AE0A|SAIERCOM CORPORATION3061 741AE0A|SAIERCOM CORPORATION
3019 741AE0B|SHEN ZHEN YINGJIACHUANG ELECTRON3062 741AE0B|SHEN ZHEN YINGJIACHUANG ELECTRON
3020 741AE0C|bistos.co.ltd3063 741AE0C|bistos.co.ltd
@@ -3095,6 +3138,7 @@
3095 74E14AC|Wuhan Shenghong Laser Projection3138 74E14AC|Wuhan Shenghong Laser Projection
3096 74E14AD|Knog Pty Ltd3139 74E14AD|Knog Pty Ltd
3097 74E14AE|Diamond Kinetics3140 74E14AE|Diamond Kinetics
3141+74E14AF|Private
3098 74F8DB0|Enercon Technologies3142 74F8DB0|Enercon Technologies
3099 74F8DB1|GHL Advanced Technology GmbH & C3143 74F8DB1|GHL Advanced Technology GmbH & C
3100 74F8DB2|Shenzhen Ruishi Information Tech3144 74F8DB2|Shenzhen Ruishi Information Tech
@@ -3110,6 +3154,7 @@
3110 74F8DBC|TBM CO., LTD.3154 74F8DBC|TBM CO., LTD.
3111 74F8DBD|Simon Electric (China) Co.,ltd3155 74F8DBD|Simon Electric (China) Co.,ltd
3112 74F8DBE|Bernard Krone Holding GmbH & Co.3156 74F8DBE|Bernard Krone Holding GmbH & Co.
3157+74F8DBF|Private
3113 7813050|InnoSenT3158 7813050|InnoSenT
3114 7813051|Global Media Streaming LLC3159 7813051|Global Media Streaming LLC
3115 7813052|LEAFF ENGINEERING SRL3160 7813052|LEAFF ENGINEERING SRL
@@ -3200,6 +3245,7 @@
3200 78C2C0C|Shanghai Hanyi Technologies Co,.3245 78C2C0C|Shanghai Hanyi Technologies Co,.
3201 78C2C0D|KORF Inc.3246 78C2C0D|KORF Inc.
3202 78C2C0E|Huwomobility3247 78C2C0E|Huwomobility
3248+78C2C0F|Private
3203 78CA830|DAINCUBE3249 78CA830|DAINCUBE
3204 78CA831|Excelocity Inc.3250 78CA831|Excelocity Inc.
3205 78CA832|APC3251 78CA832|APC
@@ -3305,6 +3351,7 @@
3305 7C70BCC|Lukup Media3351 7C70BCC|Lukup Media
3306 7C70BCD|mk-messtechnik GmbH3352 7C70BCD|mk-messtechnik GmbH
3307 7C70BCE|HOPERUN MMAX DIGITAL PTE. LTD.3353 7C70BCE|HOPERUN MMAX DIGITAL PTE. LTD.
3354+7C70BCF|Private
3308 7C83340|Thermalimage3355 7C83340|Thermalimage
3309 7C83341|Linear Logic LLC3356 7C83341|Linear Logic LLC
3310 7C83342|PEMtronics LLC3357 7C83342|PEMtronics LLC
@@ -3402,6 +3449,7 @@
3402 800A804|LLVISION TECHNOLOGY CO.,LTD3449 800A804|LLVISION TECHNOLOGY CO.,LTD
3403 800A805|Shenzhen Zidoo Technology Co., L3450 800A805|Shenzhen Zidoo Technology Co., L
3404 800A806|Beijing Gooagoo Technical Servic3451 800A806|Beijing Gooagoo Technical Servic
3452+800A80F|Private
3405 801D0D0|KbDevice,Inc.3453 801D0D0|KbDevice,Inc.
3406 801D0D1|Hörmann Warnsysteme GmbH3454 801D0D1|Hörmann Warnsysteme GmbH
3407 801D0D2|SZ Spinning Power Top Boundary T3455 801D0D2|SZ Spinning Power Top Boundary T
@@ -3447,6 +3495,7 @@
3447 807B85C|SCALA Digital Technology(Ningbo)3495 807B85C|SCALA Digital Technology(Ningbo)
3448 807B85D|Kaynes Technology India Pvt Ltd3496 807B85D|Kaynes Technology India Pvt Ltd
3449 807B85E|Mersen3497 807B85E|Mersen
3498+807B85F|Private
3450 80A5790|Benano Inc.3499 80A5790|Benano Inc.
3451 80A5791|Zhe Jiang EV-Tech Co.,Ltd3500 80A5791|Zhe Jiang EV-Tech Co.,Ltd
3452 80A5792|Jiangsu wonder-working electric 3501 80A5792|Jiangsu wonder-working electric
@@ -3477,6 +3526,7 @@
3477 80E4DAC|EVER Sp. z o.o.3526 80E4DAC|EVER Sp. z o.o.
3478 80E4DAD|Dalian Roiland Technology Co.,Lt3527 80E4DAD|Dalian Roiland Technology Co.,Lt
3479 80E4DAE|Akenori PTE LTD3528 80E4DAE|Akenori PTE LTD
3529+80E4DAF|Private
3480 8411C20|Kazdream Technologies LLP3530 8411C20|Kazdream Technologies LLP
3481 8411C21|Beijing Dayu Technology Co., Ltd3531 8411C21|Beijing Dayu Technology Co., Ltd
3482 8411C22|Futurecom Systems Group3532 8411C22|Futurecom Systems Group
@@ -3595,6 +3645,7 @@
3595 885D90C|iRoom GmbH3645 885D90C|iRoom GmbH
3596 885D90D|Hexaglobe3646 885D90D|Hexaglobe
3597 885D90E|Unitac Technology Limited3647 885D90E|Unitac Technology Limited
3648+885D90F|Private
3598 885FE80|Jungheinrich Norderstedt AG & Co3649 885FE80|Jungheinrich Norderstedt AG & Co
3599 885FE81|Apoidea Technology Co., Ltd.3650 885FE81|Apoidea Technology Co., Ltd.
3600 885FE82|Opto Engineering3651 885FE82|Opto Engineering
@@ -3656,6 +3707,7 @@
3656 88C9B3D|Origins Technology Limited3707 88C9B3D|Origins Technology Limited
3657 88C9B3E|Sercomm Corporation.3708 88C9B3E|Sercomm Corporation.
3658 8C147D0|Nio3709 8C147D0|Nio
3710+8C147D1|Private
3659 8C147D2|Agilent S.p.A3711 8C147D2|Agilent S.p.A
3660 8C147D3|Remotec Technology Limited3712 8C147D3|Remotec Technology Limited
3661 8C147D4|Nanjing bilian information Techn3713 8C147D4|Nanjing bilian information Techn
@@ -3734,6 +3786,7 @@
3734 8C55702|Microvision Inc3786 8C55702|Microvision Inc
3735 8C55703|ScandiNova Systems3787 8C55703|ScandiNova Systems
3736 8C55704|Next Vision Tech(Ningbo)Co.,LTD3788 8C55704|Next Vision Tech(Ningbo)Co.,LTD
3789+8C55705|Private
3737 8C55706|Joule Group Limites3790 8C55706|Joule Group Limites
3738 8C55707|Eideal Company Limited3791 8C55707|Eideal Company Limited
3739 8C55708|Nayax LTD3792 8C55708|Nayax LTD
@@ -3892,6 +3945,7 @@
3892 90C682C|Li Seng Technology Ltd.3945 90C682C|Li Seng Technology Ltd.
3893 90C682D|PowerShield Limited3946 90C682D|PowerShield Limited
3894 90C682E|Shanghai HuRong Communication Te3947 90C682E|Shanghai HuRong Communication Te
3948+90C682F|Private
3895 90E2FC0|PEA (DBT-Technology)3949 90E2FC0|PEA (DBT-Technology)
3896 90E2FC1|Yite technology3950 90E2FC1|Yite technology
3897 90E2FC2|ShenZhen Temwey Innovation Techn3951 90E2FC2|ShenZhen Temwey Innovation Techn
@@ -4011,6 +4065,8 @@
4011 9802D8B|HANSHIN MEDICAL CO., LTD.4065 9802D8B|HANSHIN MEDICAL CO., LTD.
4012 9802D8C|AGV spa4066 9802D8C|AGV spa
4013 9802D8D|Promicon Elektronik GmbH + Co.KG4067 9802D8D|Promicon Elektronik GmbH + Co.KG
4068+9802D8E|Private
4069+9802D8F|Private
4014 9806370|Zoleo Inc.4070 9806370|Zoleo Inc.
4015 9806371|E. P. Schlumberger4071 9806371|E. P. Schlumberger
4016 9806372|Summa nv4072 9806372|Summa nv
@@ -4067,6 +4123,7 @@
4067 986EE88|Sisgeo Srl4123 986EE88|Sisgeo Srl
4068 986EE89|Span.IO, Inc.4124 986EE89|Span.IO, Inc.
4069 986EE8A|Logos Payment Solutions A/S4125 986EE8A|Logos Payment Solutions A/S
4126+986EE8B|Private
4070 986EE8C|Sercomm Corporation.4127 986EE8C|Sercomm Corporation.
4071 986EE8D|Changzhou Jiahao Radio&TV device4128 986EE8D|Changzhou Jiahao Radio&TV device
4072 986EE8E|First Design System Inc.4129 986EE8E|First Design System Inc.
@@ -4310,6 +4367,7 @@ A03E6BB|KoCoS Messtechnik AG
4310 A03E6BC|Qunar.com4367 A03E6BC|Qunar.com
4311 A03E6BD|Jining SmartCity Infotech Co.Ltd4368 A03E6BD|Jining SmartCity Infotech Co.Ltd
4312 A03E6BE|Nanjing zhanyi software technolo4369 A03E6BE|Nanjing zhanyi software technolo
4370+A03E6BF|Private
4313 A0BB3E0|Link Labs4371 A0BB3E0|Link Labs
4314 A0BB3E1|IVision Electronics Co.,Ltd4372 A0BB3E1|IVision Electronics Co.,Ltd
4315 A0BB3E2|DirectOut GmbH4373 A0BB3E2|DirectOut GmbH
@@ -4325,6 +4383,7 @@ A0BB3EB|Beijing Techshino Technology Co.
4325 A0BB3EC|Ewig Industries Macao Commercial4383 A0BB3EC|Ewig Industries Macao Commercial
4326 A0BB3ED|Shenzhen Talent Technology compa4384 A0BB3ED|Shenzhen Talent Technology compa
4327 A0BB3EE|Messtechnik Sachs GmbH4385 A0BB3EE|Messtechnik Sachs GmbH
4386+A0BB3EF|Private
4328 A0C5F20|Quantlab Financial, LLC4387 A0C5F20|Quantlab Financial, LLC
4329 A0C5F21|KNS Group LLC (YADRO Company)4388 A0C5F21|KNS Group LLC (YADRO Company)
4330 A0C5F22|Speedgoat GmbH4389 A0C5F22|Speedgoat GmbH
@@ -4370,6 +4429,7 @@ A43BFAB|ALSTOM Strongwish (Shenzhen) Co.
4370 A43BFAC|SHANGHAI XIETONG TECHNOLOGY INC.4429 A43BFAC|SHANGHAI XIETONG TECHNOLOGY INC.
4371 A43BFAD|JSC “Component-ASU”4430 A43BFAD|JSC “Component-ASU”
4372 A43BFAE|The Magstim Company Ltd.4431 A43BFAE|The Magstim Company Ltd.
4432+A43BFAF|Private
4373 A44F290|Dermalog Identification Systems 4433 A44F290|Dermalog Identification Systems
4374 A44F291|Olssen B.V.4434 A44F291|Olssen B.V.
4375 A44F292|LUCEOR4435 A44F292|LUCEOR
@@ -4385,6 +4445,7 @@ A44F29B|GUANGDONG REAL-DESIGN INTELLIGEN
4385 A44F29C|Shenzhen Huadoo Bright Group Lim4445 A44F29C|Shenzhen Huadoo Bright Group Lim
4386 A44F29D|HALLIBURTON4446 A44F29D|HALLIBURTON
4387 A44F29E|Neotech Systems Pvt. Ltd.4447 A44F29E|Neotech Systems Pvt. Ltd.
4448+A44F29F|Private
4388 A44F3E0|United Automotive Electronic Sys4449 A44F3E0|United Automotive Electronic Sys
4389 A44F3E1|Netshield Europe Srl4450 A44F3E1|Netshield Europe Srl
4390 A44F3E2|RINVENT INDUSTRIES PRIVATE LIMIT4451 A44F3E2|RINVENT INDUSTRIES PRIVATE LIMIT
@@ -4567,6 +4628,7 @@ ACEF92D|Robotic Assistance Devices Resid
4567 ACEF92E|JET OPTOELECTRONICS CO., LTD.4628 ACEF92E|JET OPTOELECTRONICS CO., LTD.
4568 B01F810|Dalian GigaTec Electronics Co.,L4629 B01F810|Dalian GigaTec Electronics Co.,L
4569 B01F811|Uvax Concepts4630 B01F811|Uvax Concepts
4631+B01F812|Private
4570 B01F813|Sound United4632 B01F813|Sound United
4571 B01F814|SHENZHEN YIFANG DIGITAL TECHNOLO4633 B01F814|SHENZHEN YIFANG DIGITAL TECHNOLO
4572 B01F815|SHENZHEN GRID TECHNOLOGY CO.,LTD4634 B01F815|SHENZHEN GRID TECHNOLOGY CO.,LTD
@@ -4579,6 +4641,7 @@ B01F81B|Rademacher Geraete-Elektronik Gm
4579 B01F81C|Access Device Integrated Communi4641 B01F81C|Access Device Integrated Communi
4580 B01F81D|TAIWAN Anjie Electronics Co.,Ltd4642 B01F81D|TAIWAN Anjie Electronics Co.,Ltd
4581 B01F81E|Advanced & Wise Technology Corp.4643 B01F81E|Advanced & Wise Technology Corp.
4644+B01F81F|Private
4582 B0475E0|Shanghai Kanghai Information Sys4645 B0475E0|Shanghai Kanghai Information Sys
4583 B0475E1|tintech4646 B0475E1|tintech
4584 B0475E2|Lanmus Networks Ltd4647 B0475E2|Lanmus Networks Ltd
@@ -4622,7 +4685,9 @@ B0C5CA9|D&T Inc.
4622 B0C5CAA|TEM Mobile Limited4685 B0C5CAA|TEM Mobile Limited
4623 B0C5CAB|RISECOMM (HK) TECHNOLOGY CO. LI4686 B0C5CAB|RISECOMM (HK) TECHNOLOGY CO. LI
4624 B0C5CAC|XMetrics4687 B0C5CAC|XMetrics
4688+B0C5CAD|Private
4625 B0C5CAE|Audio Elektronik İthalat İhracat4689 B0C5CAE|Audio Elektronik İthalat İhracat
4690+B0C5CAF|Private
4626 B0CCCE0|Steelco SpA4691 B0CCCE0|Steelco SpA
4627 B0CCCE1|Agrisys A/S4692 B0CCCE1|Agrisys A/S
4628 B0CCCE2|4MOD Technology4693 B0CCCE2|4MOD Technology
@@ -4683,6 +4748,7 @@ B437D1B|NSI Co., Ltd.
4683 B437D1C|NANJING PUTIAN TELECOMMUNICATION4748 B437D1C|NANJING PUTIAN TELECOMMUNICATION
4684 B437D1D|ZXY Sport Tracking4749 B437D1D|ZXY Sport Tracking
4685 B437D1E|Union Tecnologica Noxium S.L.4750 B437D1E|Union Tecnologica Noxium S.L.
4751+B437D1F|Private
4686 B44BD60|G4S Monitoring Technologies Ltd4752 B44BD60|G4S Monitoring Technologies Ltd
4687 B44BD61|SHENZHEN TITA INTERACTIVE TECHNO4753 B44BD61|SHENZHEN TITA INTERACTIVE TECHNO
4688 B44BD62|Shenzhen Cudy Technology Co., Lt4754 B44BD62|Shenzhen Cudy Technology Co., Lt
@@ -4692,6 +4758,7 @@ B44BD65|ShenZhen Comstar Technology Comp
4692 B44BD66|Perspicace Intellegince Technolo4758 B44BD66|Perspicace Intellegince Technolo
4693 B44BD67|Taizhou convergence Information 4759 B44BD67|Taizhou convergence Information
4694 B44BD68|Arnouse Digital Devices Corp4760 B44BD68|Arnouse Digital Devices Corp
4761+B44BD69|Private
4695 B44BD6A|Shenzhen Huabai Intelligent Tech4762 B44BD6A|Shenzhen Huabai Intelligent Tech
4696 B44BD6B|DongYoung media4763 B44BD6B|DongYoung media
4697 B44BD6C|Impakt S.A.4764 B44BD6C|Impakt S.A.
@@ -4771,6 +4838,7 @@ B84C87A|Altronix , Corp
4771 B84C87B|Beijing Yunji Technology Co., Lt4838 B84C87B|Beijing Yunji Technology Co., Lt
4772 B84C87C|SOND4839 B84C87C|SOND
4773 B84C87D|DFUN (ZHUHAI) CO,. LTD.4840 B84C87D|DFUN (ZHUHAI) CO,. LTD.
4841+B84C87E|Private
4774 B8D8120|Glamo Inc.4842 B8D8120|Glamo Inc.
4775 B8D8121|VOTEM4843 B8D8121|VOTEM
4776 B8D8122|IPM Sales and service Co.,Ltd.4844 B8D8122|IPM Sales and service Co.,Ltd.
@@ -4786,6 +4854,7 @@ B8D812B|Docobo Limited
4786 B8D812C|Yuwei Info&Tech Development Co.,4854 B8D812C|Yuwei Info&Tech Development Co.,
4787 B8D812D|Lam Research4855 B8D812D|Lam Research
4788 B8D812E|ZheJiang FangTai Electirc Co., L4856 B8D812E|ZheJiang FangTai Electirc Co., L
4857+B8D812F|Private
4789 BC31980|THINKCAR TECH CO.,LTD.4858 BC31980|THINKCAR TECH CO.,LTD.
4790 BC31981|swiss-sonic Ultraschall AG4859 BC31981|swiss-sonic Ultraschall AG
4791 BC31982|JSC Megapolis-telecom region4860 BC31982|JSC Megapolis-telecom region
@@ -4816,6 +4885,7 @@ BC3400B|FARO TECHNOLOGIES, INC.
4816 BC3400C|Parlay Labs dba Highfive4885 BC3400C|Parlay Labs dba Highfive
4817 BC3400D|Hangzhou Linker Digital Technolo4886 BC3400D|Hangzhou Linker Digital Technolo
4818 BC3400E|LLD Technology Ltd.4887 BC3400E|LLD Technology Ltd.
4888+BC3400F|Private
4819 BC66410|InSync Technology Ltd4889 BC66410|InSync Technology Ltd
4820 BC66411|Global China Technology Limited4890 BC66411|Global China Technology Limited
4821 BC66412|Process-Electronic Sp. z o.o.4891 BC66412|Process-Electronic Sp. z o.o.
@@ -4831,6 +4901,7 @@ BC6641B|Sidus Novum Sp. z o. o.
4831 BC6641C|Shenzhen Crave Communication Co.4901 BC6641C|Shenzhen Crave Communication Co.
4832 BC6641D|UtilLighting Co.,Ltd.4902 BC6641D|UtilLighting Co.,Ltd.
4833 BC6641E|Lucent Trans Electronics Co., Lt4903 BC6641E|Lucent Trans Electronics Co., Lt
4904+BC6641F|Private
4834 BC97400|Alpha ESS Co., Ltd.4905 BC97400|Alpha ESS Co., Ltd.
4835 BC97401|comtac AG4906 BC97401|comtac AG
4836 BC97402|Lattec I/S4907 BC97402|Lattec I/S
@@ -4918,6 +4989,7 @@ C083598|Ista SE
4918 C083599|Shenzhen Pay Device Technology C4989 C083599|Shenzhen Pay Device Technology C
4919 C08359A|SHANGHAI CHARMHOPE INFORMATION T4990 C08359A|SHANGHAI CHARMHOPE INFORMATION T
4920 C08359B|Suzhou Siheng Science and Techno4991 C08359B|Suzhou Siheng Science and Techno
4992+C08359C|Private
4921 C08359D|Gardner Denver Thomas GmbH4993 C08359D|Gardner Denver Thomas GmbH
4922 C08359E|Trystar, LLC4994 C08359E|Trystar, LLC
4923 C09BF40|Annapurna labs4995 C09BF40|Annapurna labs
@@ -4996,6 +5068,7 @@ C47C8DC|INOTEC Sicherheitstechnik GmbH
4996 C47C8DD|Anhui GuangXing Linked-Video Com5068 C47C8DD|Anhui GuangXing Linked-Video Com
4997 C47C8DE|Labor Strauss Sicherungsanlagenb5069 C47C8DE|Labor Strauss Sicherungsanlagenb
4998 C482720|Gabriel Tecnologia5070 C482720|Gabriel Tecnologia
5071+C482721|Private
4999 C482722|Digisine Energytech Co., Ltd.5072 C482722|Digisine Energytech Co., Ltd.
5000 C482723|NextSilicon5073 C482723|NextSilicon
5001 C482724|Melecs EWS GmbH5074 C482724|Melecs EWS GmbH
@@ -5204,11 +5277,13 @@ C88ED1B|Advanced Micro Controls Inc.
5204 C88ED1C|Shanghai Bwave Technology Co.,Lt5277 C88ED1C|Shanghai Bwave Technology Co.,Lt
5205 C88ED1D|PHOENIX ENGINEERING CORP.5278 C88ED1D|PHOENIX ENGINEERING CORP.
5206 C88ED1E|Aventics GmbH5279 C88ED1E|Aventics GmbH
5280+C88ED1F|Private
5207 C898DB0|Unicore Communications Inc.5281 C898DB0|Unicore Communications Inc.
5208 C898DB1|Block, Inc.5282 C898DB1|Block, Inc.
5209 C898DB2|freecle Inc.5283 C898DB2|freecle Inc.
5210 C898DB3|Shenzhen Kedakeda Technology Co.5284 C898DB3|Shenzhen Kedakeda Technology Co.
5211 C898DB4|Shenzhen IBD Intelligence Techno5285 C898DB4|Shenzhen IBD Intelligence Techno
5286+C898DB5|Private
5212 C898DB6|Quantum Co., Ltd.5287 C898DB6|Quantum Co., Ltd.
5213 C898DB7|J&R Technology Limited5288 C898DB7|J&R Technology Limited
5214 C898DB8|Voleatech GmbH5289 C898DB8|Voleatech GmbH
@@ -5278,6 +5353,7 @@ CC1BE0B|ART&CORE Inc
5278 CC1BE0C|Guangzhou Southelectric Power Sc5353 CC1BE0C|Guangzhou Southelectric Power Sc
5279 CC1BE0D|NEWSTAR (HK) ELECTRONIC DEVELOPM5354 CC1BE0D|NEWSTAR (HK) ELECTRONIC DEVELOPM
5280 CC1BE0E|Cassia Networks5355 CC1BE0E|Cassia Networks
5356+CC1BE0F|Private
5281 CC22370|MEDCOM sp. z o.o.5357 CC22370|MEDCOM sp. z o.o.
5282 CC22371|Terma Sp. z o.o.5358 CC22371|Terma Sp. z o.o.
5283 CC22372|Apeiron Data Systems5359 CC22372|Apeiron Data Systems
@@ -5386,22 +5462,33 @@ CCD39DE|Shanghai tongli information tech
5386 CCE7DE0|Shenzhen Jooan Technology Co., 5462 CCE7DE0|Shenzhen Jooan Technology Co.,
5387 CCE7DE1|Kaze.AI Technology Co.,Ltd.5463 CCE7DE1|Kaze.AI Technology Co.,Ltd.
5388 CCE7DE2|Octopus Energy Ltd5464 CCE7DE2|Octopus Energy Ltd
5465+CCE7DE3|Private
5389 CCE7DE4|Fareco5466 CCE7DE4|Fareco
5390 CCE7DE5|Chengdu Vantron Technology Co., 5467 CCE7DE5|Chengdu Vantron Technology Co.,
5391 CCE7DE6|Skylight5468 CCE7DE6|Skylight
5392 CCE7DE7|Shanghai Dabuziduo Information a5469 CCE7DE7|Shanghai Dabuziduo Information a
5470+CCE7DE8|Private
5393 CCE7DE9|Shenzhen Qichang Intelligent Tec5471 CCE7DE9|Shenzhen Qichang Intelligent Tec
5394 CCE7DEA|Opal Camera Inc.5472 CCE7DEA|Opal Camera Inc.
5395 CCE7DEB|3D Computing5473 CCE7DEB|3D Computing
5396 CCE7DEC|Guangdong Sirivision Communicati5474 CCE7DEC|Guangdong Sirivision Communicati
5397 CCE7DED|Juke Audio5475 CCE7DED|Juke Audio
5398 CCE7DEE|Shenzhen Xingyi Intelligent Tech5476 CCE7DEE|Shenzhen Xingyi Intelligent Tech
5477+CCF7220|OP CORE
5399 CCF7221|Lucky Tone Technology Co., Ltd.5478 CCF7221|Lucky Tone Technology Co., Ltd.
5479+CCF7222|Everfox Ltd
5480+CCF7223|InfiMaker(Shenzhen)Limited
5481+CCF7224|Menuit inc.
5400 CCF7225|Foritec GmbH5482 CCF7225|Foritec GmbH
5483+CCF7226|RIVERSIDE SOLUTIONS PRIVATE LIMI
5484+CCF7227|Electronic Security Wholesalers
5401 CCF7228|75F Engineering Services India P5485 CCF7228|75F Engineering Services India P
5486+CCF7229|deutherm cooling GmbH
5487+CCF722A|WIWORLD CO.,LTD
5402 CCF722B|SEP5488 CCF722B|SEP
5403 CCF722C|Walnut Medical Private Limited5489 CCF722C|Walnut Medical Private Limited
5404 CCF722D|KONEC SOLUTIONS PTY LTD5490 CCF722D|KONEC SOLUTIONS PTY LTD
5491+CCF722E|ASML US, LP
5405 D014110|EkkoSense Ltd5492 D014110|EkkoSense Ltd
5406 D014111|P.B. Elettronica srl5493 D014111|P.B. Elettronica srl
5407 D014112|Evoco Labs CO., LTD5494 D014112|Evoco Labs CO., LTD
@@ -5461,6 +5548,7 @@ D02212B|Schleifenbauer Holding BV
5461 D02212C|Xperio Labs Ltd.5548 D02212C|Xperio Labs Ltd.
5462 D02212D|SHENZHEN ZHONGXI SECURITY CO.,LT5549 D02212D|SHENZHEN ZHONGXI SECURITY CO.,LT
5463 D02212E|u::Lux GmbH5550 D02212E|u::Lux GmbH
5551+D02212F|Private
5464 D05F640|Decathlon SA5552 D05F640|Decathlon SA
5465 D05F641|Hangzhou ToupTek Photonics Co., 5553 D05F641|Hangzhou ToupTek Photonics Co.,
5466 D05F642|SHANGHAI ZHONGMI COMMUNICATION T5554 D05F642|SHANGHAI ZHONGMI COMMUNICATION T
@@ -5480,6 +5568,7 @@ D076500|CentrAlert, Inc.
5480 D076501|DAIKEN AUTOMACAO LTDA5568 D076501|DAIKEN AUTOMACAO LTDA
5481 D076502|Happo Solutions Oy5569 D076502|Happo Solutions Oy
5482 D076503|TAPKO Technologies GmbH5570 D076503|TAPKO Technologies GmbH
5571+D076504|Private
5483 D076505|Annapurna Labs5572 D076505|Annapurna Labs
5484 D076506|Picobrew LLC5573 D076506|Picobrew LLC
5485 D076507|ENCORED Technologies, Inc.5574 D076507|ENCORED Technologies, Inc.
@@ -5490,6 +5579,7 @@ D07650B|PelKorea
5490 D07650C|Electro-Motive Diesel5579 D07650C|Electro-Motive Diesel
5491 D07650D|tecnotron elekronik gmbh5580 D07650D|tecnotron elekronik gmbh
5492 D07650E|Revox Inc.5581 D07650E|Revox Inc.
5582+D07650F|Private
5493 D093950|Zhejiang Ruiyi lntelligent Techn5583 D093950|Zhejiang Ruiyi lntelligent Techn
5494 D093951|Hefei Siqiang Electronic Technol5584 D093951|Hefei Siqiang Electronic Technol
5495 D093952|AT&T5585 D093952|AT&T
@@ -5512,6 +5602,7 @@ D096863|EPHI B.V.
5512 D096864|Houston Radar LLC5602 D096864|Houston Radar LLC
5513 D096865|Annapurna labs5603 D096865|Annapurna labs
5514 D096866|Shenzhen Ntmer Technology Co., L5604 D096866|Shenzhen Ntmer Technology Co., L
5605+D096867|Private
5515 D096868|Energiekonzepte Deutschland GmbH5606 D096868|Energiekonzepte Deutschland GmbH
5516 D096869|Camfil5607 D096869|Camfil
5517 D09686A|Hero Health Inc.5608 D09686A|Hero Health Inc.
@@ -5744,6 +5835,7 @@ DC4427B|Nautilus Infotech CO., Ltd.
5744 DC4427C|Pyrexx Technologies GmbH5835 DC4427C|Pyrexx Technologies GmbH
5745 DC4427D|Rohde&Schwarz Topex SA5836 DC4427D|Rohde&Schwarz Topex SA
5746 DC4427E|VerifEye Technologies5837 DC4427E|VerifEye Technologies
5838+DC4427F|Private
5747 DC4A9E0|Dongguan Huili electroacoustic I5839 DC4A9E0|Dongguan Huili electroacoustic I
5748 DC4A9E1|Advanced Electronics Ltd5840 DC4A9E1|Advanced Electronics Ltd
5749 DC4A9E2|Annapurna labs5841 DC4A9E2|Annapurna labs
@@ -5909,6 +6001,7 @@ E4956EB|iConservo Inc
5909 E4956EC|Shenzhen Arronna Telecom Co.,Ltd6001 E4956EC|Shenzhen Arronna Telecom Co.,Ltd
5910 E4956ED|Shanghai Tieda Telecommunication6002 E4956ED|Shanghai Tieda Telecommunication
5911 E4956EE|Tacom Projetos Bilhetagem Inteli6003 E4956EE|Tacom Projetos Bilhetagem Inteli
6004+E4956EF|Private
5912 E818630|DigiMagus Technology (Shenzhen) 6005 E818630|DigiMagus Technology (Shenzhen)
5913 E818631|clabsys6006 E818631|clabsys
5914 E818632|AVCON Information Technology Co.6007 E818632|AVCON Information Technology Co.
@@ -5923,6 +6016,7 @@ E81863B|Protek Electronics Group Co.,LTD
5923 E81863C|Shenzhen Hipad Telecommunication6016 E81863C|Shenzhen Hipad Telecommunication
5924 E81863D|DIGITAL DYNAMICS, INC.6017 E81863D|DIGITAL DYNAMICS, INC.
5925 E81863E|Acopian Technical Company6018 E81863E|Acopian Technical Company
6019+E81863F|Private
5926 E86CC70|ebblo Western Europe6020 E86CC70|ebblo Western Europe
5927 E86CC71|ASSA ABLOY(GuangZhou) Smart Tech6021 E86CC71|ASSA ABLOY(GuangZhou) Smart Tech
5928 E86CC72|Xirgo Technologies LLC6022 E86CC72|Xirgo Technologies LLC
@@ -5983,6 +6077,7 @@ E8F6D7B|GUANGZHOU PANYU JUDA CAR AUDIO E
5983 E8F6D7C|clover Co,.Ltd6077 E8F6D7C|clover Co,.Ltd
5984 E8F6D7D|ZhuoPuCheng (Shenzhen) Technolog6078 E8F6D7D|ZhuoPuCheng (Shenzhen) Technolog
5985 E8F6D7E|Emergent Solutions Inc.6079 E8F6D7E|Emergent Solutions Inc.
6080+E8FF1E0|Private
5986 E8FF1E1|hard & softWERK GmbH6081 E8FF1E1|hard & softWERK GmbH
5987 E8FF1E2|Minami Medical Technology (Guang6082 E8FF1E2|Minami Medical Technology (Guang
5988 E8FF1E3|LLP NIC FORS6083 E8FF1E3|LLP NIC FORS
@@ -6222,6 +6317,7 @@ F40E11B|BRADAR INDUSTRIA SA
6222 F40E11C|NIHON MEGA LOGIC CO.,LTD.6317 F40E11C|NIHON MEGA LOGIC CO.,LTD.
6223 F40E11D|DXG Technology Corp.6318 F40E11D|DXG Technology Corp.
6224 F40E11E|Elektronika Naglic d.o.o.6319 F40E11E|Elektronika Naglic d.o.o.
6320+F40E11F|Private
6225 F41A790|MetCom Solutions GmbH6321 F41A790|MetCom Solutions GmbH
6226 F41A791|Jide Car Rastreamento e Monitora6322 F41A791|Jide Car Rastreamento e Monitora
6227 F41A792|HCTEK Co.,Ltd.6323 F41A792|HCTEK Co.,Ltd.
@@ -6357,6 +6453,7 @@ F80278B|Rosemount Analytical
6357 F80278C|Technology Research, LLC6453 F80278C|Technology Research, LLC
6358 F80278D|Dueton Systems s.r.o.6454 F80278D|Dueton Systems s.r.o.
6359 F80278E|Lit Technologies6455 F80278E|Lit Technologies
6456+F80278F|Private
6360 F81D780|Dongguan Shun Hing Plastics Limi6457 F81D780|Dongguan Shun Hing Plastics Limi
6361 F81D781|ADTECHNO Inc.6458 F81D781|ADTECHNO Inc.
6362 F81D782|Xperio Labs Limited6459 F81D782|Xperio Labs Limited
src/data/oui36.txtmodified+153 -106
@@ -3,11 +3,13 @@
3 001BC5002|GORAMO - Janusz Gorecki3 001BC5002|GORAMO - Janusz Gorecki
4 001BC5003|MicroSigns Technologies Inc4 001BC5003|MicroSigns Technologies Inc
5 001BC5004|Intellvisions Software Ltd5 001BC5004|Intellvisions Software Ltd
6+001BC5005|Private
6 001BC5006|TRIAX-HIRSCHMANN Multi-Media Gmb7 001BC5006|TRIAX-HIRSCHMANN Multi-Media Gmb
7 001BC5007|Energy Aware Technology8 001BC5007|Energy Aware Technology
8 001BC5008|Dalaj Electro-Telecom9 001BC5008|Dalaj Electro-Telecom
9 001BC5009|Solomon Systech Pte Ltd10 001BC5009|Solomon Systech Pte Ltd
10 001BC500A|Mercury HMI Ltd11 001BC500A|Mercury HMI Ltd
12+001BC500B|Private
11 001BC500C|Quantum Technology Sciences, Inc13 001BC500C|Quantum Technology Sciences, Inc
12 001BC500D|Advanced Scientific Concepts, In14 001BC500D|Advanced Scientific Concepts, In
13 001BC500E|Vigor Electric Corp15 001BC500E|Vigor Electric Corp
@@ -16,6 +18,7 @@
16 001BC5011|OOO NPP Mera18 001BC5011|OOO NPP Mera
17 001BC5012|Tokyo Cosmos Electric, Inc.19 001BC5012|Tokyo Cosmos Electric, Inc.
18 001BC5013|Zamir Recognition Systems Ltd.20 001BC5013|Zamir Recognition Systems Ltd.
21+001BC5014|Private
19 001BC5015|Corporate Systems Engineering22 001BC5015|Corporate Systems Engineering
20 001BC5016|Energotechnica OOO NPP Ltd23 001BC5016|Energotechnica OOO NPP Ltd
21 001BC5017|cPacket Networks24 001BC5017|cPacket Networks
@@ -24,6 +27,7 @@
24 001BC501B|Commonwealth Scientific and Indu27 001BC501B|Commonwealth Scientific and Indu
25 001BC501C|Coolit Systems, Inc.28 001BC501C|Coolit Systems, Inc.
26 001BC501D|Rose + Herleth GbR29 001BC501D|Rose + Herleth GbR
30+001BC501E|Private
27 001BC501F|Saturn Solutions Ltd31 001BC501F|Saturn Solutions Ltd
28 001BC5020|Momentum Data Systems32 001BC5020|Momentum Data Systems
29 001BC5021|Openpeak, Inc33 001BC5021|Openpeak, Inc
@@ -67,7 +71,7 @@
67 001BC5047|PT. Amanindo Nusapadu71 001BC5047|PT. Amanindo Nusapadu
68 001BC5048|XPossible Technologies Pte Ltd72 001BC5048|XPossible Technologies Pte Ltd
69 001BC5049|EUROCONTROL S.p.A.73 001BC5049|EUROCONTROL S.p.A.
70-001BC504A|Certis Technology International74+001BC504A|Certis Technology International
71 001BC504B|Silicon Controls75 001BC504B|Silicon Controls
72 001BC504C|Rhino Controls Ltd.76 001BC504C|Rhino Controls Ltd.
73 001BC504D|eiraku electric corp.77 001BC504D|eiraku electric corp.
@@ -77,6 +81,7 @@
77 001BC5051|QQ Navigation AB81 001BC5051|QQ Navigation AB
78 001BC5052|Engineering Center ENERGOSERVICE82 001BC5052|Engineering Center ENERGOSERVICE
79 001BC5053|Metrycom Communications Ltd83 001BC5053|Metrycom Communications Ltd
84+001BC5054|Private
80 001BC5055|LUMIPLAN TRANSPORT85 001BC5055|LUMIPLAN TRANSPORT
81 001BC5056|ThinKom Solutions, Inc86 001BC5056|ThinKom Solutions, Inc
82 001BC5057|EREE Electronique87 001BC5057|EREE Electronique
@@ -104,7 +109,7 @@
104 001BC506D|TES Electronic Solutions (I) Pvt109 001BC506D|TES Electronic Solutions (I) Pvt
105 001BC506E|Two Dimensional Instruments, LLC110 001BC506E|Two Dimensional Instruments, LLC
106 001BC506F|LLC Emzior111 001BC506F|LLC Emzior
107-001BC5070|Siemens Industries, Inc, Retail112+001BC5070|Siemens Industries, Inc, Retail
108 001BC5071|Center for E-Commerce Infrastruc113 001BC5071|Center for E-Commerce Infrastruc
109 001BC5072|Ohio Semitronics, Inc.114 001BC5072|Ohio Semitronics, Inc.
110 001BC5073|tado GmbH115 001BC5073|tado GmbH
@@ -176,6 +181,7 @@
176 001BC50B5|Exibea AB181 001BC50B5|Exibea AB
177 001BC50B6|VEILUX INC.182 001BC50B6|VEILUX INC.
178 001BC50B7|Autelis, LLC183 001BC50B7|Autelis, LLC
184+001BC50B8|Private
179 001BC50B9|Denki Kogyo Company, Limited185 001BC50B9|Denki Kogyo Company, Limited
180 001BC50BA|NT MICROSYSTEMS186 001BC50BA|NT MICROSYSTEMS
181 001BC50BB|Triax A/S187 001BC50BB|Triax A/S
@@ -214,7 +220,7 @@
214 70B3D5013|Sportsbeams Lighting, Inc.220 70B3D5013|Sportsbeams Lighting, Inc.
215 70B3D5014|FRAKO Kondensatoren und Anlagenb221 70B3D5014|FRAKO Kondensatoren und Anlagenb
216 70B3D5015|EN ElectronicNetwork Hamburg Gmb222 70B3D5015|EN ElectronicNetwork Hamburg Gmb
217-70B3D5016|Guardian Controls International223+70B3D5016|Guardian Controls International
218 70B3D5017|FTG Corporation224 70B3D5017|FTG Corporation
219 70B3D5018|DELITECH GROUP225 70B3D5018|DELITECH GROUP
220 70B3D5019|Transit Solutions, LLC.226 70B3D5019|Transit Solutions, LLC.
@@ -359,7 +365,7 @@
359 70B3D50A4|Communication Technology Ltd.365 70B3D50A4|Communication Technology Ltd.
360 70B3D50A5|FUELCELLPOWER366 70B3D50A5|FUELCELLPOWER
361 70B3D50A6|PA CONSULTING SERVICES367 70B3D50A6|PA CONSULTING SERVICES
362-70B3D50A7|Traffic and Parking Control Co,368+70B3D50A7|Traffic and Parking Control Co,
363 70B3D50A8|Symetrics Industries d.b.a. Exta369 70B3D50A8|Symetrics Industries d.b.a. Exta
364 70B3D50A9|ProConnections, Inc.370 70B3D50A9|ProConnections, Inc.
365 70B3D50AA|Wanco Inc371 70B3D50AA|Wanco Inc
@@ -472,7 +478,7 @@
472 70B3D5115|Welltec Corp.478 70B3D5115|Welltec Corp.
473 70B3D5116|Momentum Data Systems479 70B3D5116|Momentum Data Systems
474 70B3D5117|SysCom Automationstechnik GmbH480 70B3D5117|SysCom Automationstechnik GmbH
475-70B3D5118|Macromatic Industrial Controls,481+70B3D5118|Macromatic Industrial Controls,
476 70B3D5119|YPP Corporation482 70B3D5119|YPP Corporation
477 70B3D511A|Mahindra Electric Mobility Limit483 70B3D511A|Mahindra Electric Mobility Limit
478 70B3D511B|HoseoTelnet Inc...484 70B3D511B|HoseoTelnet Inc...
@@ -484,7 +490,7 @@
484 70B3D5121|Shenzhen Luxurite Smart Home Ltd490 70B3D5121|Shenzhen Luxurite Smart Home Ltd
485 70B3D5122|Henri Systems Holland bv491 70B3D5122|Henri Systems Holland bv
486 70B3D5123|Amfitech ApS492 70B3D5123|Amfitech ApS
487-70B3D5124|Forschungs- und Transferzentrum493+70B3D5124|Forschungs- und Transferzentrum
488 70B3D5125|Securolytics, Inc.494 70B3D5125|Securolytics, Inc.
489 70B3D5126|AddSecure Smart Grids495 70B3D5126|AddSecure Smart Grids
490 70B3D5127|VITEC496 70B3D5127|VITEC
@@ -614,7 +620,7 @@
614 70B3D51A3|Telairity Semiconductor620 70B3D51A3|Telairity Semiconductor
615 70B3D51A4|DAVEY BICKFORD621 70B3D51A4|DAVEY BICKFORD
616 70B3D51A5|METRONIC APARATURA KONTROLNO - P622 70B3D51A5|METRONIC APARATURA KONTROLNO - P
617-70B3D51A6|Robotelf Technologies (Chengdu)623+70B3D51A6|Robotelf Technologies (Chengdu)
618 70B3D51A7|Elk Solutions, LLC624 70B3D51A7|Elk Solutions, LLC
619 70B3D51A8|STC Rainbow Ltd.625 70B3D51A8|STC Rainbow Ltd.
620 70B3D51A9|OCEANIX INC.626 70B3D51A9|OCEANIX INC.
@@ -733,9 +739,10 @@
733 70B3D521A|Acutronic Link Robotics AG739 70B3D521A|Acutronic Link Robotics AG
734 70B3D521B|Lab241 Co.,Ltd.740 70B3D521B|Lab241 Co.,Ltd.
735 70B3D521C|Enyx SA741 70B3D521C|Enyx SA
736-70B3D521D|iRF - Intelligent RF Solutions,742+70B3D521D|iRF - Intelligent RF Solutions,
737 70B3D521E|Hildebrand Technology Limited743 70B3D521E|Hildebrand Technology Limited
738 70B3D521F|CHRONOMEDIA744 70B3D521F|CHRONOMEDIA
745+70B3D5220|Private
739 70B3D5221|LX Design House746 70B3D5221|LX Design House
740 70B3D5222|Marioff Corporation Oy747 70B3D5222|Marioff Corporation Oy
741 70B3D5223|Research Laboratory of Design Au748 70B3D5223|Research Laboratory of Design Au
@@ -749,6 +756,7 @@
749 70B3D522B|VITEC756 70B3D522B|VITEC
750 70B3D522C|Hiquel Elektronik- und Anlagenba757 70B3D522C|Hiquel Elektronik- und Anlagenba
751 70B3D522D|Leder Elektronik Design758 70B3D522D|Leder Elektronik Design
759+70B3D522E|Private
752 70B3D522F|Instec, Inc.760 70B3D522F|Instec, Inc.
753 70B3D5230|CT Company761 70B3D5230|CT Company
754 70B3D5231|DELTA TAU DATA SYSTEMS, INC.762 70B3D5231|DELTA TAU DATA SYSTEMS, INC.
@@ -781,7 +789,7 @@
781 70B3D524C|Astronomical Research Cameras, I789 70B3D524C|Astronomical Research Cameras, I
782 70B3D524D|INFO CREATIVE (HK) LTD790 70B3D524D|INFO CREATIVE (HK) LTD
783 70B3D524E|Chengdu Cove Technology CO.,LTD791 70B3D524E|Chengdu Cove Technology CO.,LTD
784-70B3D524F|ELBIT SYSTEMS BMD AND LAND EW -792+70B3D524F|ELBIT SYSTEMS BMD AND LAND EW -
785 70B3D5250|Datum Electronics Limited793 70B3D5250|Datum Electronics Limited
786 70B3D5251|Tap Home, s.r.o.794 70B3D5251|Tap Home, s.r.o.
787 70B3D5252|Sierra Nevada Corporation795 70B3D5252|Sierra Nevada Corporation
@@ -835,7 +843,7 @@
835 70B3D5282|SAMBO HITECH843 70B3D5282|SAMBO HITECH
836 70B3D5283|TextNinja Co.844 70B3D5283|TextNinja Co.
837 70B3D5284|Globalcom Engineering SPA845 70B3D5284|Globalcom Engineering SPA
838-70B3D5285|Bentec GmbH Drilling & Oilfield846+70B3D5285|Bentec GmbH Drilling & Oilfield
839 70B3D5286|Pedax Danmark847 70B3D5286|Pedax Danmark
840 70B3D5287|Hypex Electronics BV848 70B3D5287|Hypex Electronics BV
841 70B3D5288|Bresslergroup849 70B3D5288|Bresslergroup
@@ -889,7 +897,7 @@
889 70B3D52B8|WideNorth AS897 70B3D52B8|WideNorth AS
890 70B3D52B9|BELECTRIC GmbH898 70B3D52B9|BELECTRIC GmbH
891 70B3D52BA|Active Brains899 70B3D52BA|Active Brains
892-70B3D52BB|Automation Networks & Solutions900+70B3D52BB|Automation Networks & Solutions
893 70B3D52BC|EQUIPOS DE TELECOMUNICACIÓN OPTO901 70B3D52BC|EQUIPOS DE TELECOMUNICACIÓN OPTO
894 70B3D52BD|mg-sensor GmbH902 70B3D52BD|mg-sensor GmbH
895 70B3D52BE|Coherent Logix, Inc.903 70B3D52BE|Coherent Logix, Inc.
@@ -917,6 +925,7 @@
917 70B3D52D4|CT Company925 70B3D52D4|CT Company
918 70B3D52D5|Teuco Guzzini926 70B3D52D5|Teuco Guzzini
919 70B3D52D6|Kvazar LLC927 70B3D52D6|Kvazar LLC
928+70B3D52D7|Private
920 70B3D52D8|Unisight Digital Products929 70B3D52D8|Unisight Digital Products
921 70B3D52D9|ZPAS S.A.930 70B3D52D9|ZPAS S.A.
922 70B3D52DA|Skywave Networks Private Limited931 70B3D52DA|Skywave Networks Private Limited
@@ -978,6 +987,7 @@
978 70B3D5312|SMITEC S.p.A.987 70B3D5312|SMITEC S.p.A.
979 70B3D5313|DIEHL Controls988 70B3D5313|DIEHL Controls
980 70B3D5314|Grau Elektronik GmbH989 70B3D5314|Grau Elektronik GmbH
990+70B3D5315|Private
981 70B3D5316|Austco Marketing & Service (USA)991 70B3D5316|Austco Marketing & Service (USA)
982 70B3D5317|Iotopia Solutions992 70B3D5317|Iotopia Solutions
983 70B3D5318|Exemplar Medical, LLC993 70B3D5318|Exemplar Medical, LLC
@@ -1095,7 +1105,7 @@
1095 70B3D5388|Xitron1105 70B3D5388|Xitron
1096 70B3D5389|2KLIC inc.1106 70B3D5389|2KLIC inc.
1097 70B3D538A|KSE GmbH1107 70B3D538A|KSE GmbH
1098-70B3D538B|Lookman Electroplast Industries1108+70B3D538B|Lookman Electroplast Industries
1099 70B3D538C|MiraeSignal Co., Ltd1109 70B3D538C|MiraeSignal Co., Ltd
1100 70B3D538D|IMP-TELEKOMUNIKACIJE DOO1110 70B3D538D|IMP-TELEKOMUNIKACIJE DOO
1101 70B3D538E|China Telecom Fufu Information T1111 70B3D538E|China Telecom Fufu Information T
@@ -1351,7 +1361,7 @@
1351 70B3D5489|ard sa1361 70B3D5489|ard sa
1352 70B3D548A|George Wilson Industries Ltd1362 70B3D548A|George Wilson Industries Ltd
1353 70B3D548B|TATTILE SRL1363 70B3D548B|TATTILE SRL
1354-70B3D548C|Integrated Systems Engineering,1364+70B3D548C|Integrated Systems Engineering,
1355 70B3D548D|OMEGA BILANCE SRL SOCIETA' UNIPE1365 70B3D548D|OMEGA BILANCE SRL SOCIETA' UNIPE
1356 70B3D548E|Allim System Co,.Ltd.1366 70B3D548E|Allim System Co,.Ltd.
1357 70B3D548F|Seiwa Giken1367 70B3D548F|Seiwa Giken
@@ -1420,7 +1430,7 @@
1420 70B3D54CE|Agilack1430 70B3D54CE|Agilack
1421 70B3D54CF|GREEN HOUSE CO., LTD.1431 70B3D54CF|GREEN HOUSE CO., LTD.
1422 70B3D54D0|Codewerk GmbH1432 70B3D54D0|Codewerk GmbH
1423-70B3D54D1|Contraves Advanced Devices Sdn.1433+70B3D54D1|Contraves Advanced Devices Sdn.
1424 70B3D54D2|Biotage Sweden AB1434 70B3D54D2|Biotage Sweden AB
1425 70B3D54D3|Hefei STAROT Technology Co.,Ltd1435 70B3D54D3|Hefei STAROT Technology Co.,Ltd
1426 70B3D54D4|Nortek Global HVAC1436 70B3D54D4|Nortek Global HVAC
@@ -1462,7 +1472,7 @@
1462 70B3D54F8|SICPA SA - GSS1472 70B3D54F8|SICPA SA - GSS
1463 70B3D54F9|OptoPrecision GmbH1473 70B3D54F9|OptoPrecision GmbH
1464 70B3D54FA|Thruvision Limited1474 70B3D54FA|Thruvision Limited
1465-70B3D54FB|MAS Elettronica sas di Mascetti1475+70B3D54FB|MAS Elettronica sas di Mascetti
1466 70B3D54FC|Mettler Toledo1476 70B3D54FC|Mettler Toledo
1467 70B3D54FD|ENLESS WIRELESS1477 70B3D54FD|ENLESS WIRELESS
1468 70B3D54FE|WiTagg, Inc1478 70B3D54FE|WiTagg, Inc
@@ -1530,7 +1540,7 @@
1530 70B3D553C|Airthings1540 70B3D553C|Airthings
1531 70B3D553D|ACCEL CORP1541 70B3D553D|ACCEL CORP
1532 70B3D553E|Asiga Pty Ltd1542 70B3D553E|Asiga Pty Ltd
1533-70B3D553F|Abbott Diagnostics Technologies1543+70B3D553F|Abbott Diagnostics Technologies
1534 70B3D5540|KMtronic ltd1544 70B3D5540|KMtronic ltd
1535 70B3D5541|Nanjing Pingguang Electronic Tec1545 70B3D5541|Nanjing Pingguang Electronic Tec
1536 70B3D5542|RTDS Technologies Inc.1546 70B3D5542|RTDS Technologies Inc.
@@ -1595,6 +1605,7 @@
1595 70B3D557D|WICOM1 GmbH1605 70B3D557D|WICOM1 GmbH
1596 70B3D557E|Ascon Tecnologic S.r.l.1606 70B3D557E|Ascon Tecnologic S.r.l.
1597 70B3D557F|MBio Diagnostics, Inc.1607 70B3D557F|MBio Diagnostics, Inc.
1608+70B3D5580|Private
1598 70B3D5581|Thermokon Sensortechnik GmbH1609 70B3D5581|Thermokon Sensortechnik GmbH
1599 70B3D5582|VAGLER International Sdn Bhd1610 70B3D5582|VAGLER International Sdn Bhd
1600 70B3D5583|Ducommun Inc.1611 70B3D5583|Ducommun Inc.
@@ -1637,7 +1648,7 @@
1637 70B3D55A8|Farmobile, LLC1648 70B3D55A8|Farmobile, LLC
1638 70B3D55A9|Bunka Shutter Co., Ltd.1649 70B3D55A9|Bunka Shutter Co., Ltd.
1639 70B3D55AA|Chugoku Electric Manufacturing C1650 70B3D55AA|Chugoku Electric Manufacturing C
1640-70B3D55AB|Sea Air and Land Communications1651+70B3D55AB|Sea Air and Land Communications
1641 70B3D55AC|LM-Instruments Oy1652 70B3D55AC|LM-Instruments Oy
1642 70B3D55AD|Profotech1653 70B3D55AD|Profotech
1643 70B3D55AE|TinTec Co., Ltd.1654 70B3D55AE|TinTec Co., Ltd.
@@ -1818,7 +1829,7 @@
1818 70B3D565D|GEGA ELECTRONIQUE1829 70B3D565D|GEGA ELECTRONIQUE
1819 70B3D565E|Season Electronics Ltd1830 70B3D565E|Season Electronics Ltd
1820 70B3D565F|Axnes AS1831 70B3D565F|Axnes AS
1821-70B3D5660|Smart Service Technologies CO.,1832+70B3D5660|Smart Service Technologies CO.,
1822 70B3D5661|DesignA Electronics Limited1833 70B3D5661|DesignA Electronics Limited
1823 70B3D5662|Icon Industrial Engineering1834 70B3D5662|Icon Industrial Engineering
1824 70B3D5663|Intrinsic Group Limited1835 70B3D5663|Intrinsic Group Limited
@@ -1919,8 +1930,8 @@
1919 70B3D56C2|TEX COMPUTER SRL1930 70B3D56C2|TEX COMPUTER SRL
1920 70B3D56C3|BEIJING ZGH SECURITY RESEARCH IN1931 70B3D56C3|BEIJING ZGH SECURITY RESEARCH IN
1921 70B3D56C4|Veo Robotics, Inc.1932 70B3D56C4|Veo Robotics, Inc.
1922-70B3D56C5|CJSC «Russian telecom equipment1933+70B3D56C5|CJSC «Russian telecom equipment
1923-70B3D56C6|Abbott Diagnostics Technologies1934+70B3D56C6|Abbott Diagnostics Technologies
1924 70B3D56C7|Becton Dickinson1935 70B3D56C7|Becton Dickinson
1925 70B3D56C8|Sicon srl1936 70B3D56C8|Sicon srl
1926 70B3D56C9|Redstone Sunshine(Beijing)Techno1937 70B3D56C9|Redstone Sunshine(Beijing)Techno
@@ -1929,8 +1940,9 @@
1929 70B3D56CC|ARINAX1940 70B3D56CC|ARINAX
1930 70B3D56CD|NORTHBOUND NETWORKS PTY. LTD.1941 70B3D56CD|NORTHBOUND NETWORKS PTY. LTD.
1931 70B3D56CE|Eredi Giuseppe Mercuri SPA1942 70B3D56CE|Eredi Giuseppe Mercuri SPA
1943+70B3D56CF|Private
1932 70B3D56D0|Code Blue Corporation1944 70B3D56D0|Code Blue Corporation
1933-70B3D56D1|Visual Engineering Technologies1945+70B3D56D1|Visual Engineering Technologies
1934 70B3D56D2|Ahrens & Birner Company GmbH1946 70B3D56D2|Ahrens & Birner Company GmbH
1935 70B3D56D3|DEUTA-WERKE GmbH1947 70B3D56D3|DEUTA-WERKE GmbH
1936 70B3D56D4|Telerob Gesellschaft für Fernhan1948 70B3D56D4|Telerob Gesellschaft für Fernhan
@@ -1942,14 +1954,14 @@
1942 70B3D56DA|Enovative Networks, Inc.1954 70B3D56DA|Enovative Networks, Inc.
1943 70B3D56DB|Techimp - Altanova group Srl1955 70B3D56DB|Techimp - Altanova group Srl
1944 70B3D56DC|DEUTA-WERKE GmbH1956 70B3D56DC|DEUTA-WERKE GmbH
1945-70B3D56DD|Abbott Diagnostics Technologies1957+70B3D56DD|Abbott Diagnostics Technologies
1946 70B3D56DE|Ametek Solidstate Controls1958 70B3D56DE|Ametek Solidstate Controls
1947 70B3D56DF|Mango DSP, Inc.1959 70B3D56DF|Mango DSP, Inc.
1948 70B3D56E0|ABB SPA - DMPC1960 70B3D56E0|ABB SPA - DMPC
1949 70B3D56E1|Shanghai Holystar Information Te1961 70B3D56E1|Shanghai Holystar Information Te
1950 70B3D56E2|E-Controls1962 70B3D56E2|E-Controls
1951 70B3D56E3|SHEN ZHEN QLS ELECTRONIC TECHNOL1963 70B3D56E3|SHEN ZHEN QLS ELECTRONIC TECHNOL
1952-70B3D56E4|Institute of Power Engineering,1964+70B3D56E4|Institute of Power Engineering,
1953 70B3D56E5|DEUTA-WERKE GmbH1965 70B3D56E5|DEUTA-WERKE GmbH
1954 70B3D56E6|Eleven Engineering Incorporated1966 70B3D56E6|Eleven Engineering Incorporated
1955 70B3D56E7|AML1967 70B3D56E7|AML
@@ -1993,7 +2005,7 @@
1993 70B3D570D|OMNISENSING PHOTONICS LLC2005 70B3D570D|OMNISENSING PHOTONICS LLC
1994 70B3D570E|Wuhan Xingtuxinke ELectronic Co.2006 70B3D570E|Wuhan Xingtuxinke ELectronic Co.
1995 70B3D570F|Alion Science & Technology2007 70B3D570F|Alion Science & Technology
1996-70B3D5710|Guardian Controls International2008+70B3D5710|Guardian Controls International
1997 70B3D5711|X-Laser LLC2009 70B3D5711|X-Laser LLC
1998 70B3D5712|APG Cash Drawer, LLC2010 70B3D5712|APG Cash Drawer, LLC
1999 70B3D5713|Coloet S.r.l.2011 70B3D5713|Coloet S.r.l.
@@ -2062,7 +2074,7 @@
2062 70B3D5752|Guan Show Technologe Co., Ltd.2074 70B3D5752|Guan Show Technologe Co., Ltd.
2063 70B3D5753|HCH. Kündig & CIE. AG2075 70B3D5753|HCH. Kündig & CIE. AG
2064 70B3D5754|COSMOIT.CO.LTD2076 70B3D5754|COSMOIT.CO.LTD
2065-70B3D5755|LandmarkTech Systems Technology2077+70B3D5755|LandmarkTech Systems Technology
2066 70B3D5756|TimeMachines Inc.2078 70B3D5756|TimeMachines Inc.
2067 70B3D5757|GABO2079 70B3D5757|GABO
2068 70B3D5758|Grossenbacher Systeme AG2080 70B3D5758|Grossenbacher Systeme AG
@@ -2104,7 +2116,7 @@
2104 70B3D577C|HUSTY M.Styczen J.Hupert Sp.J.2116 70B3D577C|HUSTY M.Styczen J.Hupert Sp.J.
2105 70B3D577D|APG Cash Drawer, LLC2117 70B3D577D|APG Cash Drawer, LLC
2106 70B3D577E|Blue Marble Communications, Inc.2118 70B3D577E|Blue Marble Communications, Inc.
2107-70B3D577F|Microchip Technology Germany II2119+70B3D577F|Microchip Technology Germany II
2108 70B3D5780|NIDEC LEROY-SOMER2120 70B3D5780|NIDEC LEROY-SOMER
2109 70B3D5781|Project Service S.a.s.2121 70B3D5781|Project Service S.a.s.
2110 70B3D5782|thou&tech2122 70B3D5782|thou&tech
@@ -2332,7 +2344,7 @@
2332 70B3D5860|KBS Industrieelektronik GmbH2344 70B3D5860|KBS Industrieelektronik GmbH
2333 70B3D5861|KST technology2345 70B3D5861|KST technology
2334 70B3D5862|TripleOre2346 70B3D5862|TripleOre
2335-70B3D5863|Shenzhen Wesion Technology Co.,2347+70B3D5863|Shenzhen Wesion Technology Co.,
2336 70B3D5864|BORMANN EDV und Zubehoer2348 70B3D5864|BORMANN EDV und Zubehoer
2337 70B3D5865|Insitu, Inc.2349 70B3D5865|Insitu, Inc.
2338 70B3D5866|MEPS Realtime2350 70B3D5866|MEPS Realtime
@@ -2461,7 +2473,7 @@
2461 70B3D58E2|Zhiye Electronics Co., Ltd.2473 70B3D58E2|Zhiye Electronics Co., Ltd.
2462 70B3D58E3|DORLET SAU2474 70B3D58E3|DORLET SAU
2463 70B3D58E4|Aplex Technology Inc.2475 70B3D58E4|Aplex Technology Inc.
2464-70B3D58E5|Shanghai Armour Technology Co.,2476+70B3D58E5|Shanghai Armour Technology Co.,
2465 70B3D58E6|Mothonic AB2477 70B3D58E6|Mothonic AB
2466 70B3D58E7|REO AG2478 70B3D58E7|REO AG
2467 70B3D58E8|PREO INDUSTRIES FAR EAST LTD2479 70B3D58E8|PREO INDUSTRIES FAR EAST LTD
@@ -2611,7 +2623,7 @@
2611 70B3D5978|Satixfy Israel Ltd.2623 70B3D5978|Satixfy Israel Ltd.
2612 70B3D5979|eSMART Technologies SA2624 70B3D5979|eSMART Technologies SA
2613 70B3D597A|Orion Corporation2625 70B3D597A|Orion Corporation
2614-70B3D597B|WIKA Alexander Wiegand SE & Co.2626+70B3D597B|WIKA Alexander Wiegand SE & Co.
2615 70B3D597C|Nu-Tek Power Controls and Automa2627 70B3D597C|Nu-Tek Power Controls and Automa
2616 70B3D597D|RCH SPA2628 70B3D597D|RCH SPA
2617 70B3D597E|Public Joint Stock Company Morio2629 70B3D597E|Public Joint Stock Company Morio
@@ -2628,7 +2640,7 @@
2628 70B3D5989|DCNS2640 70B3D5989|DCNS
2629 70B3D598A|vision systems safety tech2641 70B3D598A|vision systems safety tech
2630 70B3D598B|Richard Paul Russell Ltd2642 70B3D598B|Richard Paul Russell Ltd
2631-70B3D598C|University of Wisconsin Madison2643+70B3D598C|University of Wisconsin Madison
2632 70B3D598D|Motohaus Powersports Limited2644 70B3D598D|Motohaus Powersports Limited
2633 70B3D598E|Autocom Diagnostic Partner AB2645 70B3D598E|Autocom Diagnostic Partner AB
2634 70B3D598F|Spaceflight Industries2646 70B3D598F|Spaceflight Industries
@@ -2649,9 +2661,9 @@
2649 70B3D599E|Trinity College Dublin2661 70B3D599E|Trinity College Dublin
2650 70B3D599F|Confed Holding B.V.2662 70B3D599F|Confed Holding B.V.
2651 70B3D59A0|ELDES2663 70B3D59A0|ELDES
2652-70B3D59A1|ITS Industrial Turbine Services2664+70B3D59A1|ITS Industrial Turbine Services
2653 70B3D59A2|O-Net Communications(Shenzhen)Li2665 70B3D59A2|O-Net Communications(Shenzhen)Li
2654-70B3D59A3|Shanghai Hourui Technology Co.,2666+70B3D59A3|Shanghai Hourui Technology Co.,
2655 70B3D59A4|Nordmann International GmbH2667 70B3D59A4|Nordmann International GmbH
2656 70B3D59A5|Softel2668 70B3D59A5|Softel
2657 70B3D59A6|QUNU LABS PRIVATE LIMITED2669 70B3D59A6|QUNU LABS PRIVATE LIMITED
@@ -2875,7 +2887,7 @@
2875 70B3D5A80|EVCO SPA2887 70B3D5A80|EVCO SPA
2876 70B3D5A81|Sienda New Media Technologies Gm2888 70B3D5A81|Sienda New Media Technologies Gm
2877 70B3D5A82|Telefrank GmbH2889 70B3D5A82|Telefrank GmbH
2878-70B3D5A83|SHENZHEN HUINENGYUAN Technology2890+70B3D5A83|SHENZHEN HUINENGYUAN Technology
2879 70B3D5A84|SOREL GmbH2891 70B3D5A84|SOREL GmbH
2880 70B3D5A85|exceet electronics GesmbH2892 70B3D5A85|exceet electronics GesmbH
2881 70B3D5A86|Divigraph (Pty) LTD2893 70B3D5A86|Divigraph (Pty) LTD
@@ -2962,6 +2974,7 @@
2962 70B3D5AD7|Octopus IoT srl2974 70B3D5AD7|Octopus IoT srl
2963 70B3D5AD8|Euklis by GSG International2975 70B3D5AD8|Euklis by GSG International
2964 70B3D5AD9|aelettronica group srl2976 70B3D5AD9|aelettronica group srl
2977+70B3D5ADA|Private
2965 70B3D5ADB|RF Code2978 70B3D5ADB|RF Code
2966 70B3D5ADC|SODAQ2979 70B3D5ADC|SODAQ
2967 70B3D5ADD|GHL Systems Berhad2980 70B3D5ADD|GHL Systems Berhad
@@ -2970,7 +2983,7 @@
2970 70B3D5AE0|AnyComm.Co.,Ltd.2983 70B3D5AE0|AnyComm.Co.,Ltd.
2971 70B3D5AE1|DimoCore Corporation2984 70B3D5AE1|DimoCore Corporation
2972 70B3D5AE2|Wartsila Voyage Oy2985 70B3D5AE2|Wartsila Voyage Oy
2973-70B3D5AE3|Zhejiang Wellsun Electric Meter2986+70B3D5AE3|Zhejiang Wellsun Electric Meter
2974 70B3D5AE4|Nuance Hearing Ltd.2987 70B3D5AE4|Nuance Hearing Ltd.
2975 70B3D5AE5|BeatCraft, Inc.2988 70B3D5AE5|BeatCraft, Inc.
2976 70B3D5AE6|Ya Batho Trading (Pty) Ltd2989 70B3D5AE6|Ya Batho Trading (Pty) Ltd
@@ -3188,7 +3201,7 @@
3188 70B3D5BBB|YUYAMA MFG Co.,Ltd3201 70B3D5BBB|YUYAMA MFG Co.,Ltd
3189 70B3D5BBC|Boundary Technologies Ltd3202 70B3D5BBC|Boundary Technologies Ltd
3190 70B3D5BBD|Providius Corp3203 70B3D5BBD|Providius Corp
3191-70B3D5BBE|Sunrise Systems Electronics Co.3204+70B3D5BBE|Sunrise Systems Electronics Co.
3192 70B3D5BBF|Ensys srl3205 70B3D5BBF|Ensys srl
3193 70B3D5BC0|SENSO2ME3206 70B3D5BC0|SENSO2ME
3194 70B3D5BC1|Abionic3207 70B3D5BC1|Abionic
@@ -3360,6 +3373,7 @@
3360 70B3D5C67|Collini Dienstleistungs GmbH3373 70B3D5C67|Collini Dienstleistungs GmbH
3361 70B3D5C68|Mini Solution Co. Ltd.3374 70B3D5C68|Mini Solution Co. Ltd.
3362 70B3D5C69|AZ-TECHNOLOGY SDN BHD3375 70B3D5C69|AZ-TECHNOLOGY SDN BHD
3376+70B3D5C6A|Private
3363 70B3D5C6B|Herholdt Controls srl3377 70B3D5C6B|Herholdt Controls srl
3364 70B3D5C6C|McQ Inc3378 70B3D5C6C|McQ Inc
3365 70B3D5C6D|Cyviz AS3379 70B3D5C6D|Cyviz AS
@@ -3372,7 +3386,7 @@
3372 70B3D5C74|Qtechnology A/S3386 70B3D5C74|Qtechnology A/S
3373 70B3D5C75|Planet Innovation Products Inc.3387 70B3D5C75|Planet Innovation Products Inc.
3374 70B3D5C76|ELA INNOVATION3388 70B3D5C76|ELA INNOVATION
3375-70B3D5C77|Yönnet Akıllı Bina ve Otomasyon3389+70B3D5C77|Yönnet Akıllı Bina ve Otomasyon
3376 70B3D5C78|NETA Elektronik AS3390 70B3D5C78|NETA Elektronik AS
3377 70B3D5C79|MB connect line GmbH Fernwartung3391 70B3D5C79|MB connect line GmbH Fernwartung
3378 70B3D5C7A|ENTEC Electric & Electronic Co.,3392 70B3D5C7A|ENTEC Electric & Electronic Co.,
@@ -3385,7 +3399,7 @@
3385 70B3D5C81|DSP DESIGN3399 70B3D5C81|DSP DESIGN
3386 70B3D5C82|Sicon srl3400 70B3D5C82|Sicon srl
3387 70B3D5C83|CertusNet Inc.3401 70B3D5C83|CertusNet Inc.
3388-70B3D5C84|Linc Technology Corporation dba3402+70B3D5C84|Linc Technology Corporation dba
3389 70B3D5C85|Solid State Disks Ltd3403 70B3D5C85|Solid State Disks Ltd
3390 70B3D5C86|Woodam Co., Ltd.3404 70B3D5C86|Woodam Co., Ltd.
3391 70B3D5C87|Siemens AG3405 70B3D5C87|Siemens AG
@@ -3402,7 +3416,7 @@
3402 70B3D5C92|Unitro Fleischmann3416 70B3D5C92|Unitro Fleischmann
3403 70B3D5C93|GMI Ltd3417 70B3D5C93|GMI Ltd
3404 70B3D5C94|Vars Technology3418 70B3D5C94|Vars Technology
3405-70B3D5C95|Chengdu Meihuan Technology Co.,3419+70B3D5C95|Chengdu Meihuan Technology Co.,
3406 70B3D5C96|UNI DIMENXI SDN BHD3420 70B3D5C96|UNI DIMENXI SDN BHD
3407 70B3D5C97|CSINFOTEL3421 70B3D5C97|CSINFOTEL
3408 70B3D5C98|Trust Automation3422 70B3D5C98|Trust Automation
@@ -3447,7 +3461,7 @@
3447 70B3D5CBF|Cubic ITS, Inc. dba GRIDSMART Te3461 70B3D5CBF|Cubic ITS, Inc. dba GRIDSMART Te
3448 70B3D5CC0|Avionica3462 70B3D5CC0|Avionica
3449 70B3D5CC1|BEEcube Inc.3463 70B3D5CC1|BEEcube Inc.
3450-70B3D5CC2|LSC Lighting Systems (Aust) Pty3464+70B3D5CC2|LSC Lighting Systems (Aust) Pty
3451 70B3D5CC3|Fidalia Networks Inc3465 70B3D5CC3|Fidalia Networks Inc
3452 70B3D5CC4|Benchmark Electronics BV3466 70B3D5CC4|Benchmark Electronics BV
3453 70B3D5CC5|Intecom3467 70B3D5CC5|Intecom
@@ -3519,6 +3533,7 @@
3519 70B3D5D07|Waversa Systems3533 70B3D5D07|Waversa Systems
3520 70B3D5D08|Veeco Instruments3534 70B3D5D08|Veeco Instruments
3521 70B3D5D09|Rishaad Brown3535 70B3D5D09|Rishaad Brown
3536+70B3D5D0A|Private
3522 70B3D5D0B|Vendanor AS3537 70B3D5D0B|Vendanor AS
3523 70B3D5D0C|Connor Winfield LTD3538 70B3D5D0C|Connor Winfield LTD
3524 70B3D5D0D|Logiwaste AB3539 70B3D5D0D|Logiwaste AB
@@ -3606,7 +3621,7 @@
3606 70B3D5D5F|Core Balance Co., Ltd.3621 70B3D5D5F|Core Balance Co., Ltd.
3607 70B3D5D60|Flintab AB3622 70B3D5D60|Flintab AB
3608 70B3D5D61|VITEC3623 70B3D5D61|VITEC
3609-70B3D5D62|Andasis Elektronik San. ve Tic.3624+70B3D5D62|Andasis Elektronik San. ve Tic.
3610 70B3D5D63|CRDE3625 70B3D5D63|CRDE
3611 70B3D5D64|Mettler Toledo3626 70B3D5D64|Mettler Toledo
3612 70B3D5D65|CRDE3627 70B3D5D65|CRDE
@@ -3730,7 +3745,7 @@
3730 70B3D5DDB|Intra Corporation3745 70B3D5DDB|Intra Corporation
3731 70B3D5DDC|Syscom Instruments SA3746 70B3D5DDC|Syscom Instruments SA
3732 70B3D5DDD|BIO RAD LABORATORIES3747 70B3D5DDD|BIO RAD LABORATORIES
3733-70B3D5DDE|Abbott Diagnostics Technologies3748+70B3D5DDE|Abbott Diagnostics Technologies
3734 70B3D5DDF|AeroVision Avionics, Inc.3749 70B3D5DDF|AeroVision Avionics, Inc.
3735 70B3D5DE0|eCozy GmbH3750 70B3D5DE0|eCozy GmbH
3736 70B3D5DE1|Duplomatic MS spa3751 70B3D5DE1|Duplomatic MS spa
@@ -3756,9 +3771,9 @@
3756 70B3D5DF5|Beijing Huanyu Zhilian Science &3771 70B3D5DF5|Beijing Huanyu Zhilian Science &
3757 70B3D5DF6|Tiab Limited3772 70B3D5DF6|Tiab Limited
3758 70B3D5DF7|ScopeSensor Oy3773 70B3D5DF7|ScopeSensor Oy
3759-70B3D5DF8|RMA Mess- und Regeltechnik GmbH3774+70B3D5DF8|RMA Mess- und Regeltechnik GmbH
3760 70B3D5DF9|Korea Plant Maintenance3775 70B3D5DF9|Korea Plant Maintenance
3761-70B3D5DFA|Newtouch Electronics (Shanghai)3776+70B3D5DFA|Newtouch Electronics (Shanghai)
3762 70B3D5DFB|Yamamoto Works Ltd.3777 70B3D5DFB|Yamamoto Works Ltd.
3763 70B3D5DFC|ELECTRONIC SYSTEMS DESIGN SPRL3778 70B3D5DFC|ELECTRONIC SYSTEMS DESIGN SPRL
3764 70B3D5DFD|Contiweb3779 70B3D5DFD|Contiweb
@@ -3840,7 +3855,7 @@
3840 70B3D5E49|Kendrion Mechatronics Center Gmb3855 70B3D5E49|Kendrion Mechatronics Center Gmb
3841 70B3D5E4A|ICP NewTech Ltd3856 70B3D5E4A|ICP NewTech Ltd
3842 70B3D5E4B|DELTA3857 70B3D5E4B|DELTA
3843-70B3D5E4C|IAI-Israel Aerospace Industries3858+70B3D5E4C|IAI-Israel Aerospace Industries
3844 70B3D5E4D|Vulcan Wireless Inc.3859 70B3D5E4D|Vulcan Wireless Inc.
3845 70B3D5E4E|Midfin Systems3860 70B3D5E4E|Midfin Systems
3846 70B3D5E4F|RWS Automation GmbH3861 70B3D5E4F|RWS Automation GmbH
@@ -3871,7 +3886,7 @@
3871 70B3D5E68|Transit Solutions, LLC.3886 70B3D5E68|Transit Solutions, LLC.
3872 70B3D5E69|Fire4 Systems UK Ltd3887 70B3D5E69|Fire4 Systems UK Ltd
3873 70B3D5E6A|MAC Solutions (UK) Ltd3888 70B3D5E6A|MAC Solutions (UK) Ltd
3874-70B3D5E6B|Shenzhen Shi Fang Communication3889+70B3D5E6B|Shenzhen Shi Fang Communication
3875 70B3D5E6C|Fusar Technologies inc3890 70B3D5E6C|Fusar Technologies inc
3876 70B3D5E6D|Domus S.C.3891 70B3D5E6D|Domus S.C.
3877 70B3D5E6E|Lieron BVBA3892 70B3D5E6E|Lieron BVBA
@@ -3887,7 +3902,7 @@
3887 70B3D5E78|Camwell India LLP3902 70B3D5E78|Camwell India LLP
3888 70B3D5E79|Acrodea, Inc.3903 70B3D5E79|Acrodea, Inc.
3889 70B3D5E7A|ART SPA3904 70B3D5E7A|ART SPA
3890-70B3D5E7B|Shenzhen SanYeCao Electronics3905+70B3D5E7B|Shenzhen SanYeCao Electronics
3891 70B3D5E7C|Aplex Technology Inc.3906 70B3D5E7C|Aplex Technology Inc.
3892 70B3D5E7D|Nanjing Dandick Science&technolo3907 70B3D5E7D|Nanjing Dandick Science&technolo
3893 70B3D5E7E|Groupe Citypassenger Inc3908 70B3D5E7E|Groupe Citypassenger Inc
@@ -3973,11 +3988,11 @@
3973 70B3D5ECE|COMM-connect A/S3988 70B3D5ECE|COMM-connect A/S
3974 70B3D5ECF|Ipitek3989 70B3D5ECF|Ipitek
3975 70B3D5ED0|shanghai qiaoqi zhinengkeji3990 70B3D5ED0|shanghai qiaoqi zhinengkeji
3976-70B3D5ED1|Przemyslowy Instytut Automatyki3991+70B3D5ED1|Przemyslowy Instytut Automatyki
3977 70B3D5ED2|PCTEL, Inc.3992 70B3D5ED2|PCTEL, Inc.
3978 70B3D5ED3|Beijing Lihong Create Co., Ltd.3993 70B3D5ED3|Beijing Lihong Create Co., Ltd.
3979 70B3D5ED4|WILMORE ELECTRONICS COMPANY3994 70B3D5ED4|WILMORE ELECTRONICS COMPANY
3980-70B3D5ED5|hangzhou battle link technology3995+70B3D5ED5|hangzhou battle link technology
3981 70B3D5ED6|Metrasens Limited3996 70B3D5ED6|Metrasens Limited
3982 70B3D5ED7|WAVE3997 70B3D5ED7|WAVE
3983 70B3D5ED8|Wartsila Voyage Oy3998 70B3D5ED8|Wartsila Voyage Oy
@@ -3999,7 +4014,7 @@
3999 70B3D5EE8|robert juliat4014 70B3D5EE8|robert juliat
4000 70B3D5EE9|SC3 Automation4015 70B3D5EE9|SC3 Automation
4001 70B3D5EEA|Dameca a/s4016 70B3D5EEA|Dameca a/s
4002-70B3D5EEB|shenzhen suofeixiang technology4017+70B3D5EEB|shenzhen suofeixiang technology
4003 70B3D5EEC|Impolux GmbH4018 70B3D5EEC|Impolux GmbH
4004 70B3D5EED|COMM-connect A/S4019 70B3D5EED|COMM-connect A/S
4005 70B3D5EEE|SOCIEDAD IBERICA DE CONSTRUCCION4020 70B3D5EEE|SOCIEDAD IBERICA DE CONSTRUCCION
@@ -4028,7 +4043,7 @@
4028 70B3D5F05|Motomuto Aps4043 70B3D5F05|Motomuto Aps
4029 70B3D5F06|WARECUBE,INC4044 70B3D5F06|WARECUBE,INC
4030 70B3D5F07|DUVAL MESSIEN4045 70B3D5F07|DUVAL MESSIEN
4031-70B3D5F08|Szabo Software & Engineering UK4046+70B3D5F08|Szabo Software & Engineering UK
4032 70B3D5F09|Mictrotrac Retsch GmbH4047 70B3D5F09|Mictrotrac Retsch GmbH
4033 70B3D5F0A|Neuronal Innovation Control S.L.4048 70B3D5F0A|Neuronal Innovation Control S.L.
4034 70B3D5F0B|RF Industries4049 70B3D5F0B|RF Industries
@@ -4036,7 +4051,7 @@
4036 70B3D5F0D|MeQ Inc.4051 70B3D5F0D|MeQ Inc.
4037 70B3D5F0E|TextSpeak Corporation4052 70B3D5F0E|TextSpeak Corporation
4038 70B3D5F0F|Kyoto Denkiki4053 70B3D5F0F|Kyoto Denkiki
4039-70B3D5F10|Riegl Laser Measurement Systems4054+70B3D5F10|Riegl Laser Measurement Systems
4040 70B3D5F11|BroadSoft Inc4055 70B3D5F11|BroadSoft Inc
4041 70B3D5F12|Incoil Induktion AB4056 70B3D5F12|Incoil Induktion AB
4042 70B3D5F13|MEDIAM Sp. z o.o.4057 70B3D5F13|MEDIAM Sp. z o.o.
@@ -4162,7 +4177,7 @@
4162 70B3D5F8B|IOOOTA Srl4177 70B3D5F8B|IOOOTA Srl
4163 70B3D5F8C|EUROPEAN ADVANCED TECHNOLOGIES4178 70B3D5F8C|EUROPEAN ADVANCED TECHNOLOGIES
4164 70B3D5F8D|Flextronics Canafa Design Servic4179 70B3D5F8D|Flextronics Canafa Design Servic
4165-70B3D5F8E|Isabellenhütte Heusler Gmbh &Co4180+70B3D5F8E|Isabellenhütte Heusler Gmbh &Co
4166 70B3D5F8F|DIMASTEC GESTAO DE PONTO E ACESS4181 70B3D5F8F|DIMASTEC GESTAO DE PONTO E ACESS
4167 70B3D5F90|Atman Tecnologia Ltda4182 70B3D5F90|Atman Tecnologia Ltda
4168 70B3D5F91|Solid State Disks Ltd4183 70B3D5F91|Solid State Disks Ltd
@@ -4274,6 +4289,8 @@
4274 70B3D5FFB|QUERCUS TECHNOLOGIES, S.L.4289 70B3D5FFB|QUERCUS TECHNOLOGIES, S.L.
4275 70B3D5FFC|Symetrics Industries d.b.a. Exta4290 70B3D5FFC|Symetrics Industries d.b.a. Exta
4276 70B3D5FFD|i2Systems4291 70B3D5FFD|i2Systems
4292+70B3D5FFE|Private
4293+70B3D5FFF|Private
4277 8C1F64000|Suzhou Xingxiangyi Precision Man4294 8C1F64000|Suzhou Xingxiangyi Precision Man
4278 8C1F64001|HYFIX Spatial Intelligence4295 8C1F64001|HYFIX Spatial Intelligence
4279 8C1F64003|Brighten Controls LLP4296 8C1F64003|Brighten Controls LLP
@@ -4376,7 +4393,7 @@
4376 8C1F64086|WEPTECH elektronik GmbH4393 8C1F64086|WEPTECH elektronik GmbH
4377 8C1F64087|Benchmark Electronics BV4394 8C1F64087|Benchmark Electronics BV
4378 8C1F64089|ANSER-NET CO ., LTD4395 8C1F64089|ANSER-NET CO ., LTD
4379-8C1F6408B|Shanghai Shenxu Technology Co.,4396+8C1F6408B|Shanghai Shenxu Technology Co.,
4380 8C1F6408C|eviateg GmbH4397 8C1F6408C|eviateg GmbH
4381 8C1F6408D|NEETRA SRL SB4398 8C1F6408D|NEETRA SRL SB
4382 8C1F6408E|qiio AG4399 8C1F6408E|qiio AG
@@ -4510,7 +4527,7 @@
4510 8C1F6413B|SDELcc4527 8C1F6413B|SDELcc
4511 8C1F6413C|SiFive Inc4528 8C1F6413C|SiFive Inc
4512 8C1F6413D|Inaba Techno Evolution Co.,Ltd4529 8C1F6413D|Inaba Techno Evolution Co.,Ltd
4513-8C1F6413E|BTEC INDUSTRIAL INSTRUMENT SDN.4530+8C1F6413E|BTEC INDUSTRIAL INSTRUMENT SDN.
4514 8C1F6413F|Elsist Srl4531 8C1F6413F|Elsist Srl
4515 8C1F64140|RF-Tuote Oy4532 8C1F64140|RF-Tuote Oy
4516 8C1F64141|Code Blue Corporation4533 8C1F64141|Code Blue Corporation
@@ -4557,7 +4574,8 @@
4557 8C1F6417E|MI Inc.4574 8C1F6417E|MI Inc.
4558 8C1F6417F|BCMTECH4575 8C1F6417F|BCMTECH
4559 8C1F64180|Structural Integrity Services4576 8C1F64180|Structural Integrity Services
4560-8C1F64183|NICE Total Cash Management Co.,4577+8C1F64182|Private
4578+8C1F64183|NICE Total Cash Management Co.,
4561 8C1F64184|GJD Manufacturing4579 8C1F64184|GJD Manufacturing
4562 8C1F64185|BIOTAGE GB LTD4580 8C1F64185|BIOTAGE GB LTD
4563 8C1F64186|Breas Medical AB4581 8C1F64186|Breas Medical AB
@@ -4647,7 +4665,7 @@
4647 8C1F64204|castcore4665 8C1F64204|castcore
4648 8C1F64205|Anuvu AB4666 8C1F64205|Anuvu AB
4649 8C1F64206|KRYFS TECHNOLOGIES PRIVATE LIMIT4667 8C1F64206|KRYFS TECHNOLOGIES PRIVATE LIMIT
4650-8C1F64208|Sichuan AnSphere Technology Co.4668+8C1F64208|Sichuan AnSphere Technology Co.
4651 8C1F6420A|Oriux4669 8C1F6420A|Oriux
4652 8C1F6420C|Shanghai Stairmed Technology Co.4670 8C1F6420C|Shanghai Stairmed Technology Co.
4653 8C1F6420D|Grossenbacher Systeme AG4671 8C1F6420D|Grossenbacher Systeme AG
@@ -4707,7 +4725,7 @@
4707 8C1F64261|TargaSystem S.r.L.4725 8C1F64261|TargaSystem S.r.L.
4708 8C1F64263|EPC Power Corporation4726 8C1F64263|EPC Power Corporation
4709 8C1F64264|BR. Voss Ingenjörsfirma AB4727 8C1F64264|BR. Voss Ingenjörsfirma AB
4710-8C1F64266|Guardian Controls International4728+8C1F64266|Guardian Controls International
4711 8C1F64267|Karl DUNGS GmbH & Co. KG4729 8C1F64267|Karl DUNGS GmbH & Co. KG
4712 8C1F64268|Astro Machine Corporation4730 8C1F64268|Astro Machine Corporation
4713 8C1F64269|Sicon srl4731 8C1F64269|Sicon srl
@@ -4737,7 +4755,7 @@
4737 8C1F6428B|Power Electronics Espana, S.L.4755 8C1F6428B|Power Electronics Espana, S.L.
4738 8C1F6428C|Sakura Seiki Co.,Ltd.4756 8C1F6428C|Sakura Seiki Co.,Ltd.
4739 8C1F6428D|AVA Monitoring AB4757 8C1F6428D|AVA Monitoring AB
4740-8C1F64290|UBIQ TECHNOLOGIES INTERNATIONAL4758+8C1F64290|UBIQ TECHNOLOGIES INTERNATIONAL
4741 8C1F64291|Jiangsu Ruidong Electric Power T4759 8C1F64291|Jiangsu Ruidong Electric Power T
4742 8C1F64292|Gogo Business Aviation4760 8C1F64292|Gogo Business Aviation
4743 8C1F64293|Landis+Gyr Equipamentos de Mediç4761 8C1F64293|Landis+Gyr Equipamentos de Mediç
@@ -4819,8 +4837,9 @@
4819 8C1F642FC|Unimar, Inc.4837 8C1F642FC|Unimar, Inc.
4820 8C1F642FD|Enestone Corporation4838 8C1F642FD|Enestone Corporation
4821 8C1F642FE|VERSITRON, Inc.4839 8C1F642FE|VERSITRON, Inc.
4822-8C1F64300|Abbott Diagnostics Technologies4840+8C1F64300|Abbott Diagnostics Technologies
4823 8C1F64301|Agar Corporation Inc.4841 8C1F64301|Agar Corporation Inc.
4842+8C1F64302|Brandmaier Messen, Steuern, Soft
4824 8C1F64303|IntelliPlanner Software System I4843 8C1F64303|IntelliPlanner Software System I
4825 8C1F64304|Jemac Sweden AB4844 8C1F64304|Jemac Sweden AB
4826 8C1F64305|VivoKey Technologies Inc.4845 8C1F64305|VivoKey Technologies Inc.
@@ -4847,10 +4866,10 @@
4847 8C1F64324|Kinetic Technologies4866 8C1F64324|Kinetic Technologies
4848 8C1F64326|Famas System S.p.A. Unipersonale4867 8C1F64326|Famas System S.p.A. Unipersonale
4849 8C1F64327|Deutescher Wetterdienst4868 8C1F64327|Deutescher Wetterdienst
4850-8C1F64328|Com Video Security Systems Co.,4869+8C1F64328|Com Video Security Systems Co.,
4851 8C1F64329|YUYAMA MFG Co.,Ltd4870 8C1F64329|YUYAMA MFG Co.,Ltd
4852 8C1F6432A|ABB4871 8C1F6432A|ABB
4853-8C1F6432B|Shenyang Taihua Technology Co.,4872+8C1F6432B|Shenyang Taihua Technology Co.,
4854 8C1F6432C|Taiko Audio B.V.4873 8C1F6432C|Taiko Audio B.V.
4855 8C1F6432E|Trineo Systems Sp. z o.o.4874 8C1F6432E|Trineo Systems Sp. z o.o.
4856 8C1F6432F|DEUTA Controls GmbH4875 8C1F6432F|DEUTA Controls GmbH
@@ -4897,7 +4916,7 @@
4897 8C1F6436B|ViewSonic Corp4916 8C1F6436B|ViewSonic Corp
4898 8C1F6436C|Scramble Tools LLC4917 8C1F6436C|Scramble Tools LLC
4899 8C1F6436D|WAVEBAND TECHNOLOGIES PVT LIMITE4918 8C1F6436D|WAVEBAND TECHNOLOGIES PVT LIMITE
4900-8C1F6436E|Abbott Diagnostics Technologies4919+8C1F6436E|Abbott Diagnostics Technologies
4901 8C1F6436F|SP MANUFACTURING PTE LTD4920 8C1F6436F|SP MANUFACTURING PTE LTD
4902 8C1F64370|WOLF Advanced Technology4921 8C1F64370|WOLF Advanced Technology
4903 8C1F64371|LIMAB AB4922 8C1F64371|LIMAB AB
@@ -4940,7 +4959,7 @@
4940 8C1F64398|Software Systems Plus4959 8C1F64398|Software Systems Plus
4941 8C1F6439A|Golding Audio Ltd4960 8C1F6439A|Golding Audio Ltd
4942 8C1F6439B|Deviceworx Technologies Inc.4961 8C1F6439B|Deviceworx Technologies Inc.
4943-8C1F6439E|Abbott Diagnostics Technologies4962+8C1F6439E|Abbott Diagnostics Technologies
4944 8C1F6439F|Guangzhou Beizeng Information Te4963 8C1F6439F|Guangzhou Beizeng Information Te
4945 8C1F643A0|Faraday4T4964 8C1F643A0|Faraday4T
4946 8C1F643A2|Kron Medidores4965 8C1F643A2|Kron Medidores
@@ -5001,6 +5020,7 @@
5001 8C1F643EC|SPEKTRA Schwingungstechnik und A5020 8C1F643EC|SPEKTRA Schwingungstechnik und A
5002 8C1F643ED|The Exploration Company5021 8C1F643ED|The Exploration Company
5003 8C1F643EE|BnB Information Technology5022 8C1F643EE|BnB Information Technology
5023+8C1F643F0|Supracontrol d.o.o.
5004 8C1F643F2|SURYA ELECTRONICS5024 8C1F643F2|SURYA ELECTRONICS
5005 8C1F643F3|Cambrian Works, Inc.5025 8C1F643F3|Cambrian Works, Inc.
5006 8C1F643F4|ACTELSER S.L.5026 8C1F643F4|ACTELSER S.L.
@@ -5012,6 +5032,7 @@
5012 8C1F643FE|Plum sp. z.o.o.5032 8C1F643FE|Plum sp. z.o.o.
5013 8C1F643FF|UISEE(SHANGHAI) AUTOMOTIVE TECHN5033 8C1F643FF|UISEE(SHANGHAI) AUTOMOTIVE TECHN
5014 8C1F64402|Integer.pl S.A.5034 8C1F64402|Integer.pl S.A.
5035+8C1F64405|Digital Way
5015 8C1F64406|ANDA TELECOM PVT LTD5036 8C1F64406|ANDA TELECOM PVT LTD
5016 8C1F64407|broadtek5037 8C1F64407|broadtek
5017 8C1F64408|techone system5038 8C1F64408|techone system
@@ -5039,7 +5060,7 @@
5039 8C1F64426|eumig industrie-TV GmbH.5060 8C1F64426|eumig industrie-TV GmbH.
5040 8C1F64427|MB connect line GmbH Fernwartung5061 8C1F64427|MB connect line GmbH Fernwartung
5041 8C1F64428|Greenerwave5062 8C1F64428|Greenerwave
5042-8C1F64429|Abbott Diagnostics Technologies5063+8C1F64429|Abbott Diagnostics Technologies
5043 8C1F6442A|Atonarp Inc.5064 8C1F6442A|Atonarp Inc.
5044 8C1F6442B|Gamber Johnson-LLC5065 8C1F6442B|Gamber Johnson-LLC
5045 8C1F6442D|Jemac Sweden AB5066 8C1F6442D|Jemac Sweden AB
@@ -5109,6 +5130,7 @@
5109 8C1F64489|HUPI5130 8C1F64489|HUPI
5110 8C1F6448B|Monnit Corporation5131 8C1F6448B|Monnit Corporation
5111 8C1F6448C|Electronic Equipment Company Pvt5132 8C1F6448C|Electronic Equipment Company Pvt
5133+8C1F6448D|Private
5112 8C1F6448F|Mecos AG5134 8C1F6448F|Mecos AG
5113 8C1F64490|SAMSON CO.,LTD.5135 8C1F64490|SAMSON CO.,LTD.
5114 8C1F64491|Phospec Industries Inc.5136 8C1F64491|Phospec Industries Inc.
@@ -5161,6 +5183,7 @@
5161 8C1F644D7|Flextronics International Kft5183 8C1F644D7|Flextronics International Kft
5162 8C1F644D9|SECURICO ELECTRONICS INDIA LTD5184 8C1F644D9|SECURICO ELECTRONICS INDIA LTD
5163 8C1F644DA|DTDS Technology Pte Ltd5185 8C1F644DA|DTDS Technology Pte Ltd
5186+8C1F644DB|Private
5164 8C1F644DC|BESO sp. z o.o.5187 8C1F644DC|BESO sp. z o.o.
5165 8C1F644DD|Griffyn Robotech Private Limited5188 8C1F644DD|Griffyn Robotech Private Limited
5166 8C1F644DF|EMRI5189 8C1F644DF|EMRI
@@ -5175,10 +5198,11 @@
5175 8C1F644EC|XOR UK Corporation Limited5198 8C1F644EC|XOR UK Corporation Limited
5176 8C1F644ED|VENTIONEX INNOVATIONS SDN BHD5199 8C1F644ED|VENTIONEX INNOVATIONS SDN BHD
5177 8C1F644F0|Tieline Research Pty Ltd5200 8C1F644F0|Tieline Research Pty Ltd
5178-8C1F644F1|Abbott Diagnostics Technologies5201+8C1F644F1|Abbott Diagnostics Technologies
5179 8C1F644F2|Automation Displays Inc.5202 8C1F644F2|Automation Displays Inc.
5180 8C1F644F4|Staco Energy Products5203 8C1F644F4|Staco Energy Products
5181 8C1F644F5|BSTsecurity5204 8C1F644F5|BSTsecurity
5205+8C1F644F6|Private
5182 8C1F644F7|SmartD Technologies Inc5206 8C1F644F7|SmartD Technologies Inc
5183 8C1F644F9|Photonic Science and Engineering5207 8C1F644F9|Photonic Science and Engineering
5184 8C1F644FA|Sanskruti5208 8C1F644FA|Sanskruti
@@ -5223,6 +5247,7 @@
5223 8C1F6452E|CLOUD TELECOM Inc.5247 8C1F6452E|CLOUD TELECOM Inc.
5224 8C1F64530|SIPazon AB5248 8C1F64530|SIPazon AB
5225 8C1F64531|EA Elektro-Automatik GmbH5249 8C1F64531|EA Elektro-Automatik GmbH
5250+8C1F64532|SEONGWON ENG CO.,LTD
5226 8C1F64533|Boeing India Private Limited5251 8C1F64533|Boeing India Private Limited
5227 8C1F64534|SURYA ELECTRONICS5252 8C1F64534|SURYA ELECTRONICS
5228 8C1F64535|Columbus McKinnon5253 8C1F64535|Columbus McKinnon
@@ -5277,7 +5302,7 @@
5277 8C1F6457B|Potter Electric Signal Co. LLC5302 8C1F6457B|Potter Electric Signal Co. LLC
5278 8C1F6457C|EA Elektro-Automatik GmbH5303 8C1F6457C|EA Elektro-Automatik GmbH
5279 8C1F6457D|ISDI Ltd5304 8C1F6457D|ISDI Ltd
5280-8C1F6457E|Guoqing (shangdong) Information5305+8C1F6457E|Guoqing (shangdong) Information
5281 8C1F64580|SAKURA SEIKI Co., Ltd.5306 8C1F64580|SAKURA SEIKI Co., Ltd.
5282 8C1F64581|SpectraDynamics, Inc.5307 8C1F64581|SpectraDynamics, Inc.
5283 8C1F64583|3Egreen tech. Co. Ltd.5308 8C1F64583|3Egreen tech. Co. Ltd.
@@ -5296,6 +5321,7 @@
5296 8C1F64597|Becton Dickinson5321 8C1F64597|Becton Dickinson
5297 8C1F64598|TIRASOFT TECHNOLOGY5322 8C1F64598|TIRASOFT TECHNOLOGY
5298 8C1F6459A|Primalucelab isrl5323 8C1F6459A|Primalucelab isrl
5324+8C1F6459C|Private
5299 8C1F6459D|CommBox Pty Ltd5325 8C1F6459D|CommBox Pty Ltd
5300 8C1F6459F|Delta Computers LLC.5326 8C1F6459F|Delta Computers LLC.
5301 8C1F645A0|SEONGWON ENG CO.,LTD5327 8C1F645A0|SEONGWON ENG CO.,LTD
@@ -5319,6 +5345,7 @@
5319 8C1F645B7|Vortex Sp. z o.o.5345 8C1F645B7|Vortex Sp. z o.o.
5320 8C1F645B9|ViewSonic Corp5346 8C1F645B9|ViewSonic Corp
5321 8C1F645BA|Connectcom System Co., Ltd5347 8C1F645BA|Connectcom System Co., Ltd
5348+8C1F645BB|Powell Electronics Inc.
5322 8C1F645BC|HEITEC AG5349 8C1F645BC|HEITEC AG
5323 8C1F645BD|MPT-Service project5350 8C1F645BD|MPT-Service project
5324 8C1F645BE|Benchmark Electronics BV5351 8C1F645BE|Benchmark Electronics BV
@@ -5328,7 +5355,7 @@
5328 8C1F645C5|Active Research Limited5355 8C1F645C5|Active Research Limited
5329 8C1F645C6|Systems With Intelligence Inc.5356 8C1F645C6|Systems With Intelligence Inc.
5330 8C1F645C8|WOTA Corp.5357 8C1F645C8|WOTA Corp.
5331-8C1F645C9|Abbott Diagnostics Technologies5358+8C1F645C9|Abbott Diagnostics Technologies
5332 8C1F645CA|Vitaltrace PTY LTD5359 8C1F645CA|Vitaltrace PTY LTD
5333 8C1F645CB|dinosys5360 8C1F645CB|dinosys
5334 8C1F645CC|Alpes recherche et développement5361 8C1F645CC|Alpes recherche et développement
@@ -5369,7 +5396,7 @@
5369 8C1F645FC|Lance Design LLC5396 8C1F645FC|Lance Design LLC
5370 8C1F645FE|Pneumax Spa5397 8C1F645FE|Pneumax Spa
5371 8C1F645FF|DAVE SRL5398 8C1F645FF|DAVE SRL
5372-8C1F64600|Anhui Chaokun Testing Equipment5399+8C1F64600|Anhui Chaokun Testing Equipment
5373 8C1F64601|Camius5400 8C1F64601|Camius
5374 8C1F64602|Power Electronics Espana, S.L.5401 8C1F64602|Power Electronics Espana, S.L.
5375 8C1F64603|Fuku Energy Technology Co., Ltd.5402 8C1F64603|Fuku Energy Technology Co., Ltd.
@@ -5456,6 +5483,7 @@
5456 8C1F64675|Transit Solutions, LLC.5483 8C1F64675|Transit Solutions, LLC.
5457 8C1F64676|sdt.net AG5484 8C1F64676|sdt.net AG
5458 8C1F64677|FREY S.J.5485 8C1F64677|FREY S.J.
5486+8C1F64679|Guangdong Gospower Electric Tech
5459 8C1F6467A|MG s.r.l.5487 8C1F6467A|MG s.r.l.
5460 8C1F6467B|Wi-DAS LLC5488 8C1F6467B|Wi-DAS LLC
5461 8C1F6467C|Ensto Protrol AB5489 8C1F6467C|Ensto Protrol AB
@@ -5467,7 +5495,7 @@
5467 8C1F64682|MB connect line GmbH5495 8C1F64682|MB connect line GmbH
5468 8C1F64683|SLAT5496 8C1F64683|SLAT
5469 8C1F64684|Potter Electric Signal Co. LLC5497 8C1F64684|Potter Electric Signal Co. LLC
5470-8C1F64685|Sanchar Wireless Communications5498+8C1F64685|Sanchar Wireless Communications
5471 8C1F64686|Pazzk5499 8C1F64686|Pazzk
5472 8C1F64687|Lamontec5500 8C1F64687|Lamontec
5473 8C1F64689|AUREKA SMART LIVING W.L.L5501 8C1F64689|AUREKA SMART LIVING W.L.L
@@ -5498,7 +5526,7 @@
5498 8C1F646AD|Potter Electric Signal Co. LLC5526 8C1F646AD|Potter Electric Signal Co. LLC
5499 8C1F646AE|Bray International5527 8C1F646AE|Bray International
5500 8C1F646B0|O-Net Technologies(Shenzhen)Grou5528 8C1F646B0|O-Net Technologies(Shenzhen)Grou
5501-8C1F646B1|Specialist Mechanical Engineers5529+8C1F646B1|Specialist Mechanical Engineers
5502 8C1F646B3|Feritech Ltd.5530 8C1F646B3|Feritech Ltd.
5503 8C1F646B5|O-Net Communications(Shenzhen)Li5531 8C1F646B5|O-Net Communications(Shenzhen)Li
5504 8C1F646B6|Engelmann Sensor GmbH5532 8C1F646B6|Engelmann Sensor GmbH
@@ -5517,7 +5545,7 @@
5517 8C1F646C8|Taiko Audio B.V.5545 8C1F646C8|Taiko Audio B.V.
5518 8C1F646CA|Melissa Climate Jsc5546 8C1F646CA|Melissa Climate Jsc
5519 8C1F646CB|GJD Manufacturing5547 8C1F646CB|GJD Manufacturing
5520-8C1F646CC|Newtouch Electronics (Shanghai)5548+8C1F646CC|Newtouch Electronics (Shanghai)
5521 8C1F646CD|Wuhan Xingtuxinke ELectronic Co.5549 8C1F646CD|Wuhan Xingtuxinke ELectronic Co.
5522 8C1F646CE|Potter Electric Signal Co. LLC5550 8C1F646CE|Potter Electric Signal Co. LLC
5523 8C1F646CF|Italora5551 8C1F646CF|Italora
@@ -5586,7 +5614,7 @@
5586 8C1F64726|DAVE SRL5614 8C1F64726|DAVE SRL
5587 8C1F64729|ZER01CHI Corporation5615 8C1F64729|ZER01CHI Corporation
5588 8C1F6472A|DORLET SAU5616 8C1F6472A|DORLET SAU
5589-8C1F6472B|Abbott Diagnostics Technologies5617+8C1F6472B|Abbott Diagnostics Technologies
5590 8C1F6472C|Antai technology Co.,Ltd5618 8C1F6472C|Antai technology Co.,Ltd
5591 8C1F6472D|Hills Health Solutions5619 8C1F6472D|Hills Health Solutions
5592 8C1F6472F|GMV Aerospace and Defence SAU5620 8C1F6472F|GMV Aerospace and Defence SAU
@@ -5670,7 +5698,7 @@
5670 8C1F6479E|Accemic Technologies GmbH5698 8C1F6479E|Accemic Technologies GmbH
5671 8C1F6479F|Hiwin Mikrosystem Corp.5699 8C1F6479F|Hiwin Mikrosystem Corp.
5672 8C1F647A0|Potter Electric Signal Co. LLC5700 8C1F647A0|Potter Electric Signal Co. LLC
5673-8C1F647A1|Guardian Controls International5701+8C1F647A1|Guardian Controls International
5674 8C1F647A3|Ibercomp SA5702 8C1F647A3|Ibercomp SA
5675 8C1F647A4|Hirotech inc.5703 8C1F647A4|Hirotech inc.
5676 8C1F647A5|Potter Electric Signal Co. LLC5704 8C1F647A5|Potter Electric Signal Co. LLC
@@ -5716,7 +5744,7 @@
5716 8C1F647DA|Xpti Tecnologias em Segurança Lt5744 8C1F647DA|Xpti Tecnologias em Segurança Lt
5717 8C1F647DB|Raco Universal Technology Co., L5745 8C1F647DB|Raco Universal Technology Co., L
5718 8C1F647DC|LINEAGE POWER PVT LTD.,5746 8C1F647DC|LINEAGE POWER PVT LTD.,
5719-8C1F647DD|TAKASAKI KYODO COMPUTING CENTER5747+8C1F647DD|TAKASAKI KYODO COMPUTING CENTER
5720 8C1F647DE|SOCNOC AI Inc5748 8C1F647DE|SOCNOC AI Inc
5721 8C1F647DF|Secury3605749 8C1F647DF|Secury360
5722 8C1F647E0|Colombo Sales & Engineering, Inc5750 8C1F647E0|Colombo Sales & Engineering, Inc
@@ -5726,7 +5754,7 @@
5726 8C1F647E4|Peter Huber Kaeltemaschinenbau S5754 8C1F647E4|Peter Huber Kaeltemaschinenbau S
5727 8C1F647E7|robert juliat5755 8C1F647E7|robert juliat
5728 8C1F647E8|EA Elektro-Automatik GmbH5756 8C1F647E8|EA Elektro-Automatik GmbH
5729-8C1F647EA|Abbott Diagnostics Technologies5757+8C1F647EA|Abbott Diagnostics Technologies
5730 8C1F647EC|Methods2Business B.V.5758 8C1F647EC|Methods2Business B.V.
5731 8C1F647ED|Eding CNC bv5759 8C1F647ED|Eding CNC bv
5732 8C1F647EE|Orange Precision Measurement LLC5760 8C1F647EE|Orange Precision Measurement LLC
@@ -5735,7 +5763,7 @@
5735 8C1F647F2|AT-Automation Technology GmbH5763 8C1F647F2|AT-Automation Technology GmbH
5736 8C1F647F3|Videosys Broadcast Ltd5764 8C1F647F3|Videosys Broadcast Ltd
5737 8C1F647F4|G.M. International srl5765 8C1F647F4|G.M. International srl
5738-8C1F647F6|Abbott Diagnostics Technologies5766+8C1F647F6|Abbott Diagnostics Technologies
5739 8C1F647F7|ADITUS GmbH5767 8C1F647F7|ADITUS GmbH
5740 8C1F647F8|FleetSafe India Private Limited5768 8C1F647F8|FleetSafe India Private Limited
5741 8C1F647F9|COPELION INTERNATIONAL INC5769 8C1F647F9|COPELION INTERNATIONAL INC
@@ -5776,6 +5804,7 @@
5776 8C1F64825|MTU Aero Engines AG5804 8C1F64825|MTU Aero Engines AG
5777 8C1F64827|Meisol Co., Ltd.5805 8C1F64827|Meisol Co., Ltd.
5778 8C1F64828|AURCORE TECHNOLOGY INC.5806 8C1F64828|AURCORE TECHNOLOGY INC.
5807+8C1F64829|Potter Electric Signal Company
5779 8C1F6482B|Flow Power5808 8C1F6482B|Flow Power
5780 8C1F6482C|Power Electronics Espana, S.L.5809 8C1F6482C|Power Electronics Espana, S.L.
5781 8C1F6482F|AnySignal5810 8C1F6482F|AnySignal
@@ -5815,15 +5844,16 @@
5815 8C1F6485C|Zing 5g Communications Canada In5844 8C1F6485C|Zing 5g Communications Canada In
5816 8C1F6485E|Apen Group S.p.A. (VAT IT0876775845 8C1F6485E|Apen Group S.p.A. (VAT IT087677
5817 8C1F6485F|NEC Asia Pacific Pte Ltd5846 8C1F6485F|NEC Asia Pacific Pte Ltd
5847+8C1F64860|Gogo BA
5818 8C1F64861|AvioNova (Chengdu) Technology Co5848 8C1F64861|AvioNova (Chengdu) Technology Co
5819 8C1F64863|EngiNe srl5849 8C1F64863|EngiNe srl
5820 8C1F64864|IMI Thomson Valves5850 8C1F64864|IMI Thomson Valves
5821 8C1F64866|Unitron Systems b.v.5851 8C1F64866|Unitron Systems b.v.
5822 8C1F64867|Forever Engineering Systems Pvt.5852 8C1F64867|Forever Engineering Systems Pvt.
5823 8C1F64868|SHENZHEN PEAKE TECHNOLOGY CO.,LT5853 8C1F64868|SHENZHEN PEAKE TECHNOLOGY CO.,LT
5824-8C1F6486A|VisionTools Bildanalyse Systeme5854+8C1F6486A|VisionTools Bildanalyse Systeme
5825 8C1F6486B|NYIEN-YI TECHNOLOGY(ZHUHAI)CO.,L5855 8C1F6486B|NYIEN-YI TECHNOLOGY(ZHUHAI)CO.,L
5826-8C1F6486C|Abbott Diagnostics Technologies5856+8C1F6486C|Abbott Diagnostics Technologies
5827 8C1F6486F|NewEdge Signal Solutions LLC5857 8C1F6486F|NewEdge Signal Solutions LLC
5828 8C1F64870|Chengdu Xiuwei TechnologyDevelop5858 8C1F64870|Chengdu Xiuwei TechnologyDevelop
5829 8C1F64871|ENTE Sp. z o.o.5859 8C1F64871|ENTE Sp. z o.o.
@@ -5838,6 +5868,7 @@
5838 8C1F64882|TMY TECHNOLOGY INC.5868 8C1F64882|TMY TECHNOLOGY INC.
5839 8C1F64883|DEUTA-WERKE GmbH5869 8C1F64883|DEUTA-WERKE GmbH
5840 8C1F64888|NARI TECH Co., Ltd5870 8C1F64888|NARI TECH Co., Ltd
5871+8C1F64889|Private
5841 8C1F6488A|Longoo Limited5872 8C1F6488A|Longoo Limited
5842 8C1F6488B|Taiwan Aulisa Medical Devices Te5873 8C1F6488B|Taiwan Aulisa Medical Devices Te
5843 8C1F6488C|SAL Navigation AB5874 8C1F6488C|SAL Navigation AB
@@ -5864,7 +5895,7 @@
5864 8C1F648AE|Shenzhen Qunfang Technology Co.,5895 8C1F648AE|Shenzhen Qunfang Technology Co.,
5865 8C1F648AF|Ibeos5896 8C1F648AF|Ibeos
5866 8C1F648B1|Viewpixel Pvt. Ltd.5897 8C1F648B1|Viewpixel Pvt. Ltd.
5867-8C1F648B2|Abbott Diagnostics Technologies5898+8C1F648B2|Abbott Diagnostics Technologies
5868 8C1F648B3|Hubbell Power Systems5899 8C1F648B3|Hubbell Power Systems
5869 8C1F648B4|MYIR Electronics Limited5900 8C1F648B4|MYIR Electronics Limited
5870 8C1F648B5|Ashton Bentley Collaboration Spa5901 8C1F648B5|Ashton Bentley Collaboration Spa
@@ -5909,7 +5940,7 @@
5909 8C1F648EB|Numa Products LLC5940 8C1F648EB|Numa Products LLC
5910 8C1F648EC|LMS Services GmbH & Co. KG5941 8C1F648EC|LMS Services GmbH & Co. KG
5911 8C1F648ED|QM Technologies aps5942 8C1F648ED|QM Technologies aps
5912-8C1F648EE|Abbott Diagnostics Technologies5943+8C1F648EE|Abbott Diagnostics Technologies
5913 8C1F648EF|Osec5944 8C1F648EF|Osec
5914 8C1F648F0|IGL5945 8C1F648F0|IGL
5915 8C1F648F3|EverBot Technology CO., LTD5946 8C1F648F3|EverBot Technology CO., LTD
@@ -5940,13 +5971,13 @@
5940 8C1F64913|Zeus Product Design Ltd5971 8C1F64913|Zeus Product Design Ltd
5941 8C1F64914|MITOMI GIKEN CO.,LTD5972 8C1F64914|MITOMI GIKEN CO.,LTD
5942 8C1F64916|Sept-S5973 8C1F64916|Sept-S
5943-8C1F64918|Abbott Diagnostics Technologies5974+8C1F64918|Abbott Diagnostics Technologies
5944 8C1F6491A|Profcon AB5975 8C1F6491A|Profcon AB
5945 8C1F6491B|Potter Electric Signal Co. LLC5976 8C1F6491B|Potter Electric Signal Co. LLC
5946 8C1F6491C|Cospowers Changsha Branch5977 8C1F6491C|Cospowers Changsha Branch
5947 8C1F6491D|enlighten5978 8C1F6491D|enlighten
5948 8C1F64920|VuWall Technology Europe GmbH5979 8C1F64920|VuWall Technology Europe GmbH
5949-8C1F64921|Abbott Diagnostics Technologies5980+8C1F64921|Abbott Diagnostics Technologies
5950 8C1F64923|MB connect line GmbH Fernwartung5981 8C1F64923|MB connect line GmbH Fernwartung
5951 8C1F64924|Magics Technologies5982 8C1F64924|Magics Technologies
5952 8C1F64926|MJK Automation AB5983 8C1F64926|MJK Automation AB
@@ -5985,6 +6016,7 @@
5985 8C1F6495B|Qualitel Corporation6016 8C1F6495B|Qualitel Corporation
5986 8C1F6495C|Fasetto, Inc.6017 8C1F6495C|Fasetto, Inc.
5987 8C1F6495E|Landis+Gyr Equipamentos de Mediç6018 8C1F6495E|Landis+Gyr Equipamentos de Mediç
6019+8C1F6495F|INVIXIUM ACCESS INC
5988 8C1F64961|JMV BHARAT PRIVATE LIMITED6020 8C1F64961|JMV BHARAT PRIVATE LIMITED
5989 8C1F64962|Umano Medical Inc.6021 8C1F64962|Umano Medical Inc.
5990 8C1F64963|Gogo Business Aviation6022 8C1F64963|Gogo Business Aviation
@@ -6043,9 +6075,10 @@
6043 8C1F649A9|TIAMA6075 8C1F649A9|TIAMA
6044 8C1F649AA|xTools Inc.6076 8C1F649AA|xTools Inc.
6045 8C1F649AB|DAVE SRL6077 8C1F649AB|DAVE SRL
6046-8C1F649AC|Hangzhou Jingtang Communication6078+8C1F649AC|Hangzhou Jingtang Communication
6047 8C1F649AD|Potter Electric Signal Co. LLC6079 8C1F649AD|Potter Electric Signal Co. LLC
6048 8C1F649AF|Advanced Mechatronics GmbH6080 8C1F649AF|Advanced Mechatronics GmbH
6081+8C1F649B0|Karman
6049 8C1F649B2|Emerson Rosemount Analytical6082 8C1F649B2|Emerson Rosemount Analytical
6050 8C1F649B3|Böckelt GmbH6083 8C1F649B3|Böckelt GmbH
6051 8C1F649B5|BERKELEY NUCLEONICS CORP6084 8C1F649B5|BERKELEY NUCLEONICS CORP
@@ -6142,7 +6175,7 @@
6142 8C1F64A36|DONGGUAN GAGO ELECTRONICS CO.,LT6175 8C1F64A36|DONGGUAN GAGO ELECTRONICS CO.,LT
6143 8C1F64A38|NuGrid Power6176 8C1F64A38|NuGrid Power
6144 8C1F64A39|MG s.r.l.6177 8C1F64A39|MG s.r.l.
6145-8C1F64A3B|Fujian Satlink Electronics Co.,6178+8C1F64A3B|Fujian Satlink Electronics Co.,
6146 8C1F64A3C|Talleres de Escoriaza SAU6179 8C1F64A3C|Talleres de Escoriaza SAU
6147 8C1F64A3E|Hiwin Mikrosystem Corp.6180 8C1F64A3E|Hiwin Mikrosystem Corp.
6148 8C1F64A3F|ViewSonic Corp6181 8C1F64A3F|ViewSonic Corp
@@ -6194,7 +6227,7 @@
6194 8C1F64A80|NEXTtec srl6227 8C1F64A80|NEXTtec srl
6195 8C1F64A81|3D perception AS6228 8C1F64A81|3D perception AS
6196 8C1F64A83|EkspertStroyProekt6229 8C1F64A83|EkspertStroyProekt
6197-8C1F64A84|Beijing Wenrise Technology Co.,6230+8C1F64A84|Beijing Wenrise Technology Co.,
6198 8C1F64A86|Global Design Tech(ZS) Co.,Ltd6231 8C1F64A86|Global Design Tech(ZS) Co.,Ltd
6199 8C1F64A87|Morgen Technology6232 8C1F64A87|Morgen Technology
6200 8C1F64A88|ResIOT UBLSOFTWARE SRL6233 8C1F64A88|ResIOT UBLSOFTWARE SRL
@@ -6209,7 +6242,7 @@
6209 8C1F64A95|Sentek Pty Ltd6242 8C1F64A95|Sentek Pty Ltd
6210 8C1F64A97|Integer.pl S.A.6243 8C1F64A97|Integer.pl S.A.
6211 8C1F64A98|Jacobs Technology, Inc.6244 8C1F64A98|Jacobs Technology, Inc.
6212-8C1F64A9A|Signasystems Elektronik San. ve6245+8C1F64A9A|Signasystems Elektronik San. ve
6213 8C1F64A9B|Ovide Maudet SL6246 8C1F64A9B|Ovide Maudet SL
6214 8C1F64A9C|Upstart Power6247 8C1F64A9C|Upstart Power
6215 8C1F64A9D|Aegex Technologies LLC Magyarors6248 8C1F64A9D|Aegex Technologies LLC Magyarors
@@ -6263,6 +6296,7 @@
6263 8C1F64AE0|ASTER PRO-AUDIO INC.6296 8C1F64AE0|ASTER PRO-AUDIO INC.
6264 8C1F64AE1|YUYAMA MFG Co.,Ltd6297 8C1F64AE1|YUYAMA MFG Co.,Ltd
6265 8C1F64AE2|Jiangsu Yi Rong Mstar Technology6298 8C1F64AE2|Jiangsu Yi Rong Mstar Technology
6299+8C1F64AE3|Private
6266 8C1F64AE5|Ltec Co.,Ltd6300 8C1F64AE5|Ltec Co.,Ltd
6267 8C1F64AE8|ADETEC SAS6301 8C1F64AE8|ADETEC SAS
6268 8C1F64AE9|ENNPLE6302 8C1F64AE9|ENNPLE
@@ -6294,6 +6328,7 @@
6294 8C1F64B0E|Watthour Engineering Co., Inc.6328 8C1F64B0E|Watthour Engineering Co., Inc.
6295 8C1F64B0F|HKC Security Ltd.6329 8C1F64B0F|HKC Security Ltd.
6296 8C1F64B10|MTU Aero Engines AG6330 8C1F64B10|MTU Aero Engines AG
6331+8C1F64B11|RFTEQ PTY LTD
6297 8C1F64B12|Hongtai Intelligent Technology6332 8C1F64B12|Hongtai Intelligent Technology
6298 8C1F64B13|Abode Systems Inc6333 8C1F64B13|Abode Systems Inc
6299 8C1F64B14|Murata Manufacturing CO., Ltd.6334 8C1F64B14|Murata Manufacturing CO., Ltd.
@@ -6318,7 +6353,7 @@
6318 8C1F64B2C|SANMINA ISRAEL MEDICAL SYSTEMS L6353 8C1F64B2C|SANMINA ISRAEL MEDICAL SYSTEMS L
6319 8C1F64B2D|wonder meditec6354 8C1F64B2D|wonder meditec
6320 8C1F64B2E|Grossenbacher Systeme AG6355 8C1F64B2E|Grossenbacher Systeme AG
6321-8C1F64B2F|Mtechnology - Gamma Commerciale6356+8C1F64B2F|Mtechnology - Gamma Commerciale
6322 8C1F64B30|Fujian ONETHING Technology Co.,L6357 8C1F64B30|Fujian ONETHING Technology Co.,L
6323 8C1F64B31|RSC6358 8C1F64B31|RSC
6324 8C1F64B32|Plug Power6359 8C1F64B32|Plug Power
@@ -6336,6 +6371,7 @@
6336 8C1F64B46|PHYGITALL SOLUÇÕES EM INTERNET D6371 8C1F64B46|PHYGITALL SOLUÇÕES EM INTERNET D
6337 8C1F64B47|LINEAGE POWER PVT LTD.,6372 8C1F64B47|LINEAGE POWER PVT LTD.,
6338 8C1F64B4C|Picocom Technology Ltd6373 8C1F64B4C|Picocom Technology Ltd
6374+8C1F64B4D|OTODO
6339 8C1F64B4E|Aditec GmbH6375 8C1F64B4E|Aditec GmbH
6340 8C1F64B4F|Vaunix Technology Corporation6376 8C1F64B4F|Vaunix Technology Corporation
6341 8C1F64B50|Kinemetrics, Inc.6377 8C1F64B50|Kinemetrics, Inc.
@@ -6373,6 +6409,7 @@
6373 8C1F64B7C|EVERNET CO,.LTD TAIWAN6409 8C1F64B7C|EVERNET CO,.LTD TAIWAN
6374 8C1F64B7D|Scheurich GmbH6410 8C1F64B7D|Scheurich GmbH
6375 8C1F64B7E|Maven Pet Inc6411 8C1F64B7E|Maven Pet Inc
6412+8C1F64B80|Private
6376 8C1F64B81|Prolife Equipamentos Médicos Ltd6413 8C1F64B81|Prolife Equipamentos Médicos Ltd
6377 8C1F64B82|Seed Core Co., LTD.6414 8C1F64B82|Seed Core Co., LTD.
6378 8C1F64B83|ShenZhen Australis Electronic Te6415 8C1F64B83|ShenZhen Australis Electronic Te
@@ -6389,6 +6426,7 @@
6389 8C1F64B91|CLEALINK TECHNOLOGY6426 8C1F64B91|CLEALINK TECHNOLOGY
6390 8C1F64B92|Neurable6427 8C1F64B92|Neurable
6391 8C1F64B93|Modern Server Solutions LLP6428 8C1F64B93|Modern Server Solutions LLP
6429+8C1F64B94|Private
6392 8C1F64B96|Observable Space6430 8C1F64B96|Observable Space
6393 8C1F64B97|Gemini Electronics B.V.6431 8C1F64B97|Gemini Electronics B.V.
6394 8C1F64B98|Calamity, Inc.6432 8C1F64B98|Calamity, Inc.
@@ -6465,7 +6503,7 @@
6465 8C1F64BEF|Triumph SEC6503 8C1F64BEF|Triumph SEC
6466 8C1F64BF0|Newtec A/S6504 8C1F64BF0|Newtec A/S
6467 8C1F64BF1|Soha Jin6505 8C1F64BF1|Soha Jin
6468-8C1F64BF2|YUJUN ELECTRICITY INDUSTRY CO.,6506+8C1F64BF2|YUJUN ELECTRICITY INDUSTRY CO.,
6469 8C1F64BF3|Alphatek AS6507 8C1F64BF3|Alphatek AS
6470 8C1F64BF4|Fluid Components Intl6508 8C1F64BF4|Fluid Components Intl
6471 8C1F64BF5|The Urban Jungle Project6509 8C1F64BF5|The Urban Jungle Project
@@ -6488,9 +6526,10 @@
6488 8C1F64C09|S.E.I. CO.,LTD.6526 8C1F64C09|S.E.I. CO.,LTD.
6489 8C1F64C0A|ACROLABS,INC6527 8C1F64C0A|ACROLABS,INC
6490 8C1F64C0C|GIORDANO CONTROLS SPA6528 8C1F64C0C|GIORDANO CONTROLS SPA
6491-8C1F64C0D|Abbott Diagnostics Technologies6529+8C1F64C0D|Abbott Diagnostics Technologies
6492 8C1F64C0E|Goodtech AS dep Fredrikstad6530 8C1F64C0E|Goodtech AS dep Fredrikstad
6493 8C1F64C0F|KONAX BV6531 8C1F64C0F|KONAX BV
6532+8C1F64C11|Private
6494 8C1F64C12|PHYSEC GmbH6533 8C1F64C12|PHYSEC GmbH
6495 8C1F64C13|Glucoloop AG6534 8C1F64C13|Glucoloop AG
6496 8C1F64C16|ALISONIC SRL6535 8C1F64C16|ALISONIC SRL
@@ -6522,13 +6561,14 @@
6522 8C1F64C3A|YUSUR Technology Co., Ltd.6561 8C1F64C3A|YUSUR Technology Co., Ltd.
6523 8C1F64C3E|ISMA Microsolutions INC6562 8C1F64C3E|ISMA Microsolutions INC
6524 8C1F64C3F|SONIC CORPORATION6563 8C1F64C3F|SONIC CORPORATION
6525-8C1F64C40|Sciospec Scientific Instruments6564+8C1F64C40|Sciospec Scientific Instruments
6526 8C1F64C41|Katronic AG & Co. KG6565 8C1F64C41|Katronic AG & Co. KG
6527 8C1F64C42|SD OPTICS6566 8C1F64C42|SD OPTICS
6528 8C1F64C43|SHENZHEN SMARTLOG TECHNOLOGIES C6567 8C1F64C43|SHENZHEN SMARTLOG TECHNOLOGIES C
6529 8C1F64C44|Sypris Electronics6568 8C1F64C44|Sypris Electronics
6530 8C1F64C45|Flextroincs International (Taiwa6569 8C1F64C45|Flextroincs International (Taiwa
6531 8C1F64C46|Inex Technologies6570 8C1F64C46|Inex Technologies
6571+8C1F64C47|Season Electronics Ltd
6532 8C1F64C48|AK Automation6572 8C1F64C48|AK Automation
6533 8C1F64C4A|SGi Technology Group Ltd.6573 8C1F64C4A|SGi Technology Group Ltd.
6534 8C1F64C4C|Lumiplan Duhamel6574 8C1F64C4C|Lumiplan Duhamel
@@ -6536,7 +6576,7 @@
6536 8C1F64C4E|iCE-Intelligent Controlled Envir6576 8C1F64C4E|iCE-Intelligent Controlled Envir
6537 8C1F64C50|Spacee6577 8C1F64C50|Spacee
6538 8C1F64C51|EPC Energy Inc6578 8C1F64C51|EPC Energy Inc
6539-8C1F64C52|Invendis Technologies India Pvt6579+8C1F64C52|Invendis Technologies India Pvt
6540 8C1F64C53|Clockwork Dog6580 8C1F64C53|Clockwork Dog
6541 8C1F64C54|First Mode6581 8C1F64C54|First Mode
6542 8C1F64C56|Eridan6582 8C1F64C56|Eridan
@@ -6546,6 +6586,7 @@
6546 8C1F64C5B|TCL OPERATIONS POLSKA SP. Z O.O.6586 8C1F64C5B|TCL OPERATIONS POLSKA SP. Z O.O.
6547 8C1F64C5D|Alfa Proxima d.o.o.6587 8C1F64C5D|Alfa Proxima d.o.o.
6548 8C1F64C5E|YUYAMA MFG Co.,Ltd6588 8C1F64C5E|YUYAMA MFG Co.,Ltd
6589+8C1F64C5F|Unitron Systems b.v.
6549 8C1F64C60|Intelligent Security Systems (IS6590 8C1F64C60|Intelligent Security Systems (IS
6550 8C1F64C61|Beijing Ceresdate Technology Co.6591 8C1F64C61|Beijing Ceresdate Technology Co.
6551 8C1F64C62|GMI Ltd6592 8C1F64C62|GMI Ltd
@@ -6561,7 +6602,7 @@
6561 8C1F64C70|INVIXIUM ACCESS INC6602 8C1F64C70|INVIXIUM ACCESS INC
6562 8C1F64C71|Yaviar LLC6603 8C1F64C71|Yaviar LLC
6563 8C1F64C74|Nippon Techno Lab Inc6604 8C1F64C74|Nippon Techno Lab Inc
6564-8C1F64C75|Abbott Diagnostics Technologies6605+8C1F64C75|Abbott Diagnostics Technologies
6565 8C1F64C77|VNET Corp.6606 8C1F64C77|VNET Corp.
6566 8C1F64C78|POLON-ALFA S.A.6607 8C1F64C78|POLON-ALFA S.A.
6567 8C1F64C79|P3LAB6608 8C1F64C79|P3LAB
@@ -6602,7 +6643,7 @@
6602 8C1F64CAD|General Motors6643 8C1F64CAD|General Motors
6603 8C1F64CAE|Ophir Manufacturing Solutions Pt6644 8C1F64CAE|Ophir Manufacturing Solutions Pt
6604 8C1F64CAF|BRS Sistemas Eletrônicos6645 8C1F64CAF|BRS Sistemas Eletrônicos
6605-8C1F64CB1|Xi’an Sunway Communication Co.,6646+8C1F64CB1|Xi’an Sunway Communication Co.,
6606 8C1F64CB2|Dyncir Soluções Tecnológicas Ltd6647 8C1F64CB2|Dyncir Soluções Tecnológicas Ltd
6607 8C1F64CB3|DELO Industrie Klebstoffe GmbH &6648 8C1F64CB3|DELO Industrie Klebstoffe GmbH &
6608 8C1F64CB4|Wi4B s.r.l.6649 8C1F64CB4|Wi4B s.r.l.
@@ -6629,7 +6670,7 @@
6629 8C1F64CD4|Shengli Technologies6670 8C1F64CD4|Shengli Technologies
6630 8C1F64CD5|Dynamic Intelligences Co., Ltd.6671 8C1F64CD5|Dynamic Intelligences Co., Ltd.
6631 8C1F64CD6|USM Pty Ltd6672 8C1F64CD6|USM Pty Ltd
6632-8C1F64CD7|Embedded Designs Services India6673+8C1F64CD7|Embedded Designs Services India
6633 8C1F64CD8|Gogo Business Aviation6674 8C1F64CD8|Gogo Business Aviation
6634 8C1F64CD9|Fingoti Limited6675 8C1F64CD9|Fingoti Limited
6635 8C1F64CDA|SPX Flow Technology BV6676 8C1F64CDA|SPX Flow Technology BV
@@ -6639,9 +6680,10 @@
6639 8C1F64CE0|Potter Electric Signal Co. LLC6680 8C1F64CE0|Potter Electric Signal Co. LLC
6640 8C1F64CE3|Pixel Design & Manufacturing Sdn6681 8C1F64CE3|Pixel Design & Manufacturing Sdn
6641 8C1F64CE4|SL USA, LLC6682 8C1F64CE4|SL USA, LLC
6683+8C1F64CE5|Private
6642 8C1F64CE9|Landis+Gyr Equipamentos de Mediç6684 8C1F64CE9|Landis+Gyr Equipamentos de Mediç
6643 8C1F64CEA|Mootek Technologies Private Limi6685 8C1F64CEA|Mootek Technologies Private Limi
6644-8C1F64CEB|EUREKA FOR SMART PROPERTIES CO.6686+8C1F64CEB|EUREKA FOR SMART PROPERTIES CO.
6645 8C1F64CEC|Zhuhai Huaya machinery Technolog6687 8C1F64CEC|Zhuhai Huaya machinery Technolog
6646 8C1F64CED|NHA TRANG HITECH COMPANY, LTD6688 8C1F64CED|NHA TRANG HITECH COMPANY, LTD
6647 8C1F64CEE|DISPLAX S.A.6689 8C1F64CEE|DISPLAX S.A.
@@ -6656,7 +6698,7 @@
6656 8C1F64CF9|VeoTech6698 8C1F64CF9|VeoTech
6657 8C1F64CFA|YUYAMA MFG Co.,Ltd6699 8C1F64CFA|YUYAMA MFG Co.,Ltd
6658 8C1F64CFB|YUYAMA MFG Co.,Ltd6700 8C1F64CFB|YUYAMA MFG Co.,Ltd
6659-8C1F64CFC|Abbott Diagnostics Technologies6701+8C1F64CFC|Abbott Diagnostics Technologies
6660 8C1F64CFD|Smart-VOD Pty Ltd6702 8C1F64CFD|Smart-VOD Pty Ltd
6661 8C1F64CFE|Instrument Development Group (ID6703 8C1F64CFE|Instrument Development Group (ID
6662 8C1F64D00|POLAK CZ s.r.o.6704 8C1F64D00|POLAK CZ s.r.o.
@@ -6689,6 +6731,7 @@
6689 8C1F64D23|PLX Inc.6731 8C1F64D23|PLX Inc.
6690 8C1F64D24|R3 IoT Ltd.6732 8C1F64D24|R3 IoT Ltd.
6691 8C1F64D25|therlys GmbH6733 8C1F64D25|therlys GmbH
6734+8C1F64D26|Private
6692 8C1F64D27|Taiv Inc6735 8C1F64D27|Taiv Inc
6693 8C1F64D28|MapleCloud Technologies6736 8C1F64D28|MapleCloud Technologies
6694 8C1F64D29|Secure Bits6737 8C1F64D29|Secure Bits
@@ -6701,7 +6744,7 @@
6701 8C1F64D34|KRONOTECH SRL6744 8C1F64D34|KRONOTECH SRL
6702 8C1F64D35|Xi'an Biangu Information Technol6745 8C1F64D35|Xi'an Biangu Information Technol
6703 8C1F64D36|RF Code Inc6746 8C1F64D36|RF Code Inc
6704-8C1F64D38|CUU LONG TECHNOLOGY AND TRADING6747+8C1F64D38|CUU LONG TECHNOLOGY AND TRADING
6705 8C1F64D3A|Applied Materials6748 8C1F64D3A|Applied Materials
6706 8C1F64D3B|Gogo BA6749 8C1F64D3B|Gogo BA
6707 8C1F64D3C|KIB Energo LLC6750 8C1F64D3C|KIB Energo LLC
@@ -6710,6 +6753,7 @@
6710 8C1F64D42|YUYAMA MFG Co.,Ltd6753 8C1F64D42|YUYAMA MFG Co.,Ltd
6711 8C1F64D44|Monarch Instrument6754 8C1F64D44|Monarch Instrument
6712 8C1F64D46|End 2 End Technologies6755 8C1F64D46|End 2 End Technologies
6756+8C1F64D48|Private
6713 8C1F64D49|FUTURE LIFE TECHNOLOGY6757 8C1F64D49|FUTURE LIFE TECHNOLOGY
6714 8C1F64D4A|Caproc Oy6758 8C1F64D4A|Caproc Oy
6715 8C1F64D4D|Liburdi Dimetrics Corp.6759 8C1F64D4D|Liburdi Dimetrics Corp.
@@ -6741,6 +6785,7 @@
6741 8C1F64D73|BRS Sistemas Eletrônicos6785 8C1F64D73|BRS Sistemas Eletrônicos
6742 8C1F64D74|TEX COMPUTER SRL6786 8C1F64D74|TEX COMPUTER SRL
6743 8C1F64D75|Falling Edge Technology Ltd6787 8C1F64D75|Falling Edge Technology Ltd
6788+8C1F64D77|Private
6744 8C1F64D78|Hunan Oushi Electronic Technolog6789 8C1F64D78|Hunan Oushi Electronic Technolog
6745 8C1F64D7B|Global Design Solutions Korea6790 8C1F64D7B|Global Design Solutions Korea
6746 8C1F64D7C|QUERCUS TECHNOLOGIES, S.L.6791 8C1F64D7C|QUERCUS TECHNOLOGIES, S.L.
@@ -6786,10 +6831,10 @@
6786 8C1F64DB4|MB connect line GmbH6831 8C1F64DB4|MB connect line GmbH
6787 8C1F64DB5|victtron6832 8C1F64DB5|victtron
6788 8C1F64DB7|Lambda Systems Inc.6833 8C1F64DB7|Lambda Systems Inc.
6789-8C1F64DB8|Beijing Dangong Technology Co.,6834+8C1F64DB8|Beijing Dangong Technology Co.,
6790 8C1F64DB9|Ermes Elettronica s.r.l.6835 8C1F64DB9|Ermes Elettronica s.r.l.
6791 8C1F64DBA|Electronic Equipment Company Pvt6836 8C1F64DBA|Electronic Equipment Company Pvt
6792-8C1F64DBB|Würth Elektronik ICS GmbH & Co.6837+8C1F64DBB|Würth Elektronik ICS GmbH & Co.
6793 8C1F64DBD|GIORDANO CONTROLS SPA6838 8C1F64DBD|GIORDANO CONTROLS SPA
6794 8C1F64DBF|Rugged Controls6839 8C1F64DBF|Rugged Controls
6795 8C1F64DC0|Pigs Can Fly Labs LLC6840 8C1F64DC0|Pigs Can Fly Labs LLC
@@ -6810,16 +6855,16 @@
6810 8C1F64DD4|Midlands Technical Co., Ltd.6855 8C1F64DD4|Midlands Technical Co., Ltd.
6811 8C1F64DD5|Cardinal Scales Manufacturing Co6856 8C1F64DD5|Cardinal Scales Manufacturing Co
6812 8C1F64DD7|KST technology6857 8C1F64DD7|KST technology
6813-8C1F64DD9|Abbott Diagnostics Technologies6858+8C1F64DD9|Abbott Diagnostics Technologies
6814 8C1F64DDB|Efficient Residential Heating Gm6859 8C1F64DDB|Efficient Residential Heating Gm
6815 8C1F64DDD|Irmos Technologies AG6860 8C1F64DDD|Irmos Technologies AG
6816 8C1F64DDE|Jemac Sweden AB6861 8C1F64DDE|Jemac Sweden AB
6817-8C1F64DE0|BorgWarner Engineering Services6862+8C1F64DE0|BorgWarner Engineering Services
6818 8C1F64DE1|Franke Aquarotter GmbH6863 8C1F64DE1|Franke Aquarotter GmbH
6819 8C1F64DE2|Softgent sp. z o.o.6864 8C1F64DE2|Softgent sp. z o.o.
6820 8C1F64DE5|Gogo Business Aviation6865 8C1F64DE5|Gogo Business Aviation
6821 8C1F64DE6|IHI Inspection & Instrumentation6866 8C1F64DE6|IHI Inspection & Instrumentation
6822-8C1F64DE7|Guangzhou Mofiu Technology Co.,6867+8C1F64DE7|Guangzhou Mofiu Technology Co.,
6823 8C1F64DE9|EON Technology, Corp6868 8C1F64DE9|EON Technology, Corp
6824 8C1F64DEA|Natron Energy6869 8C1F64DEA|Natron Energy
6825 8C1F64DEB|PXM Marek Zupnik spolka komandyt6870 8C1F64DEB|PXM Marek Zupnik spolka komandyt
@@ -6949,6 +6994,7 @@
6949 8C1F64E9F|Lumiplan Duhamel6994 8C1F64E9F|Lumiplan Duhamel
6950 8C1F64EA0|OXY TECHNOLOGY USA LLC6995 8C1F64EA0|OXY TECHNOLOGY USA LLC
6951 8C1F64EA2|Vision Systems Safety Tech6996 8C1F64EA2|Vision Systems Safety Tech
6997+8C1F64EA3|Newtouch Electronics (Shanghai)
6952 8C1F64EA6|Dial Plan Limited6998 8C1F64EA6|Dial Plan Limited
6953 8C1F64EA8|Zumbach Electronic AG6999 8C1F64EA8|Zumbach Electronic AG
6954 8C1F64EAA|KB Modul, LLC7000 8C1F64EAA|KB Modul, LLC
@@ -6993,7 +7039,7 @@
6993 8C1F64EDF|Xlera Solutions, LLC7039 8C1F64EDF|Xlera Solutions, LLC
6994 8C1F64EE0|CEM Ltd7040 8C1F64EE0|CEM Ltd
6995 8C1F64EE1|PuS GmbH und Co. KG7041 8C1F64EE1|PuS GmbH und Co. KG
6996-8C1F64EE3|SICHUAN HUACUN ZHIGU TECHNOLOGY7042+8C1F64EE3|SICHUAN HUACUN ZHIGU TECHNOLOGY
6997 8C1F64EE6|LYNKX7043 8C1F64EE6|LYNKX
6998 8C1F64EE8|Global Organ Group B.V.7044 8C1F64EE8|Global Organ Group B.V.
6999 8C1F64EE9|Intect AG7045 8C1F64EE9|Intect AG
@@ -7135,6 +7181,7 @@
7135 8C1F64FAA|Massar Networks7181 8C1F64FAA|Massar Networks
7136 8C1F64FAB|LIAN Corporation7182 8C1F64FAB|LIAN Corporation
7137 8C1F64FAC|Showa Electric Laboratory co.,lt7183 8C1F64FAC|Showa Electric Laboratory co.,lt
7184+8C1F64FAD|LOOKMAN DISTRIBUTION PVT.LTD
7138 8C1F64FAF|Goodtech Worldwide LTD ,,mobitel7185 8C1F64FAF|Goodtech Worldwide LTD ,,mobitel
7139 8C1F64FB0|MARIAN GmbH7186 8C1F64FB0|MARIAN GmbH
7140 8C1F64FB1|ABB7187 8C1F64FB1|ABB
@@ -7143,7 +7190,7 @@
7143 8C1F64FB5|Bavaria Digital Technik GmbH7190 8C1F64FB5|Bavaria Digital Technik GmbH
7144 8C1F64FB6|Racelogic Ltd7191 8C1F64FB6|Racelogic Ltd
7145 8C1F64FB7|Grace Design/Lunatec LLC7192 8C1F64FB7|Grace Design/Lunatec LLC
7146-8C1F64FB8|Abbott Diagnostics Technologies7193+8C1F64FB8|Abbott Diagnostics Technologies
7147 8C1F64FB9|IWS Global Pty Ltd7194 8C1F64FB9|IWS Global Pty Ltd
7148 8C1F64FBA|Onto Innovation7195 8C1F64FBA|Onto Innovation
7149 8C1F64FBB|Telica7196 8C1F64FBB|Telica
@@ -7159,7 +7206,7 @@
7159 8C1F64FC8|Metaphase Technologies7206 8C1F64FC8|Metaphase Technologies
7160 8C1F64FCA|Elektrotechnik & Elektronik Oltm7207 8C1F64FCA|Elektrotechnik & Elektronik Oltm
7161 8C1F64FCC|GREDMANN TAIWAN LTD.7208 8C1F64FCC|GREDMANN TAIWAN LTD.
7162-8C1F64FCD|elbit systems - EW and sigint -7209+8C1F64FCD|elbit systems - EW and sigint -
7163 8C1F64FD0|Near Earth Autonomy7210 8C1F64FD0|Near Earth Autonomy
7164 8C1F64FD1|Edgeware AB7211 8C1F64FD1|Edgeware AB
7165 8C1F64FD2|Guo He Xing Ke (ShenZhen) Techno7212 8C1F64FD2|Guo He Xing Ke (ShenZhen) Techno
@@ -7194,4 +7241,4 @@
7194 8C1F64FF8|Chamsys Ltd7241 8C1F64FF8|Chamsys Ltd
7195 8C1F64FF9|Vtron Pty Ltd7242 8C1F64FF9|Vtron Pty Ltd
7196 8C1F64FFB|Taicang T&W Electronics7243 8C1F64FFB|Taicang T&W Electronics
7197-8C1F64FFC|Invendis Technologies India Pvt7244+8C1F64FFC|Invendis Technologies India Pvt
src/deauth.rsmodified+0 -28
@@ -16,8 +16,6 @@ use crate::dot11::build_deauth;
16 use crate::radiotap::INJECT_HDR;16 use crate::radiotap::INJECT_HDR;
17 use crate::rawsock::RawSocket;17 use crate::rawsock::RawSocket;
18 18
19-pub const REASON_UNSPECIFIED: u16 = 1;
20-pub const REASON_CLASS2: u16 = 6;
21 pub const REASON_CLASS3: u16 = 7;19 pub const REASON_CLASS3: u16 = 7;
22 20
23 /// Pacing between frames: 15 ms ≈ 64 frames/s.21 /// Pacing between frames: 15 ms ≈ 64 frames/s.
@@ -25,17 +23,6 @@ const PACE: Duration = Duration::from_millis(15);
25 /// Emit [`Event::DeauthSent`] after every this many frames.23 /// Emit [`Event::DeauthSent`] after every this many frames.
26 const REPORT_EVERY: u64 = 32;24 const REPORT_EVERY: u64 = 32;
27 25
28-/// Number of frames `blast` will attempt for `count` requested deauths:
29-/// broadcast → `count` (AP side only), unicast → `2*count` (both directions).
30-fn burst_plan(ap: &MacAddr, target: &MacAddr, count: u32) -> u64 {
31- let _ = ap;
32- if target.is_broadcast() {
33- u64::from(count)
34- } else {
35- 2 * u64::from(count)
36- }
37-}
38-
39 /// Rewards: `Some(frame_with_radiotap)` queues for TX.26 /// Rewards: `Some(frame_with_radiotap)` queues for TX.
40 fn frame_plan(ap: &MacAddr, target: &MacAddr) -> Vec<Vec<u8>> {27 fn frame_plan(ap: &MacAddr, target: &MacAddr) -> Vec<Vec<u8>> {
41 let mut frames = Vec::new();28 let mut frames = Vec::new();
@@ -125,21 +112,6 @@ pub fn blast(
125 mod tests {112 mod tests {
126 use super::*;113 use super::*;
127 114
128- #[test]
129- fn burst_plan_broadcast_is_count() {
130- let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();
131- assert_eq!(burst_plan(&ap, &MacAddr::BROADCAST, 10), 10);
132- assert_eq!(burst_plan(&ap, &MacAddr::BROADCAST, 0), 0);
133- }
134-
135- #[test]
136- fn burst_plan_unicast_is_double() {
137- let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();
138- let sta = "11:22:33:44:55:66".parse::<MacAddr>().unwrap();
139- assert_eq!(burst_plan(&ap, &sta, 10), 20);
140- assert_eq!(burst_plan(&ap, &sta, 1), 2);
141- }
142-
143 #[test]115 #[test]
144 fn frame_plan_broadcast_only_ap_side() {116 fn frame_plan_broadcast_only_ap_side() {
145 let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();117 let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();
src/dot11.rsmodified+62 -141
@@ -61,7 +61,6 @@ where
61 61
62 pub struct MgmtInfo {62 pub struct MgmtInfo {
63 pub bssid: MacAddr,63 pub bssid: MacAddr,
64- pub transmitter: MacAddr, // addr2
65 pub ssid: Option<String>, // None if hidden/zero-len64 pub ssid: Option<String>, // None if hidden/zero-len
66 pub channel: Option<u8>, // DS parameter set IE65 pub channel: Option<u8>, // DS parameter set IE
67 pub security: Security, // from RSN/WPA IEs + capability privacy bit66 pub security: Security, // from RSN/WPA IEs + capability privacy bit
@@ -158,18 +157,20 @@ pub fn parse_beacon_or_probe(f: &[u8]) -> Option<MgmtInfo> {
158 has_sae |= rsn_has_akm(body, 8);157 has_sae |= rsn_has_akm(body, 8);
159 rsn_akms(body, &mut akms);158 rsn_akms(body, &mut akms);
160 }159 }
161- IE_VENDOR => {160+ IE_VENDOR if body.len() >= 4 && body[..4] == WPA_OUI => {
162- if body.len() >= 4 && body[..4] == WPA_OUI {161+ has_wpa = true;
163- has_wpa = true;162+ // WPA1 vendor IE: only PSK key management exists.
164- // WPA1 vendor IE: only PSK key management exists.163+ akms.push(Akm::Psk);
165- akms.push(Akm::Psk);
166- }
167 }164 }
168 _ => {}165 _ => {}
169 });166 });
170 167
171 let security = if has_rsn {168 let security = if has_rsn {
172- if has_sae { Security::Wpa3 } else { Security::Wpa2 }169+ if has_sae {
170+ Security::Wpa3
171+ } else {
172+ Security::Wpa2
173+ }
173 } else if has_wpa {174 } else if has_wpa {
174 Security::Wpa175 Security::Wpa
175 } else if cap & CAP_PRIVACY != 0 {176 } else if cap & CAP_PRIVACY != 0 {
@@ -190,7 +191,6 @@ pub fn parse_beacon_or_probe(f: &[u8]) -> Option<MgmtInfo> {
190 191
191 Some(MgmtInfo {192 Some(MgmtInfo {
192 bssid: mac_at(f, 16)?,193 bssid: mac_at(f, 16)?,
193- transmitter: mac_at(f, 10)?,
194 ssid,194 ssid,
195 channel,195 channel,
196 security,196 security,
@@ -218,39 +218,6 @@ pub fn parse_probe_req(f: &[u8]) -> Option<(MacAddr, Option<String>)> {
218 Some((sta, ssid))218 Some((sta, ssid))
219 }219 }
220 220
221-/// Association/reassociation request → (station, bssid, ssid).
222-/// None for other/broken frames. SSID is None for hidden (`\0`-padded or
223-/// empty) networks.
224-pub fn parse_assoc_req(f: &[u8]) -> Option<(MacAddr, MacAddr, Option<String>)> {
225- let fc = u16le(f, 0)?;
226- let (ty, st) = type_subtype(fc);
227- // subtype 0 = assoc request, 1 = reassoc request; mgmt type only.
228- if ty != 0 || st > 1 {
229- return None;
230- }
231- let bssid = mac_at(f, 4)?; // addr1
232- let sta = mac_at(f, 10)?; // addr2
233- // Fixed params: capability(2) + listen interval(2) at offset 24, so IEs
234- // start at 28; reassoc adds current-AP MAC(6) → IEs start at 34.
235- let ie_off = if st == 0 { 28 } else { 34 };
236- let mut ssid = None;
237- walk_ies(f, ie_off, |id, body| {
238- if id == IE_SSID {
239- // hidden networks send a zero or NUL-padded SSID
240- let s: &[u8] = body;
241- let meaningful = s.iter().take_while(|&&b| b != 0).count();
242- if meaningful > 0 {
243- ssid = Some(String::from_utf8_lossy(&s[..meaningful]).into_owned());
244- }
245- }
246- });
247- // ensure the fixed params fit (frames shorter than ie_off are bogus)
248- if f.len() < ie_off {
249- return None;
250- }
251- Some((sta, bssid, ssid))
252-}
253-
254 // ---------------------------------------------------------------------------221 // ---------------------------------------------------------------------------
255 // device correlation (pairing rotated/randomized MACs of one radio)222 // device correlation (pairing rotated/randomized MACs of one radio)
256 // ---------------------------------------------------------------------------223 // ---------------------------------------------------------------------------
@@ -329,7 +296,7 @@ pub fn wps_uuid_e(f: &[u8], ie_off: usize) -> Option<[u8; 16]> {
329 #[derive(Clone, Debug, PartialEq, Eq)]296 #[derive(Clone, Debug, PartialEq, Eq)]
330 pub struct ProbeIdent {297 pub struct ProbeIdent {
331 pub sta: MacAddr,298 pub sta: MacAddr,
332- pub ssid: Option<String>, // None for the wildcard probe299+ pub ssid: Option<String>, // None for the wildcard probe
333 pub fingerprint: u32,300 pub fingerprint: u32,
334 pub uuid: Option<[u8; 16]>,301 pub uuid: Option<[u8; 16]>,
335 }302 }
@@ -360,7 +327,12 @@ pub fn parse_probe_ident(f: &[u8]) -> Option<ProbeIdent> {
360 }327 }
361 });328 });
362 let uuid = wps_uuid_e(f, 24);329 let uuid = wps_uuid_e(f, 24);
363- Some(ProbeIdent { sta, ssid, fingerprint, uuid })330+ Some(ProbeIdent {
331+ sta,
332+ ssid,
333+ fingerprint,
334+ uuid,
335+ })
364 }336 }
365 337
366 /// Assoc/reassoc request with device-correlation material; None for other338 /// Assoc/reassoc request with device-correlation material; None for other
@@ -388,7 +360,13 @@ pub fn parse_assoc_ident(f: &[u8]) -> Option<AssocIdent> {
388 }360 }
389 });361 });
390 let uuid = wps_uuid_e(f, ie_off);362 let uuid = wps_uuid_e(f, ie_off);
391- Some(AssocIdent { sta, bssid, ssid, fingerprint, uuid })363+ Some(AssocIdent {
364+ sta,
365+ bssid,
366+ ssid,
367+ fingerprint,
368+ uuid,
369+ })
392 }370 }
393 371
394 /// Parse deauth/disassoc → (from-ap MacAddr as transmitter, target addr1).372 /// Parse deauth/disassoc → (from-ap MacAddr as transmitter, target addr1).
@@ -467,7 +445,6 @@ pub fn parse_eapol(f: &[u8]) -> Option<(MacAddr, bool, &[u8])> {
467 // ---------------------------------------------------------------------------445 // ---------------------------------------------------------------------------
468 446
469 pub struct EapolKey<'a> {447 pub struct EapolKey<'a> {
470- pub key_info: u16, // raw key info field (BE order as on wire)
471 pub key_ver: u8, // bits 0..3 of key_info (descriptor version)448 pub key_ver: u8, // bits 0..3 of key_info (descriptor version)
472 pub install: bool, // bit6449 pub install: bool, // bit6
473 pub key_ack: bool, // bit7450 pub key_ack: bool, // bit7
@@ -475,9 +452,9 @@ pub struct EapolKey<'a> {
475 pub secure: bool, // bit9452 pub secure: bool, // bit9
476 pub replay_counter: u64,453 pub replay_counter: u64,
477 pub nonce: [u8; 32],454 pub nonce: [u8; 32],
478- pub mic: [u8; 16], // raw mic field (or RSN IE scan for pmkid)455+ pub mic: [u8; 16], // raw mic field (or RSN IE scan for pmkid)
479 pub key_data: &'a [u8], // RSN IE / KDEs (PMKID: 00-0f-ac:4)456 pub key_data: &'a [u8], // RSN IE / KDEs (PMKID: 00-0f-ac:4)
480- pub raw: &'a [u8], // full eapol frame starting at version byte457+ pub raw: &'a [u8], // full eapol frame starting at version byte
481 }458 }
482 459
483 /// Parse an EAPOL-Key frame. Frame offsets (descriptor body starts at 4):460 /// Parse an EAPOL-Key frame. Frame offsets (descriptor body starts at 4):
@@ -495,7 +472,6 @@ pub fn parse_eapol_key(eapol: &[u8]) -> Option<EapolKey<'_>> {
495 let key_data_len = u16::from_be_bytes([eapol[97], eapol[98]]) as usize;472 let key_data_len = u16::from_be_bytes([eapol[97], eapol[98]]) as usize;
496 let key_data = &eapol[99..eapol.len().min(99 + key_data_len)];473 let key_data = &eapol[99..eapol.len().min(99 + key_data_len)];
497 Some(EapolKey {474 Some(EapolKey {
498- key_info,
499 key_ver: (key_info & 0x7) as u8,475 key_ver: (key_info & 0x7) as u8,
500 install: key_info & (1 << 6) != 0,476 install: key_info & (1 << 6) != 0,
501 key_ack: key_info & (1 << 7) != 0,477 key_ack: key_info & (1 << 7) != 0,
@@ -549,12 +525,6 @@ pub fn build_deauth(ap: &MacAddr, target: &MacAddr, reason: u16) -> Vec<u8> {
549 v525 v
550 }526 }
551 527
552-pub fn build_disassoc(ap: &MacAddr, target: &MacAddr, reason: u16) -> Vec<u8> {
553- let mut v = hdr3(0xA0, target, ap, ap, 0);
554- v.extend_from_slice(&reason.to_le_bytes());
555- v
556-}
557-
558 /// Probe request sta → broadcast: empty `ssid` = wildcard (every AP on528 /// Probe request sta → broadcast: empty `ssid` = wildcard (every AP on
559 /// the channel should answer with a probe response), otherwise directed.529 /// the channel should answer with a probe response), otherwise directed.
560 /// Used by the injection canary: a response proves injected frames530 /// Used by the injection canary: a response proves injected frames
@@ -620,8 +590,8 @@ mod tests {
620 }590 }
621 591
622 /// FCS-free beacon as it would appear after radiotap is stripped:592 /// FCS-free beacon as it would appear after radiotap is stripped:
623- /// SSID "parafin", channel 6, WPA2 (RSN, AKM PSK), privacy bit set.593+ /// SSID "testnet", channel 6, WPA2 (RSN, AKM PSK), privacy bit set.
624- fn parafin_beacon() -> Vec<u8> {594+ fn testnet_beacon() -> Vec<u8> {
625 let mut v = vec![0x80, 0x00]; // FC: beacon595 let mut v = vec![0x80, 0x00]; // FC: beacon
626 v.extend_from_slice(&[0x00, 0x00]); // duration596 v.extend_from_slice(&[0x00, 0x00]); // duration
627 v.extend_from_slice(&MacAddr::BROADCAST.0); // addr1597 v.extend_from_slice(&MacAddr::BROADCAST.0); // addr1
@@ -631,7 +601,7 @@ mod tests {
631 v.extend_from_slice(&[0x00; 8]); // timestamp601 v.extend_from_slice(&[0x00; 8]); // timestamp
632 v.extend_from_slice(&100u16.to_le_bytes()); // beacon interval602 v.extend_from_slice(&100u16.to_le_bytes()); // beacon interval
633 v.extend_from_slice(&0x0411u16.to_le_bytes()); // capability: ESS | privacy | short preamble603 v.extend_from_slice(&0x0411u16.to_le_bytes()); // capability: ESS | privacy | short preamble
634- v.extend_from_slice(&ie(IE_SSID, b"parafin"));604+ v.extend_from_slice(&ie(IE_SSID, b"testnet"));
635 v.extend_from_slice(&ie(1, &[0x82, 0x84, 0x8b, 0x96])); // supported rates605 v.extend_from_slice(&ie(1, &[0x82, 0x84, 0x8b, 0x96])); // supported rates
636 v.extend_from_slice(&ie(IE_DS_PARAM, &[6])); // channel 6606 v.extend_from_slice(&ie(IE_DS_PARAM, &[6])); // channel 6
637 v.extend_from_slice(&ie(5, &[0x00, 0x01, 0x00, 0x00])); // TIM607 v.extend_from_slice(&ie(5, &[0x00, 0x01, 0x00, 0x00])); // TIM
@@ -640,11 +610,10 @@ mod tests {
640 }610 }
641 611
642 #[test]612 #[test]
643- fn parafin_beacon_parses_to_wpa2_ch6() {613+ fn testnet_beacon_parses_to_wpa2_ch6() {
644- let info = parse_beacon_or_probe(&parafin_beacon()).expect("beacon parses");614+ let info = parse_beacon_or_probe(&testnet_beacon()).expect("beacon parses");
645 assert_eq!(info.bssid, AP);615 assert_eq!(info.bssid, AP);
646- assert_eq!(info.transmitter, AP);616+ assert_eq!(info.ssid.as_deref(), Some("testnet"));
647- assert_eq!(info.ssid.as_deref(), Some("parafin"));
648 assert_eq!(info.channel, Some(6));617 assert_eq!(info.channel, Some(6));
649 assert_eq!(info.security, Security::Wpa2);618 assert_eq!(info.security, Security::Wpa2);
650 }619 }
@@ -666,9 +635,9 @@ mod tests {
666 ie(IE_RSN, &b)635 ie(IE_RSN, &b)
667 }636 }
668 637
669- /// Beacon like `parafin_beacon` but with the RSN IE replaced by `rsn`.638+ /// Beacon like `testnet_beacon` but with the RSN IE replaced by `rsn`.
670 fn beacon_with_rsn(rsn: Vec<u8>) -> Vec<u8> {639 fn beacon_with_rsn(rsn: Vec<u8>) -> Vec<u8> {
671- let mut v = parafin_beacon();640+ let mut v = testnet_beacon();
672 v.splice(v.len() - rsn_ie(2).len().., rsn);641 v.splice(v.len() - rsn_ie(2).len().., rsn);
673 v642 v
674 }643 }
@@ -695,11 +664,11 @@ mod tests {
695 assert_eq!(info.akms, vec![Akm::Psk, Akm::Other(99)]);664 assert_eq!(info.akms, vec![Akm::Psk, Akm::Other(99)]);
696 665
697 // plain WPA2-PSK beacon: single PSK entry666 // plain WPA2-PSK beacon: single PSK entry
698- let info = parse_beacon_or_probe(&parafin_beacon()).unwrap();667+ let info = parse_beacon_or_probe(&testnet_beacon()).unwrap();
699 assert_eq!(info.akms, vec![Akm::Psk]);668 assert_eq!(info.akms, vec![Akm::Psk]);
700 669
701 // open network: no security IEs → empty akms670 // open network: no security IEs → empty akms
702- let mut f = parafin_beacon();671+ let mut f = testnet_beacon();
703 f.truncate(36);672 f.truncate(36);
704 f.extend_from_slice(&ie(IE_SSID, b"cafe"));673 f.extend_from_slice(&ie(IE_SSID, b"cafe"));
705 f[34] = 0x01; // clear privacy bit674 f[34] = 0x01; // clear privacy bit
@@ -711,7 +680,7 @@ mod tests {
711 680
712 #[test]681 #[test]
713 fn wpa1_vendor_ie_yields_psk_akm() {682 fn wpa1_vendor_ie_yields_psk_akm() {
714- let mut f = parafin_beacon();683+ let mut f = testnet_beacon();
715 f.truncate(36);684 f.truncate(36);
716 f.extend_from_slice(&ie(IE_SSID, b"legacy"));685 f.extend_from_slice(&ie(IE_SSID, b"legacy"));
717 // WPA_OUI vendor IE: oui+type, then version(2) — content beyond the686 // WPA_OUI vendor IE: oui+type, then version(2) — content beyond the
@@ -734,7 +703,7 @@ mod tests {
734 703
735 #[test]704 #[test]
736 fn seq_number_extracted() {705 fn seq_number_extracted() {
737- let mut f = parafin_beacon();706+ let mut f = testnet_beacon();
738 // seq field at bytes 22-24: seq<<4 | frag707 // seq field at bytes 22-24: seq<<4 | frag
739 f[22] = 0x30; // seq 3, frag 0708 f[22] = 0x30; // seq 3, frag 0
740 f[23] = 0x02; // → 0x230 >> 4 = 0x23 = 35709 f[23] = 0x02; // → 0x230 >> 4 = 0x23 = 35
@@ -766,12 +735,12 @@ mod tests {
766 // The same radio alternating directed/wildcard probes must hash735 // The same radio alternating directed/wildcard probes must hash
767 // identically; a different IE chain must not.736 // identically; a different IE chain must not.
768 let rates = ie(1, &[0x82, 0x84, 0x8b, 0x96]);737 let rates = ie(1, &[0x82, 0x84, 0x8b, 0x96]);
769- let f1 = probe_with(&STA, Some("parafin"), &[rates.clone()], 7);738+ let f1 = probe_with(&STA, Some("testnet"), std::slice::from_ref(&rates), 7);
770- let f2 = probe_with(&STA, None, &[rates.clone()], 8);739+ let f2 = probe_with(&STA, None, std::slice::from_ref(&rates), 8);
771 let i1 = parse_probe_ident(&f1).expect("parses");740 let i1 = parse_probe_ident(&f1).expect("parses");
772 let i2 = parse_probe_ident(&f2).expect("parses");741 let i2 = parse_probe_ident(&f2).expect("parses");
773 assert_eq!(i1.fingerprint, i2.fingerprint);742 assert_eq!(i1.fingerprint, i2.fingerprint);
774- assert_eq!(i1.ssid.as_deref(), Some("parafin"));743+ assert_eq!(i1.ssid.as_deref(), Some("testnet"));
775 assert_eq!(i2.ssid, None);744 assert_eq!(i2.ssid, None);
776 745
777 let other = probe_with(&STA, None, &[ie(1, &[0x82, 0x84])], 9);746 let other = probe_with(&STA, None, &[ie(1, &[0x82, 0x84])], 9);
@@ -779,7 +748,7 @@ mod tests {
779 assert_ne!(i1.fingerprint, i3.fingerprint);748 assert_ne!(i1.fingerprint, i3.fingerprint);
780 749
781 // Off a probe frame entirely → None.750 // Off a probe frame entirely → None.
782- assert!(parse_probe_ident(&parafin_beacon()).is_none());751+ assert!(parse_probe_ident(&testnet_beacon()).is_none());
783 }752 }
784 753
785 #[test]754 #[test]
@@ -794,7 +763,10 @@ mod tests {
794 let ident = parse_probe_ident(&f).expect("parses");763 let ident = parse_probe_ident(&f).expect("parses");
795 assert_eq!(ident.uuid, Some(uuid));764 assert_eq!(ident.uuid, Some(uuid));
796 // Truncated attribute body → no uuid, no panic.765 // Truncated attribute body → no uuid, no panic.
797- let short = ie(IE_VENDOR, &[0x00, 0x50, 0xf2, 0x04, 0x10, 0x47, 0x00, 0x10, 0xaa, 0xbb]);766+ let short = ie(
767+ IE_VENDOR,
768+ &[0x00, 0x50, 0xf2, 0x04, 0x10, 0x47, 0x00, 0x10, 0xaa, 0xbb],
769+ );
798 let f = probe_with(&STA, None, &[short], 7);770 let f = probe_with(&STA, None, &[short], 7);
799 assert_eq!(parse_probe_ident(&f).unwrap().uuid, None);771 assert_eq!(parse_probe_ident(&f).unwrap().uuid, None);
800 }772 }
@@ -807,78 +779,32 @@ mod tests {
807 assert_eq!(ident.bssid, AP);779 assert_eq!(ident.bssid, AP);
808 assert_eq!(ident.ssid.as_deref(), Some("testap"));780 assert_eq!(ident.ssid.as_deref(), Some("testap"));
809 assert_eq!(ident.uuid, None);781 assert_eq!(ident.uuid, None);
810- assert!(parse_assoc_ident(&parafin_beacon()).is_none());782+ assert!(parse_assoc_ident(&testnet_beacon()).is_none());
811 for cut in 0..f.len() {783 for cut in 0..f.len() {
812 let _ = parse_assoc_ident(&f[..cut]);784 let _ = parse_assoc_ident(&f[..cut]);
813 }785 }
814 }786 }
815 787
816- #[test]
817- fn assoc_req_parsed() {
818- // assoc request: addr1=bssid(AP), addr2=sta, ssid "testap"
819- let f = build_assoc_req(&AP, &STA, b"testap");
820- let (sta, bssid, ssid) = parse_assoc_req(&f).expect("assoc-req parses");
821- assert_eq!(sta, STA);
822- assert_eq!(bssid, AP);
823- assert_eq!(ssid.as_deref(), Some("testap"));
824-
825- // reassoc request (subtype 1): extra current-AP field before IEs
826- let mut r = hdr3(0x10, &AP, &STA, &AP, 0);
827- r.extend_from_slice(&0x0431u16.to_le_bytes()); // capability
828- r.extend_from_slice(&10u16.to_le_bytes()); // listen interval
829- r.extend_from_slice(&STA.0); // current AP (assoc) — arbitrary MAC here
830- r.extend_from_slice(&ie(IE_SSID, b"home-net"));
831- let (sta, bssid, ssid) = parse_assoc_req(&r).expect("reassoc-req parses");
832- assert_eq!(sta, STA);
833- assert_eq!(bssid, AP);
834- assert_eq!(ssid.as_deref(), Some("home-net"));
835-
836- // empty SSID → None (hidden/wildcard attempt)
837- let mut g = hdr3(0x00, &AP, &STA, &AP, 0);
838- g.extend_from_slice(&0x0431u16.to_le_bytes());
839- g.extend_from_slice(&10u16.to_le_bytes());
840- g.extend_from_slice(&ie(IE_SSID, b""));
841- let (_, _, ssid) = parse_assoc_req(&g).unwrap();
842- assert_eq!(ssid, None);
843-
844- // NUL-padded SSID → None
845- let mut h = hdr3(0x00, &AP, &STA, &AP, 0);
846- h.extend_from_slice(&0x0431u16.to_le_bytes());
847- h.extend_from_slice(&10u16.to_le_bytes());
848- h.extend_from_slice(&ie(IE_SSID, &[0x00, 0x00, 0x00]));
849- let (_, _, ssid) = parse_assoc_req(&h).unwrap();
850- assert_eq!(ssid, None);
851-
852- // truncated frames: header cut anywhere → None or no panic
853- for cut in 0..f.len() {
854- let _ = parse_assoc_req(&f[..cut]);
855- }
856- // frame too short to hold the fixed params → None
857- assert_eq!(parse_assoc_req(&f[..24]), None);
858-
859- // non-assoc frames rejected
860- assert_eq!(parse_assoc_req(&parafin_beacon()), None);
861- let pr = build_probe_req(b"x", &STA);
862- assert_eq!(parse_assoc_req(&pr), None);
863- }
864-
865 #[test]788 #[test]
866 fn beacon_security_matrix() {789 fn beacon_security_matrix() {
867 // WPA3: same beacon but SAE AKM790 // WPA3: same beacon but SAE AKM
868- let mut f = parafin_beacon();791+ let mut f = testnet_beacon();
869 let rsn_at = f.len() - rsn_ie(8).len();792 let rsn_at = f.len() - rsn_ie(8).len();
870 f.splice(rsn_at.., rsn_ie(8));793 f.splice(rsn_at.., rsn_ie(8));
871 assert_eq!(parse_beacon_or_probe(&f).unwrap().security, Security::Wpa3);794 assert_eq!(parse_beacon_or_probe(&f).unwrap().security, Security::Wpa3);
872 795
873 // WPA: vendor IE, no RSN796 // WPA: vendor IE, no RSN
874- let mut hdr_fixed = parafin_beacon();797+ let mut hdr_fixed = testnet_beacon();
875 hdr_fixed.truncate(36);798 hdr_fixed.truncate(36);
876 hdr_fixed.extend_from_slice(&ie(IE_SSID, b"legacy"));799 hdr_fixed.extend_from_slice(&ie(IE_SSID, b"legacy"));
877 hdr_fixed.extend_from_slice(&ie(IE_VENDOR, &[0x00, 0x50, 0xf2, 0x01, 0x01, 0x00]));800 hdr_fixed.extend_from_slice(&ie(IE_VENDOR, &[0x00, 0x50, 0xf2, 0x01, 0x01, 0x00]));
878- assert_eq!(parse_beacon_or_probe(&hdr_fixed).unwrap().security, Security::Wpa);801+ assert_eq!(
802+ parse_beacon_or_probe(&hdr_fixed).unwrap().security,
803+ Security::Wpa
804+ );
879 805
880 // WEP: privacy bit only806 // WEP: privacy bit only
881- let mut f = parafin_beacon();807+ let mut f = testnet_beacon();
882 f.truncate(36);808 f.truncate(36);
883 f.extend_from_slice(&ie(IE_SSID, b"oldnet"));809 f.extend_from_slice(&ie(IE_SSID, b"oldnet"));
884 assert_eq!(parse_beacon_or_probe(&f).unwrap().security, Security::Wep);810 assert_eq!(parse_beacon_or_probe(&f).unwrap().security, Security::Wep);
@@ -891,7 +817,7 @@ mod tests {
891 817
892 #[test]818 #[test]
893 fn hidden_ssid_and_truncated_safe() {819 fn hidden_ssid_and_truncated_safe() {
894- let mut f = parafin_beacon();820+ let mut f = testnet_beacon();
895 // zero-length SSID IE → None (hidden)821 // zero-length SSID IE → None (hidden)
896 let ssid_at = 36;822 let ssid_at = 36;
897 f.drain(ssid_at..ssid_at + 2 + 7);823 f.drain(ssid_at..ssid_at + 2 + 7);
@@ -917,10 +843,6 @@ mod tests {
917 assert_eq!(u16le(&f, 2), Some(314));843 assert_eq!(u16le(&f, 2), Some(314));
918 assert_eq!(parse_deauth(&f), Some((AP, STA)));844 assert_eq!(parse_deauth(&f), Some((AP, STA)));
919 assert_eq!(u16le(&f, 24), Some(7)); // reason845 assert_eq!(u16le(&f, 24), Some(7)); // reason
920-
921- let d = build_disassoc(&AP, &STA, 8);
922- assert_eq!(d[0], 0xA0);
923- assert_eq!(parse_deauth(&d), Some((AP, STA)));
924 }846 }
925 847
926 #[test]848 #[test]
@@ -933,20 +855,20 @@ mod tests {
933 assert_eq!(u16le(&a, 26), Some(1)); // transaction 1855 assert_eq!(u16le(&a, 26), Some(1)); // transaction 1
934 assert_eq!(u16le(&a, 22), Some(42 << 4)); // seq number encoded856 assert_eq!(u16le(&a, 22), Some(42 << 4)); // seq number encoded
935 857
936- let r = build_assoc_req(&AP, &STA, b"parafin");858+ let r = build_assoc_req(&AP, &STA, b"testnet");
937 assert_eq!(r[0], 0x00);859 assert_eq!(r[0], 0x00);
938 assert_eq!(r[28], IE_SSID);860 assert_eq!(r[28], IE_SSID);
939 assert_eq!(r[29], 7);861 assert_eq!(r[29], 7);
940- assert_eq!(&r[30..], b"parafin");862+ assert_eq!(&r[30..], b"testnet");
941 }863 }
942 864
943 #[test]865 #[test]
944 fn probe_req_parsed() {866 fn probe_req_parsed() {
945 let mut f = hdr3(0x40, &MacAddr::BROADCAST, &STA, &MacAddr::BROADCAST, 0);867 let mut f = hdr3(0x40, &MacAddr::BROADCAST, &STA, &MacAddr::BROADCAST, 0);
946- f.extend_from_slice(&ie(IE_SSID, b"parafin"));868+ f.extend_from_slice(&ie(IE_SSID, b"testnet"));
947 let (sta, ssid) = parse_probe_req(&f).unwrap();869 let (sta, ssid) = parse_probe_req(&f).unwrap();
948 assert_eq!(sta, STA);870 assert_eq!(sta, STA);
949- assert_eq!(ssid.as_deref(), Some("parafin"));871+ assert_eq!(ssid.as_deref(), Some("testnet"));
950 }872 }
951 873
952 #[test]874 #[test]
@@ -955,10 +877,10 @@ mod tests {
955 let (sta, ssid) = parse_probe_req(&wild).unwrap();877 let (sta, ssid) = parse_probe_req(&wild).unwrap();
956 assert_eq!(sta, STA);878 assert_eq!(sta, STA);
957 assert_eq!(ssid, None, "wildcard SSID (len 0) parses as None");879 assert_eq!(ssid, None, "wildcard SSID (len 0) parses as None");
958- let dir = build_probe_req(b"parafin", &STA);880+ let dir = build_probe_req(b"testnet", &STA);
959 let (sta, ssid) = parse_probe_req(&dir).unwrap();881 let (sta, ssid) = parse_probe_req(&dir).unwrap();
960 assert_eq!(sta, STA);882 assert_eq!(sta, STA);
961- assert_eq!(ssid.as_deref(), Some("parafin"));883+ assert_eq!(ssid.as_deref(), Some("testnet"));
962 884
963 // broadcast probe: zero-len SSID → None885 // broadcast probe: zero-len SSID → None
964 let mut b = hdr3(0x40, &MacAddr::BROADCAST, &STA, &MacAddr::BROADCAST, 0);886 let mut b = hdr3(0x40, &MacAddr::BROADCAST, &STA, &MacAddr::BROADCAST, 0);
@@ -966,7 +888,7 @@ mod tests {
966 assert_eq!(parse_probe_req(&b), Some((STA, None)));888 assert_eq!(parse_probe_req(&b), Some((STA, None)));
967 889
968 // beacon is not a probe request890 // beacon is not a probe request
969- assert!(parse_probe_req(&parafin_beacon()).is_none());891+ assert!(parse_probe_req(&testnet_beacon()).is_none());
970 }892 }
971 893
972 /// Minimal EAPOL-Key frame with the given key_info (BE), filled otherwise.894 /// Minimal EAPOL-Key frame with the given key_info (BE), filled otherwise.
@@ -989,7 +911,6 @@ mod tests {
989 let ki: u16 = 2 | (1 << 7); // version 2 + ack911 let ki: u16 = 2 | (1 << 7); // version 2 + ack
990 let e = eapol_key(ki);912 let e = eapol_key(ki);
991 let k = parse_eapol_key(&e).unwrap();913 let k = parse_eapol_key(&e).unwrap();
992- assert_eq!(k.key_info, ki);
993 assert_eq!(k.key_ver, 2);914 assert_eq!(k.key_ver, 2);
994 assert!(k.key_ack);915 assert!(k.key_ack);
995 assert!(!k.key_mic);916 assert!(!k.key_mic);
@@ -1075,6 +996,6 @@ mod tests {
1075 assert!(parse_eapol(&wds).is_some());996 assert!(parse_eapol(&wds).is_some());
1076 997
1077 // management frame → not data998 // management frame → not data
1078- assert!(parse_eapol(&parafin_beacon()).is_none());999+ assert!(parse_eapol(&testnet_beacon()).is_none());
1079 }1000 }
1080 }1001 }
src/gpu.rsmodified+412 -135
@@ -10,22 +10,24 @@
10 //! batch×40B of PMKs — the previous midstate/upload + CPU MIC phases were10 //! batch×40B of PMKs — the previous midstate/upload + CPU MIC phases were
11 //! the pipeline's throughput ceiling.11 //! the pipeline's throughput ceiling.
12 //!12 //!
13-//! Targets whose MIC is AES-CMAC (key_ver 3) are not expressible in this13+//! Targets whose MIC is AES-CMAC (key_ver 3) or HMAC-MD5 (key_ver 1) are
14-//! shader; [`gpu_verifiable`] routes them to the CPU cracker.14+//! not expressible in this SHA1-only shader; [`gpu_verifiable`] routes
15+//! them (and overlong inputs) to the CPU cracker.
15 16
17+use std::fmt;
16 use std::sync::Arc;18 use std::sync::Arc;
17 use std::sync::atomic::{AtomicBool, Ordering};19 use std::sync::atomic::{AtomicBool, Ordering};
18 use std::time::{Duration, Instant};20 use std::time::{Duration, Instant};
19 21
20-use crate::crypto::{self, CrackTarget};
21-use crate::rainbow;
22 #[cfg(test)]22 #[cfg(test)]
23 use crate::common::MacAddr;23 use crate::common::MacAddr;
24+use crate::crypto::{self, CrackTarget};
25+use crate::rainbow;
24 26
25 /// Target view with the candidate-invariant parts precomputed — the MIC27 /// Target view with the candidate-invariant parts precomputed — the MIC
26-/// zeroing of the EAPOL frame is fixed for the whole run ([`crypto::mic`]28+/// zeroing of the EAPOL frame is fixed for the whole run, so the frame is
27-/// re-copies and re-zeroes the frame per call, which is measurable at29+/// copied and zeroed once instead of per candidate (measurable at 65536
28-/// 65536 candidates per batch).30+/// candidates per batch).
29 pub(crate) enum PreparedTarget<'a> {31 pub(crate) enum PreparedTarget<'a> {
30 Handshake(&'a crate::common::HandshakeCapture, Vec<u8>),32 Handshake(&'a crate::common::HandshakeCapture, Vec<u8>),
31 Pmkid(&'a crate::common::PmkidCapture),33 Pmkid(&'a crate::common::PmkidCapture),
@@ -56,6 +58,33 @@ pub(crate) fn prepared_matches(prepared: &PreparedTarget, k: &[u8; 32]) -> bool
56 }58 }
57 }59 }
58 60
61+/// Backend failure of a GPU crack/PMK dispatch — NOT keyspace exhaustion
62+/// and NOT user stop (those are `Ok(None)`).
63+#[derive(Debug, Clone, PartialEq, Eq)]
64+pub enum GpuError {
65+ /// The device died mid-run (driver reset, TDR, device-lost callback).
66+ Lost,
67+ /// A single dispatch did not complete within 30 s — the GPU is wedged
68+ /// or absurdly slow; the run cannot make progress.
69+ Timeout,
70+ /// The request is not expressible on this GPU path (reason says why):
71+ /// unverifiable target variant, overlong salt/EAPOL for the shader's
72+ /// fixed block buffers, or a map_async failure beyond our control.
73+ Unsupported(String),
74+}
75+
76+impl fmt::Display for GpuError {
77+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
78+ match self {
79+ GpuError::Lost => write!(f, "GPU device lost (driver reset or disconnect)"),
80+ GpuError::Timeout => write!(f, "GPU dispatch timed out after 30s"),
81+ GpuError::Unsupported(r) => write!(f, "GPU path unsupported: {r}"),
82+ }
83+ }
84+}
85+
86+impl std::error::Error for GpuError {}
87+
59 const BATCH: u32 = 1 << 16;88 const BATCH: u32 = 1 << 16;
60 const WORKGROUP_SIZE: u32 = 256;89 const WORKGROUP_SIZE: u32 = 256;
61 const ITERATIONS: u32 = 4096;90 const ITERATIONS: u32 = 4096;
@@ -129,8 +158,12 @@ fn u_msg(salt: &[u8], idx: u32) -> [u32; 16] {
129 }158 }
130 159
131 /// Build the kernel verify context. None when the target is not160 /// Build the kernel verify context. None when the target is not
132-/// expressible in the SHA1-only shader: AES-CMIC handshake (key_ver 3),161+/// expressible in the SHA1-only shader — routes to the CPU cracker:
133-/// truncated frame, or overlong ESSID (> 51 bytes — spills the U block).162+/// AES-CMIC handshake (key_ver 3), HMAC-MD5 handshake (key_ver 1 — the
163+/// TKIP/WPA1 epilogue lives CPU-side now), truncated frame, overlong
164+/// ESSID (> 51 bytes — spills the U block), or a zeroed EAPOL frame
165+/// needing more than 3 padded blocks (overlong imported frames would
166+/// otherwise panic the `blk2[..w2.len()]` copy).
134 pub(crate) fn gpu_ctx(target: &CrackTarget) -> Option<GpuTargetCtx> {167 pub(crate) fn gpu_ctx(target: &CrackTarget) -> Option<GpuTargetCtx> {
135 let salt = target.essid().as_bytes();168 let salt = target.essid().as_bytes();
136 if salt.len() > 51 {169 if salt.len() > 51 {
@@ -154,17 +187,25 @@ pub(crate) fn gpu_ctx(target: &CrackTarget) -> Option<GpuTargetCtx> {
154 (1, n, 0)187 (1, n, 0)
155 }188 }
156 CrackTarget::Handshake(h) => {189 CrackTarget::Handshake(h) => {
157- if h.key_ver == 3 || h.eapol_m2.len() < 99 {190+ if h.key_ver != 2 || h.eapol_m2.len() < 99 {
158 return None;191 return None;
159 }192 }
160 // blk1: PRF message round 1 = prf_stem || 0x01 → KCK.193 // blk1: PRF message round 1 = prf_stem || 0x01 → KCK.
161 let mut prf = crypto::prf_stem(&h.ap, &h.client, &h.anonce, &h.snonce);194 let mut prf = crypto::prf_stem(&h.ap, &h.client, &h.anonce, &h.snonce);
162 prf.push(0x01);195 prf.push(0x01);
163 let (w1, n1) = padded_blocks(&prf);196 let (w1, n1) = padded_blocks(&prf);
197+ if w1.len() > P_BLK {
198+ return None;
199+ }
164 blk1[..w1.len()].copy_from_slice(&w1);200 blk1[..w1.len()].copy_from_slice(&w1);
165 // blk2: zeroed EAPOL frame (MIC message; 2..3 blocks).201 // blk2: zeroed EAPOL frame (MIC message; 2..3 blocks).
166 let zeroed = crypto::zeroed_eapol(&h.eapol_m2);202 let zeroed = crypto::zeroed_eapol(&h.eapol_m2);
167 let (w2, n2) = padded_blocks(&zeroed);203 let (w2, n2) = padded_blocks(&zeroed);
204+ if w2.len() > P_BLK {
205+ // Fixed 3-block params buffer: overlong imported frames
206+ // route to the CPU cracker instead of truncating/panicking.
207+ return None;
208+ }
168 blk2[..w2.len()].copy_from_slice(&w2);209 blk2[..w2.len()].copy_from_slice(&w2);
169 be_words(h.mic(), &mut mic);210 be_words(h.mic(), &mut mic);
170 (0, n1, n2)211 (0, n1, n2)
@@ -183,8 +224,9 @@ pub(crate) fn gpu_ctx(target: &CrackTarget) -> Option<GpuTargetCtx> {
183 Some(GpuTargetCtx { params })224 Some(GpuTargetCtx { params })
184 }225 }
185 226
186-/// Whether the GPU shader can verify this target (SHA1-family only; the227+/// Whether the GPU shader can verify this target (HMAC-SHA1 only; the
187-/// AES-CMAC key_ver 3 path stays on the CPU cracker).228+/// AES-CMAC key_ver 3 and HMAC-MD5 key_ver 1 paths stay on the CPU
229+/// cracker, as do frames too long for the shader's fixed block buffers).
188 pub(crate) fn gpu_verifiable(target: &CrackTarget) -> bool {230 pub(crate) fn gpu_verifiable(target: &CrackTarget) -> bool {
189 gpu_ctx(target).is_some()231 gpu_ctx(target).is_some()
190 }232 }
@@ -192,7 +234,7 @@ pub(crate) fn gpu_verifiable(target: &CrackTarget) -> bool {
192 /// Pack raw passphrases into the kernel wire format (BE words, zero pad).234 /// Pack raw passphrases into the kernel wire format (BE words, zero pad).
193 fn pack_candidates(words: &[Vec<u8>]) -> Vec<u32> {235 fn pack_candidates(words: &[Vec<u8>]) -> Vec<u32> {
194 let mut out = vec![0u32; words.len() * U32_PER_CAND_IN];236 let mut out = vec![0u32; words.len() * U32_PER_CAND_IN];
195- for (w, dst) in words.iter().zip(out.chunks_exact_mut(U32_PER_CAND_IN)) {237+ for (w, dst) in words.iter().zip(out.as_chunks_mut::<U32_PER_CAND_IN>().0) {
196 be_words(w, dst);238 be_words(w, dst);
197 }239 }
198 out240 out
@@ -241,12 +283,11 @@ struct KernelPool {
241 }283 }
242 284
243 impl KernelPool {285 impl KernelPool {
244- fn new(286+ fn new(device: &wgpu::Device, layout: &wgpu::BindGroupLayout, cap: usize) -> Self {
245- device: &wgpu::Device,287+ let mut pool = KernelPool {
246- layout: &wgpu::BindGroupLayout,288+ bufs: Vec::new(),
247- cap: usize,289+ free: Vec::new(),
248- ) -> Self {290+ };
249- let mut pool = KernelPool { bufs: Vec::new(), free: Vec::new() };
250 for _ in 0..2 {291 for _ in 0..2 {
251 pool.push_slot(device, layout, cap);292 pool.push_slot(device, layout, cap);
252 }293 }
@@ -293,13 +334,32 @@ impl KernelPool {
293 label: Some("pbkdf2-bg"),334 label: Some("pbkdf2-bg"),
294 layout,335 layout,
295 entries: &[336 entries: &[
296- wgpu::BindGroupEntry { binding: 0, resource: param_buf.as_entire_binding() },337+ wgpu::BindGroupEntry {
297- wgpu::BindGroupEntry { binding: 1, resource: in_buf.as_entire_binding() },338+ binding: 0,
298- wgpu::BindGroupEntry { binding: 2, resource: out_buf.as_entire_binding() },339+ resource: param_buf.as_entire_binding(),
299- wgpu::BindGroupEntry { binding: 3, resource: hit_buf.as_entire_binding() },340+ },
341+ wgpu::BindGroupEntry {
342+ binding: 1,
343+ resource: in_buf.as_entire_binding(),
344+ },
345+ wgpu::BindGroupEntry {
346+ binding: 2,
347+ resource: out_buf.as_entire_binding(),
348+ },
349+ wgpu::BindGroupEntry {
350+ binding: 3,
351+ resource: hit_buf.as_entire_binding(),
352+ },
300 ],353 ],
301 });354 });
302- self.bufs.push(KernelBufs { in_buf, out_buf, hit_buf, read_buf, param_buf, bind_group });355+ self.bufs.push(KernelBufs {
356+ in_buf,
357+ out_buf,
358+ hit_buf,
359+ read_buf,
360+ param_buf,
361+ bind_group,
362+ });
303 self.free.push(self.bufs.len() - 1);363 self.free.push(self.bufs.len() - 1);
304 }364 }
305 365
@@ -346,14 +406,17 @@ pub struct GpuCracker {
346 /// was the dominant host-side churn. Interior mutability: `crack`406 /// was the dominant host-side churn. Interior mutability: `crack`
347 /// borrows `&self`.407 /// borrows `&self`.
348 pool: std::cell::RefCell<Option<KernelPool>>,408 pool: std::cell::RefCell<Option<KernelPool>>,
409+ /// Set by wgpu's device-lost callback (driver reset, TDR, explicit
410+ /// destroy). Checked to classify wait/poll/map failures as
411+ /// [`GpuError::Lost`] instead of the catch-all.
412+ lost: Arc<AtomicBool>,
349 }413 }
350 414
351 impl GpuCracker {415 impl GpuCracker {
352 /// None when no suitable adapter/device exists (caller falls back to the416 /// None when no suitable adapter/device exists (caller falls back to the
353 /// CPU cracker).417 /// CPU cracker).
354 pub fn try_new() -> Option<Self> {418 pub fn try_new() -> Option<Self> {
355- let instance =419+ let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::new_without_display_handle());
356- wgpu::Instance::new(wgpu::InstanceDescriptor::new_without_display_handle());
357 let adapter = pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions {420 let adapter = pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions {
358 power_preference: wgpu::PowerPreference::HighPerformance,421 power_preference: wgpu::PowerPreference::HighPerformance,
359 force_fallback_adapter: false,422 force_fallback_adapter: false,
@@ -366,15 +429,15 @@ impl GpuCracker {
366 // Need storage buffers of BATCH × 64 B in and BATCH × 40 B out.429 // Need storage buffers of BATCH × 64 B in and BATCH × 40 B out.
367 let in_bytes = u64::from(BATCH) * (U32_PER_CAND_IN as u64) * 4;430 let in_bytes = u64::from(BATCH) * (U32_PER_CAND_IN as u64) * 4;
368 let out_bytes = u64::from(BATCH) * (U32_PER_CAND_OUT as u64) * 4;431 let out_bytes = u64::from(BATCH) * (U32_PER_CAND_OUT as u64) * 4;
369- if u64::from(limits.max_storage_buffer_binding_size) < in_bytes432+ if limits.max_storage_buffer_binding_size < in_bytes
370- || u64::from(limits.max_storage_buffer_binding_size) < out_bytes433+ || limits.max_storage_buffer_binding_size < out_bytes
371 || limits.max_buffer_size < in_bytes.max(out_bytes)434 || limits.max_buffer_size < in_bytes.max(out_bytes)
372 {435 {
373 return None;436 return None;
374 }437 }
375 438
376 let desc = wgpu::DeviceDescriptor {439 let desc = wgpu::DeviceDescriptor {
377- label: Some("wifilab-pbkdf2"),440+ label: Some("wifi_lab-pbkdf2"),
378 required_features: wgpu::Features::empty(),441 required_features: wgpu::Features::empty(),
379 required_limits: wgpu::Limits::default(),442 required_limits: wgpu::Limits::default(),
380 experimental_features: wgpu::ExperimentalFeatures::disabled(),443 experimental_features: wgpu::ExperimentalFeatures::disabled(),
@@ -383,6 +446,15 @@ impl GpuCracker {
383 };446 };
384 let (device, queue) = pollster::block_on(adapter.request_device(&desc)).ok()?;447 let (device, queue) = pollster::block_on(adapter.request_device(&desc)).ok()?;
385 448
449+ let lost = Arc::new(AtomicBool::new(false));
450+ {
451+ let lost = Arc::clone(&lost);
452+ device.set_device_lost_callback(move |reason, msg| {
453+ tracing::warn!("gpu device lost ({reason:?}): {msg}");
454+ lost.store(true, Ordering::Relaxed);
455+ });
456+ }
457+
386 let shader_desc = wgpu::ShaderModuleDescriptor {458 let shader_desc = wgpu::ShaderModuleDescriptor {
387 label: Some("pbkdf2.wgsl"),459 label: Some("pbkdf2.wgsl"),
388 source: wgpu::ShaderSource::Wgsl(include_str!("pbkdf2.wgsl").into()),460 source: wgpu::ShaderSource::Wgsl(include_str!("pbkdf2.wgsl").into()),
@@ -391,8 +463,7 @@ impl GpuCracker {
391 // checks (a tail-item guard in WGSL already clamps the last463 // checks (a tail-item guard in WGSL already clamps the last
392 // partial batch). SAFETY: module is a static, trusted WGSL source.464 // partial batch). SAFETY: module is a static, trusted WGSL source.
393 let shader = unsafe {465 let shader = unsafe {
394- device466+ device.create_shader_module_trusted(shader_desc, wgpu::ShaderRuntimeChecks::unchecked())
395- .create_shader_module_trusted(shader_desc, wgpu::ShaderRuntimeChecks::unchecked())
396 };467 };
397 468
398 let storage_entry = |binding: u32, read_only: bool| wgpu::BindGroupLayoutEntry {469 let storage_entry = |binding: u32, read_only: bool| wgpu::BindGroupLayoutEntry {
@@ -443,6 +514,7 @@ impl GpuCracker {
443 name: format!("{} ({:?})", info.name, info.backend),514 name: format!("{} ({:?})", info.name, info.backend),
444 batch: BATCH,515 batch: BATCH,
445 pool: std::cell::RefCell::new(None),516 pool: std::cell::RefCell::new(None),
517+ lost,
446 })518 })
447 }519 }
448 520
@@ -464,7 +536,10 @@ impl GpuCracker {
464 if n == 0 {536 if n == 0 {
465 return None;537 return None;
466 }538 }
467- debug_assert!(n <= self.batch as usize, "kernel buffers sized for one batch");539+ debug_assert!(
540+ n <= self.batch as usize,
541+ "kernel buffers sized for one batch"
542+ );
468 debug_assert_eq!(params.len(), PARAM_U32);543 debug_assert_eq!(params.len(), PARAM_U32);
469 544
470 let slot = {545 let slot = {
@@ -487,7 +562,8 @@ impl GpuCracker {
487 )562 )
488 };563 };
489 564
490- self.queue.write_buffer(&param_buf, 0, u32s_as_bytes(params));565+ self.queue
566+ .write_buffer(&param_buf, 0, u32s_as_bytes(params));
491 self.queue.write_buffer(&hit_buf, 0, &[0u8; 16]);567 self.queue.write_buffer(&hit_buf, 0, &[0u8; 16]);
492 self.queue.write_buffer(&in_buf, 0, u32s_as_bytes(inputs));568 self.queue.write_buffer(&in_buf, 0, u32s_as_bytes(inputs));
493 569
@@ -502,7 +578,11 @@ impl GpuCracker {
502 label: Some("pbkdf2-pass"),578 label: Some("pbkdf2-pass"),
503 timestamp_writes: None,579 timestamp_writes: None,
504 });580 });
505- pass.set_pipeline(if pmk_pipeline { &self.pmk_pipeline } else { &self.pipeline });581+ pass.set_pipeline(if pmk_pipeline {
582+ &self.pmk_pipeline
583+ } else {
584+ &self.pipeline
585+ });
506 pass.set_bind_group(0, &bind_group, &[]);586 pass.set_bind_group(0, &bind_group, &[]);
507 // Two candidates per thread.587 // Two candidates per thread.
508 pass.dispatch_workgroups(n.div_ceil(WORKGROUP_SIZE as usize) as u32, 1, 1);588 pass.dispatch_workgroups(n.div_ceil(WORKGROUP_SIZE as usize) as u32, 1, 1);
@@ -511,13 +591,9 @@ impl GpuCracker {
511 Readback::Hits => {591 Readback::Hits => {
512 encoder.copy_buffer_to_buffer(&hit_buf, 0, &read_buf, 0, readback.bytes() as u64)592 encoder.copy_buffer_to_buffer(&hit_buf, 0, &read_buf, 0, readback.bytes() as u64)
513 }593 }
514- Readback::Pmks(_) => encoder.copy_buffer_to_buffer(594+ Readback::Pmks(_) => {
515- &out_buf,595+ encoder.copy_buffer_to_buffer(&out_buf, 0, &read_buf, 0, readback.bytes() as u64)
516- 0,596+ }
517- &read_buf,
518- 0,
519- readback.bytes() as u64,
520- ),
521 }597 }
522 let sub = self.queue.submit([encoder.finish()]);598 let sub = self.queue.submit([encoder.finish()]);
523 599
@@ -528,17 +604,36 @@ impl GpuCracker {
528 let _ = tx.send(res);604 let _ = tx.send(res);
529 });605 });
530 606
531- Some(PendingKernel { read_buf, slot, rx, sub, read_u32 })607+ Some(PendingKernel {
608+ read_buf,
609+ slot,
610+ rx,
611+ sub,
612+ read_u32,
613+ })
532 }614 }
533 615
534- /// Wait on a dispatched kernel (timeout: hung/compute-heavy dispatch)616+ /// Wait on a dispatched kernel (deadline: hung/compute-heavy dispatch)
535- /// and read back the requested words. None on device-lost/hang. The617+ /// and read back the requested words. The pool slot is freed for the
536- /// pool slot is freed for the next dispatch.618+ /// next dispatch on every path. Error classification:
537- fn wait_kernel(&self, pending: PendingKernel) -> Option<Vec<u32>> {619+ /// [`GpuError::Lost`] when wgpu reports the device gone (lost callback
538- let PendingKernel { read_buf, slot, rx, sub, read_u32 } = pending;620+ /// fired, or poll rejects our submission index), [`GpuError::Timeout`]
621+ /// at the 30 s dispatch deadline, [`GpuError::Unsupported`] for a
622+ /// bare map_async/readback failure with the device nominally alive.
623+ fn wait_kernel(&self, pending: PendingKernel) -> Result<Vec<u32>, GpuError> {
624+ let PendingKernel {
625+ read_buf,
626+ slot,
627+ rx,
628+ sub,
629+ read_u32,
630+ } = pending;
539 // Any exit path returns the slot; a wedged slot must not deadlock631 // Any exit path returns the slot; a wedged slot must not deadlock
540 // a later run.632 // a later run.
541- let _guard = SlotGuard { pool: &self.pool, slot };633+ let _guard = SlotGuard {
634+ pool: &self.pool,
635+ slot,
636+ };
542 637
543 let mut waited = Duration::ZERO;638 let mut waited = Duration::ZERO;
544 let step = Duration::from_millis(8);639 let step = Duration::from_millis(8);
@@ -555,40 +650,73 @@ impl GpuCracker {
555 Err(e) => {650 Err(e) => {
556 tracing::warn!("map_async failed: {e}");651 tracing::warn!("map_async failed: {e}");
557 read_buf.unmap();652 read_buf.unmap();
558- return None;653+ return Err(if self.lost.load(Ordering::Relaxed) {
654+ GpuError::Lost
655+ } else {
656+ GpuError::Unsupported(format!("readback map failed: {e}"))
657+ });
559 }658 }
560 }659 }
561 }660 }
562 waited += step;661 waited += step;
563 if waited >= limit {662 if waited >= limit {
564- tracing::warn!("gpu dispatch timed out after {limit:?}");663+ let err = if self.lost.load(Ordering::Relaxed) {
565- return None;664+ GpuError::Lost
665+ } else {
666+ tracing::warn!("gpu dispatch timed out after {limit:?}");
667+ GpuError::Timeout
668+ };
669+ return Err(err);
566 }670 }
567 }671 }
568 Err(e) => {672 Err(e) => {
569 tracing::warn!("device poll error: {e}");673 tracing::warn!("device poll error: {e}");
570- return None;674+ return Err(if self.lost.load(Ordering::Relaxed) {
675+ GpuError::Lost
676+ } else {
677+ GpuError::Unsupported(format!("device poll error: {e}"))
678+ });
571 }679 }
572 }680 }
573 }681 }
574 682
575 let bytes = read_u32 * 4;683 let bytes = read_u32 * 4;
576- let view = read_buf.slice(..bytes as u64).get_mapped_range().ok()?;684+ let view = read_buf
685+ .slice(..bytes as u64)
686+ .get_mapped_range()
687+ .map_err(|e| {
688+ if self.lost.load(Ordering::Relaxed) {
689+ GpuError::Lost
690+ } else {
691+ GpuError::Unsupported(format!("readback range map failed: {e}"))
692+ }
693+ })?;
577 let mut out = Vec::with_capacity(read_u32);694 let mut out = Vec::with_capacity(read_u32);
578- for chunk in view[..bytes].chunks_exact(4) {695+ for chunk in view[..bytes].as_chunks::<4>().0 {
579- out.push(u32::from_le_bytes([chunk[0], chunk[1], chunk[2], chunk[3]]));696+ out.push(u32::from_le_bytes(*chunk));
580 }697 }
581 drop(view);698 drop(view);
582 read_buf.unmap();699 read_buf.unmap();
583- Some(out)700+ Ok(out)
584 }701 }
585 702
586 /// Compute PMKs for a word batch (rainbow-table build; `pmk_out`703 /// Compute PMKs for a word batch (rainbow-table build; `pmk_out`
587- /// pipeline). Halves the batch size once on device-lost/timeout; on a704+ /// pipeline). On a device-lost/timeout the batch is halved ONCE and
588- /// repeated failure returns None.705+ /// retried: a successful retry returns PMKs for that HALF ONLY — the
589- pub(crate) fn pmk_batch_gpu(&self, words: &[Vec<u8>], salt: &[u8]) -> Option<Vec<[u8; 32]>> {706+ /// returned Vec MAY BE A PREFIX of `words`. No silent tail loss is
707+ /// possible: `pmks.len()` tells the caller where the uncomputed tail
708+ /// starts (loop it until all words have PMKs). A repeated failure
709+ /// surfaces as [`GpuError`].
710+ pub(crate) fn pmk_batch_gpu(
711+ &self,
712+ words: &[Vec<u8>],
713+ salt: &[u8],
714+ ) -> Result<Vec<[u8; 32]>, GpuError> {
590 if salt.len() > 51 {715 if salt.len() > 51 {
591- return None;716+ return Err(GpuError::Unsupported(format!(
717+ "salt/essid of {} bytes exceeds the shader's 51-byte one-block limit",
718+ salt.len()
719+ )));
592 }720 }
593 let mut params = vec![0u32; PARAM_U32];721 let mut params = vec![0u32; PARAM_U32];
594 params[0] = ITERATIONS << 1;722 params[0] = ITERATIONS << 1;
@@ -597,30 +725,44 @@ impl GpuCracker {
597 params[P_HEADER..P_HEADER + 16].copy_from_slice(&u1);725 params[P_HEADER..P_HEADER + 16].copy_from_slice(&u1);
598 params[P_HEADER + 16..P_HEADER + 32].copy_from_slice(&u2);726 params[P_HEADER + 16..P_HEADER + 32].copy_from_slice(&u2);
599 727
600- let mut cur: Vec<Vec<u8>> = words.to_vec();728+ let mut cur: &[Vec<u8>] = words;
601- let mut attempts = 0u8;729+ let mut retried = false;
602 loop {730 loop {
603 params[4] = cur.len() as u32;731 params[4] = cur.len() as u32;
604- let inputs = pack_candidates(&cur);732+ let inputs = pack_candidates(cur);
605- let sub =733+ let Some(sub) = self.submit_kernel(&inputs, &params, Readback::Pmks(cur.len()), true)
606- self.submit_kernel(&inputs, &params, Readback::Pmks(cur.len()), true)?;734+ else {
607- if let Some(out) = self.wait_kernel(sub) {735+ // Empty input: nothing to compute, definitely no error.
608- let mut pmks = Vec::with_capacity(cur.len());736+ return Ok(Vec::new());
609- for row in out.chunks_exact(U32_PER_CAND_OUT) {737+ };
610- let mut pmk = [0u8; 32];738+ match self.wait_kernel(sub) {
611- for (i, w) in row[..8].iter().enumerate() {739+ Ok(out) => {
612- pmk[i * 4..i * 4 + 4].copy_from_slice(&w.to_be_bytes());740+ let mut pmks = Vec::with_capacity(cur.len());
741+ for row in out.as_chunks::<U32_PER_CAND_OUT>().0 {
742+ let mut pmk = [0u8; 32];
743+ for (i, w) in row[..8].iter().enumerate() {
744+ pmk[i * 4..i * 4 + 4].copy_from_slice(&w.to_be_bytes());
745+ }
746+ pmks.push(pmk);
613 }747 }
614- pmks.push(pmk);748+ return Ok(pmks);
749+ }
750+ Err(e) => {
751+ if retried || cur.len() == 1 {
752+ // Retry already failed too; surface the freshest
753+ // error (same device state produced both).
754+ return Err(e);
755+ }
756+ // Halve once and retry; the prefix contract above.
757+ tracing::warn!(
758+ "pmk batch of {} failed ({e}); halving and retrying",
759+ cur.len()
760+ );
761+ let half = cur.len().div_ceil(2);
762+ cur = &cur[..half];
763+ retried = true;
615 }764 }
616- return Some(pmks);
617- }
618- attempts += 1;
619- if attempts > 1 || cur.len() == 1 {
620- return None;
621 }765 }
622- let half = cur.len().div_ceil(2);
623- cur = cur[..half].to_vec();
624 }766 }
625 }767 }
626 768
@@ -628,6 +770,13 @@ impl GpuCracker {
628 /// finished batch. Honors `stop` between batches. Returns the770 /// finished batch. Honors `stop` between batches. Returns the
629 /// passphrase on an on-device MIC/PMKID match (hit-slot readback).771 /// passphrase on an on-device MIC/PMKID match (hit-slot readback).
630 ///772 ///
773+ /// `Ok(None)` means ONLY "iterator exhausted" or "stop requested" —
774+ /// backend failures (device lost, 30 s dispatch deadline, map_async
775+ /// failure) surface as [`GpuError`] so the caller can log them as
776+ /// `Event::CrackError` instead of mistaking them for exhaustion.
777+ /// Routing a non-verifiable target here (see [`gpu_verifiable`]) is
778+ /// `Err(GpuError::Unsupported(..))`, not a silent miss.
779+ ///
631 /// The kernel verifies candidates itself: per batch the host packs780 /// The kernel verifies candidates itself: per batch the host packs
632 /// raw bytes (memcpy-rate), uploads 64B/candidate and read back a781 /// raw bytes (memcpy-rate), uploads 64B/candidate and read back a
633 /// 16-byte hit slot — the previous midstate/upload + CPU-MIC phases782 /// 16-byte hit slot — the previous midstate/upload + CPU-MIC phases
@@ -638,8 +787,13 @@ impl GpuCracker {
638 words: &mut dyn Iterator<Item = Vec<u8>>,787 words: &mut dyn Iterator<Item = Vec<u8>>,
639 progress: &mut dyn FnMut(u64, f64),788 progress: &mut dyn FnMut(u64, f64),
640 stop: &Arc<AtomicBool>,789 stop: &Arc<AtomicBool>,
641- ) -> Option<String> {790+ ) -> Result<Option<String>, GpuError> {
642- let ctx = gpu_ctx(target)?;791+ let ctx = gpu_ctx(target).ok_or_else(|| {
792+ GpuError::Unsupported(
793+ "target not expressible in the SHA1 shader (key_ver/length); route via gpu_verifiable"
794+ .to_string(),
795+ )
796+ })?;
643 let mut done = 0u64;797 let mut done = 0u64;
644 let started = Instant::now();798 let started = Instant::now();
645 let batch_cap = self.batch as usize;799 let batch_cap = self.batch as usize;
@@ -668,19 +822,22 @@ impl GpuCracker {
668 822
669 let mut cur_words = collect(words, batch_cap);823 let mut cur_words = collect(words, batch_cap);
670 if cur_words.is_empty() {824 if cur_words.is_empty() {
671- return None;825+ return Ok(None);
672 }826 }
673- let mut pending = Some(self.submit_kernel(827+ let mut pending = Some(
674- &pack_candidates(&cur_words),828+ self.submit_kernel(
675- &ctx.params_words(cur_words.len() as u32),829+ &pack_candidates(&cur_words),
676- Readback::Hits,830+ &ctx.params_words(cur_words.len() as u32),
677- false,831+ Readback::Hits,
678- )?);832+ false,
833+ )
834+ .expect("non-empty batch must dispatch"),
835+ );
679 836
680 loop {837 loop {
681 if stop.load(Ordering::Relaxed) {838 if stop.load(Ordering::Relaxed) {
682 drain(pending.take());839 drain(pending.take());
683- return None;840+ return Ok(None);
684 }841 }
685 // While the GPU verifies batch N on-device: fetch + pack the842 // While the GPU verifies batch N on-device: fetch + pack the
686 // next batch and hand it to the GPU as soon as possible.843 // next batch and hand it to the GPU as soon as possible.
@@ -688,18 +845,24 @@ impl GpuCracker {
688 let next_pending = if next_words.is_empty() {845 let next_pending = if next_words.is_empty() {
689 None846 None
690 } else {847 } else {
691- Some(self.submit_kernel(848+ Some(
692- &pack_candidates(&next_words),849+ self.submit_kernel(
693- &ctx.params_words(next_words.len() as u32),850+ &pack_candidates(&next_words),
694- Readback::Hits,851+ &ctx.params_words(next_words.len() as u32),
695- false,852+ Readback::Hits,
696- )?)853+ false,
854+ )
855+ .expect("non-empty batch must dispatch"),
856+ )
697 };857 };
698 858
699 let cur_pending = pending.take().expect("pipeline: one batch in flight");859 let cur_pending = pending.take().expect("pipeline: one batch in flight");
700- let Some(hit) = self.wait_kernel(cur_pending) else {860+ let hit = match self.wait_kernel(cur_pending) {
701- drain(next_pending);861+ Ok(hit) => hit,
702- return None;862+ Err(e) => {
863+ drain(next_pending);
864+ return Err(e);
865+ }
703 };866 };
704 // A hit slot write is dispatched-and-completed before the map867 // A hit slot write is dispatched-and-completed before the map
705 // resolves: flag==1 with gid valid.868 // resolves: flag==1 with gid valid.
@@ -708,13 +871,15 @@ impl GpuCracker {
708 let gid = hit[1] as usize;871 let gid = hit[1] as usize;
709 done += gid as u64 + 1;872 done += gid as u64 + 1;
710 tick(done, started, progress);873 tick(done, started, progress);
711- return cur_words.get(gid).and_then(|w| String::from_utf8(w.clone()).ok());874+ return Ok(cur_words
875+ .get(gid)
876+ .and_then(|w| String::from_utf8(w.clone()).ok()));
712 }877 }
713 done += cur_words.len() as u64;878 done += cur_words.len() as u64;
714 tick(done, started, progress);879 tick(done, started, progress);
715 880
716 let Some(next_pending) = next_pending else {881 let Some(next_pending) = next_pending else {
717- return None; // stream exhausted; nothing in flight882+ return Ok(None); // stream exhausted; nothing in flight
718 };883 };
719 cur_words = next_words;884 cur_words = next_words;
720 pending = Some(next_pending);885 pending = Some(next_pending);
@@ -757,11 +922,13 @@ impl CpuPmkSink {
757 922
758 /// Write `(pmk, word)`; errors log once and then disable the sink.923 /// Write `(pmk, word)`; errors log once and then disable the sink.
759 pub fn push(&mut self, pmk: &[u8; 32], word: &[u8]) {924 pub fn push(&mut self, pmk: &[u8; 32], word: &[u8]) {
760- if let Some(w) = &mut self.w {925+ if let Some(w) = &mut self.w
761- if let Err(e) = w.push(pmk, word) {926+ && let Err(e) = w.push(pmk, word)
762- (self.log)(format!("pmk cache: write failed ({e}) — cache left partial"));927+ {
763- self.w = None;928+ (self.log)(format!(
764- }929+ "pmk cache: write failed ({e}) — cache left partial"
930+ ));
931+ self.w = None;
765 }932 }
766 }933 }
767 934
@@ -857,7 +1024,7 @@ mod tests {
857 let key = crypto::pmk(pass, ssid.as_bytes());1024 let key = crypto::pmk(pass, ssid.as_bytes());
858 let dk = crypto::ptk(&key, &ap, &sta, &anonce, &snonce);1025 let dk = crypto::ptk(&key, &ap, &sta, &anonce, &snonce);
859 let frame = build_eapol_m2(key_ver, &snonce, 1);1026 let frame = build_eapol_m2(key_ver, &snonce, 1);
860- let m = crypto::mic(&dk, &frame, key_ver);1027+ let m = crypto::mic_on_zeroed(&dk, &crypto::zeroed_eapol(&frame), key_ver);
861 CrackTarget::Handshake(crate::common::HandshakeCapture::new(1028 CrackTarget::Handshake(crate::common::HandshakeCapture::new(
862 ap,1029 ap,
863 sta,1030 sta,
@@ -908,11 +1075,13 @@ mod tests {
908 eprintln!("no GPU adapter, skipping");1075 eprintln!("no GPU adapter, skipping");
909 return;1076 return;
910 };1077 };
911- let salt = b"parafin";1078+ let salt = b"testnet";
912 let words: Vec<Vec<u8>> = (0..16)1079 let words: Vec<Vec<u8>> = (0..16)
913 .map(|i| format!("cand{:06}", i).into_bytes())1080 .map(|i| format!("cand{:06}", i).into_bytes())
914 .collect();1081 .collect();
915- let pmks = crk.pmk_batch_gpu(&words, salt).expect("kernel must complete");1082+ let pmks = crk
1083+ .pmk_batch_gpu(&words, salt)
1084+ .expect("kernel must complete");
916 assert_eq!(pmks.len(), words.len());1085 assert_eq!(pmks.len(), words.len());
917 for (w, k) in words.iter().zip(pmks.iter()) {1086 for (w, k) in words.iter().zip(pmks.iter()) {
918 let mut dk = [0u8; 40];1087 let mut dk = [0u8; 40];
@@ -930,14 +1099,19 @@ mod tests {
930 eprintln!("no GPU adapter, skipping");1099 eprintln!("no GPU adapter, skipping");
931 return;1100 return;
932 };1101 };
933- let target = synthetic_target("parafin", b"sup3r-secret", 2);1102+ let target = synthetic_target("testnet", b"sup3r-secret", 2);
934 const N: usize = 65536 * 6;1103 const N: usize = 65536 * 6;
935- let words: Vec<Vec<u8>> = (0..N).map(|i| format!("probe{i:09}").into_bytes()).collect();1104+ let words: Vec<Vec<u8>> = (0..N)
1105+ .map(|i| format!("probe{i:09}").into_bytes())
1106+ .collect();
936 let mut it = words.into_iter();1107 let mut it = words.into_iter();
937 let stop = Arc::new(AtomicBool::new(false));1108 let stop = Arc::new(AtomicBool::new(false));
938 let t0 = Instant::now();1109 let t0 = Instant::now();
939 let found = crk.crack(&target, &mut it, &mut |_, _| {}, &stop);1110 let found = crk.crack(&target, &mut it, &mut |_, _| {}, &stop);
940- assert!(found.is_none());1111+ assert!(
1112+ matches!(found, Ok(None)),
1113+ "unexpected crack result: {found:?}"
1114+ );
941 let wall = t0.elapsed().as_secs_f64();1115 let wall = t0.elapsed().as_secs_f64();
942 eprintln!(1116 eprintln!(
943 "full crack loop on {}: {:.0} H/s effective ({} candidates in {:.2}s)",1117 "full crack loop on {}: {:.0} H/s effective ({} candidates in {:.2}s)",
@@ -958,7 +1132,7 @@ mod tests {
958 };1132 };
959 eprintln!("gpu device: {}", crk.device_name());1133 eprintln!("gpu device: {}", crk.device_name());
960 let pass = b"sup3r-secret";1134 let pass = b"sup3r-secret";
961- let target = synthetic_target("parafin", pass, 2);1135+ let target = synthetic_target("testnet", pass, 2);
962 1136
963 const TOTAL: usize = 5000;1137 const TOTAL: usize = 5000;
964 let mut idx = 0usize;1138 let mut idx = 0usize;
@@ -975,15 +1149,17 @@ mod tests {
975 let mut it = words.into_iter();1149 let mut it = words.into_iter();
976 let stop = Arc::new(AtomicBool::new(false));1150 let stop = Arc::new(AtomicBool::new(false));
977 let (mut last_done, mut last_hps) = (0u64, 0f64);1151 let (mut last_done, mut last_hps) = (0u64, 0f64);
978- let found = crk.crack(1152+ let found = crk
979- &target,1153+ .crack(
980- &mut it,1154+ &target,
981- &mut |d, h| {1155+ &mut it,
982- last_done = d;1156+ &mut |d, h| {
983- last_hps = h;1157+ last_done = d;
984- },1158+ last_hps = h;
985- &stop,1159+ },
986- );1160+ &stop,
1161+ )
1162+ .expect("backend must not fail on this dispatch");
987 assert_eq!(found.as_deref(), Some("sup3r-secret"));1163 assert_eq!(found.as_deref(), Some("sup3r-secret"));
988 // crack returns at the hit batch, possibly before end-of-batch.1164 // crack returns at the hit batch, possibly before end-of-batch.
989 assert!(last_done <= 65536, "progress reported {last_done}");1165 assert!(last_done <= 65536, "progress reported {last_done}");
@@ -996,11 +1172,13 @@ mod tests {
996 eprintln!("no GPU adapter, skipping");1172 eprintln!("no GPU adapter, skipping");
997 return;1173 return;
998 };1174 };
999- let target = synthetic_pmkid("parafin", b"hunter2!!");1175+ let target = synthetic_pmkid("testnet", b"hunter2!!");
1000 let words: Vec<Vec<u8>> = vec![b"nope-nope".to_vec(), b"hunter2!!".to_vec()];1176 let words: Vec<Vec<u8>> = vec![b"nope-nope".to_vec(), b"hunter2!!".to_vec()];
1001 let mut it = words.into_iter();1177 let mut it = words.into_iter();
1002 let stop = Arc::new(AtomicBool::new(false));1178 let stop = Arc::new(AtomicBool::new(false));
1003- let found = crk.crack(&target, &mut it, &mut |_, _| {}, &stop);1179+ let found = crk
1180+ .crack(&target, &mut it, &mut |_, _| {}, &stop)
1181+ .expect("backend must not fail on this dispatch");
1004 assert_eq!(found.as_deref(), Some("hunter2!!"));1182 assert_eq!(found.as_deref(), Some("hunter2!!"));
1005 }1183 }
1006 1184
@@ -1011,14 +1189,27 @@ mod tests {
1011 return;1189 return;
1012 };1190 };
1013 // Wrong candidate must NOT trip the on-device verifier.1191 // Wrong candidate must NOT trip the on-device verifier.
1014- let target = synthetic_target("parafin", b"sup3r-secret", 2);1192+ let target = synthetic_target("testnet", b"sup3r-secret", 2);
1015- let words: Vec<Vec<u8>> = (0..64).map(|i| format!("zz{:07}", i).into_bytes()).collect();1193+ let words: Vec<Vec<u8>> = (0..64)
1194+ .map(|i| format!("zz{:07}", i).into_bytes())
1195+ .collect();
1016 let mut it = words.into_iter();1196 let mut it = words.into_iter();
1017 let stop = Arc::new(AtomicBool::new(false));1197 let stop = Arc::new(AtomicBool::new(false));
1018- assert!(crk.crack(&target, &mut it, &mut |_, _| {}, &stop).is_none());1198+ assert_eq!(
1199+ crk.crack(&target, &mut it, &mut |_, _| {}, &stop).ok(),
1200+ Some(None)
1201+ );
1019 // key_ver 3 (AES-CMAC) is not expressible in the SHA1 shader.1202 // key_ver 3 (AES-CMAC) is not expressible in the SHA1 shader.
1020- let kv3 = synthetic_target("parafin", b"sup3r-secret", 3);1203+ let kv3 = synthetic_target("testnet", b"sup3r-secret", 3);
1021 assert!(!gpu_verifiable(&kv3));1204 assert!(!gpu_verifiable(&kv3));
1205+ // key_ver 1 (HMAC-MD5, WPA1-TKIP) epilogue is CPU-only as well.
1206+ let kv1 = synthetic_target("testnet", b"sup3r-secret", 1);
1207+ assert!(!gpu_verifiable(&kv1));
1208+ // ...and crack refuses a non-verifiable target loudly, not with a
1209+ // silently-None "miss".
1210+ let mut no_words = Vec::new().into_iter();
1211+ let res = crk.crack(&kv3, &mut no_words, &mut |_, _| {}, &stop);
1212+ assert!(matches!(res, Err(GpuError::Unsupported(_))));
1022 // ...and long ESSIDs (spill the one-block U message) route to CPU.1213 // ...and long ESSIDs (spill the one-block U message) route to CPU.
1023 let long = synthetic_target(&"s".repeat(52), b"sup3r-secret", 2);1214 let long = synthetic_target(&"s".repeat(52), b"sup3r-secret", 2);
1024 assert!(!gpu_verifiable(&long));1215 assert!(!gpu_verifiable(&long));
@@ -1027,12 +1218,16 @@ mod tests {
1027 #[test]1218 #[test]
1028 fn cpu_crack_finds_pass() {1219 fn cpu_crack_finds_pass() {
1029 let pass = b"sup3r-secret";1220 let pass = b"sup3r-secret";
1030- let target = synthetic_target("parafin", pass, 2);1221+ let target = synthetic_target("testnet", pass, 2);
1031 let mut idx = 0usize;1222 let mut idx = 0usize;
1032 let words: Vec<Vec<u8>> = (0..500)1223 let words: Vec<Vec<u8>> = (0..500)
1033 .map(|_| {1224 .map(|_| {
1034 idx += 1;1225 idx += 1;
1035- if idx == 300 { pass.to_vec() } else { format!("cpu{:07}", idx).into_bytes() }1226+ if idx == 300 {
1227+ pass.to_vec()
1228+ } else {
1229+ format!("cpu{:07}", idx).into_bytes()
1230+ }
1036 })1231 })
1037 .collect();1232 .collect();
1038 let mut it = words.into_iter();1233 let mut it = words.into_iter();
@@ -1045,11 +1240,11 @@ mod tests {
1045 fn cpu_crack_pmkid() {1240 fn cpu_crack_pmkid() {
1046 let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();1241 let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();
1047 let sta = "11:22:33:44:55:66".parse::<MacAddr>().unwrap();1242 let sta = "11:22:33:44:55:66".parse::<MacAddr>().unwrap();
1048- let key = crypto::pmk(b"hunter2!!", b"parafin");1243+ let key = crypto::pmk(b"hunter2!!", b"testnet");
1049 let target = CrackTarget::Pmkid(crate::common::PmkidCapture {1244 let target = CrackTarget::Pmkid(crate::common::PmkidCapture {
1050 ap,1245 ap,
1051 client: sta,1246 client: sta,
1052- essid: "parafin".to_string(),1247+ essid: "testnet".to_string(),
1053 pmkid: crypto::pmkid_hash(&key, &ap, &sta),1248 pmkid: crypto::pmkid_hash(&key, &ap, &sta),
1054 });1249 });
1055 let words: Vec<Vec<u8>> = vec![b"nope-nope".to_vec(), b"hunter2!!".to_vec()];1250 let words: Vec<Vec<u8>> = vec![b"nope-nope".to_vec(), b"hunter2!!".to_vec()];
@@ -1062,15 +1257,97 @@ mod tests {
1062 #[test]1257 #[test]
1063 fn stop_flag_short_circuits() {1258 fn stop_flag_short_circuits() {
1064 let pass = b"sup3r-secret";1259 let pass = b"sup3r-secret";
1065- let target = synthetic_target("parafin", pass, 2);1260+ let target = synthetic_target("testnet", pass, 2);
1066- let words: Vec<Vec<u8>> = (0..2000).map(|i| format!("zz{:07}", i).into_bytes()).collect();1261+ let words: Vec<Vec<u8>> = (0..2000)
1262+ .map(|i| format!("zz{:07}", i).into_bytes())
1263+ .collect();
1067 let mut it = words.into_iter();1264 let mut it = words.into_iter();
1068 let stop = Arc::new(AtomicBool::new(true));1265 let stop = Arc::new(AtomicBool::new(true));
1069 assert!(cpu_crack(&target, &mut it, &mut |_, _| {}, &stop, None).is_none());1266 assert!(cpu_crack(&target, &mut it, &mut |_, _| {}, &stop, None).is_none());
1070 if let Some(crk) = GpuCracker::try_new() {1267 if let Some(crk) = GpuCracker::try_new() {
1071- let words2: Vec<Vec<u8>> = (0..2000).map(|i| format!("zz{:07}", i).into_bytes()).collect();1268+ let words2: Vec<Vec<u8>> = (0..2000)
1269+ .map(|i| format!("zz{:07}", i).into_bytes())
1270+ .collect();
1072 let mut it2 = words2.into_iter();1271 let mut it2 = words2.into_iter();
1073- assert!(crk.crack(&target, &mut it2, &mut |_, _| {}, &stop).is_none());1272+ assert_eq!(
1273+ crk.crack(&target, &mut it2, &mut |_, _| {}, &stop).ok(),
1274+ Some(None)
1275+ );
1276+ }
1277+ }
1278+
1279+ /// Regression: a zeroed EAPOL frame needing more than 3 padded SHA1
1280+ /// blocks (frame + 0x80 + bitlen > 192 B, i.e. frame > 183 B)
1281+ /// previously panicked the fixed `blk2[..w2.len()]` copy. It must now
1282+ /// route to the CPU path (gpu_ctx None) — boundary-length frames stay
1283+ /// expressible. No GPU needed: host-only fn.
1284+ #[test]
1285+ fn gpu_ctx_rejects_overlong_eapol() {
1286+ let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();
1287+ let sta = "11:22:33:44:55:66".parse::<MacAddr>().unwrap();
1288+ let anonce = [0x5a; 32];
1289+ let snonce = [0xc3; 32];
1290+ let mk = |eapol_len: usize| {
1291+ CrackTarget::Handshake(crate::common::HandshakeCapture::new(
1292+ ap,
1293+ sta,
1294+ "testnet".to_string(),
1295+ anonce,
1296+ snonce,
1297+ [0u8; 16],
1298+ vec![0x01; eapol_len],
1299+ 2,
1300+ ))
1301+ };
1302+ // 184 bytes: pads to 4 blocks (> P_BLK's 3) — must NOT panic.
1303+ assert!(
1304+ gpu_ctx(&mk(184)).is_none(),
1305+ "overlong frame must route to CPU"
1306+ );
1307+ assert!(
1308+ gpu_ctx(&mk(500)).is_none(),
1309+ "absurd frame must route to CPU"
1310+ );
1311+ // Boundary: 99 (minimum M2 frame) and 183 (largest fitting) stay.
1312+ assert!(
1313+ gpu_ctx(&mk(99)).is_some(),
1314+ "min M2 frame must stay GPU-verifiable"
1315+ );
1316+ assert!(
1317+ gpu_ctx(&mk(183)).is_some(),
1318+ "largest 3-block frame must stay GPU-verifiable"
1319+ );
1320+ }
1321+
1322+ /// key_ver 1 (HMAC-MD5) and 3 (AES-CMAC) handshakes: the shader's
1323+ /// epilogue is HMAC-SHA1-only; both must route CPU-side from gpu_ctx.
1324+ #[test]
1325+ fn gpu_ctx_routes_non_sha1_key_vers() {
1326+ let ap = "aa:bb:cc:dd:ee:ff".parse::<MacAddr>().unwrap();
1327+ let sta = "11:22:33:44:55:66".parse::<MacAddr>().unwrap();
1328+ let frame = vec![0x01; 99];
1329+ for kv in [1u8, 3] {
1330+ let t = CrackTarget::Handshake(crate::common::HandshakeCapture::new(
1331+ ap,
1332+ sta,
1333+ "testnet".to_string(),
1334+ [0x5a; 32],
1335+ [0xc3; 32],
1336+ [0u8; 16],
1337+ frame.clone(),
1338+ kv,
1339+ ));
1340+ assert!(gpu_ctx(&t).is_none(), "key_ver {kv} must route to CPU");
1074 }1341 }
1075 }1342 }
1343+
1344+ #[test]
1345+ fn gpu_error_display_is_actionable() {
1346+ assert!(GpuError::Lost.to_string().contains("device lost"));
1347+ assert!(GpuError::Timeout.to_string().contains("timed out"));
1348+ assert!(GpuError::Unsupported("x".into()).to_string().contains('x'));
1349+ // std::error::Error is implemented (crack agents box it).
1350+ let e: &dyn std::error::Error = &GpuError::Lost;
1351+ assert!(!e.to_string().is_empty());
1352+ }
1076 }1353 }
src/handshake.rsmodified+308 -65
@@ -1,8 +1,10 @@
1 //! 4-way handshake tracker + hashcat-22000 export.1 //! 4-way handshake tracker + hashcat-22000 export.
2 //!2 //!
3 //! A capture is crackable once we hold M1 (ANonce) and a matching M23 //! A capture is crackable once we hold M1 (ANonce) and a matching M2
4-//! (SNonce + MIC) with a consistent replay counter. M3/M4 only inform4+//! (SNonce + MIC) with a consistent replay counter. M4 only informs
5-//! progress — they cannot substitute for the M2 pair.5+//! progress; an M2+M3 pair that never completed (ANonce from M3, SNonce
6+//! from M2) is still crackable material and is drained as a *partial*
7+//! capture at session teardown via [`Tracker::take_partials`].
6 8
7 use std::collections::HashMap;9 use std::collections::HashMap;
8 use std::sync::Arc;10 use std::sync::Arc;
@@ -25,20 +27,28 @@ const STATE_TTL: Duration = Duration::from_secs(120);
25 struct PairState {27 struct PairState {
26 m1: Option<Msg>,28 m1: Option<Msg>,
27 m2: Option<Msg>,29 m2: Option<Msg>,
28- m3: bool,30+ /// Newest M2 that never paired an M1 (partial-capture material).
31+ unpaired_m2: Option<Msg>,
32+ /// M3 seen at least once (progress bitmask).
33+ m3_seen: bool,
34+ /// Newest M3 with nonzero MIC+nonce (partial-capture material).
35+ m3_msg: Option<Msg>,
29 m4: bool,36 m4: bool,
37+ /// Latest non-empty essid heard for this pair (partials need the salt).
38+ essid: Option<String>,
30 /// Last time any message for this pair arrived.39 /// Last time any message for this pair arrived.
31 touched: Option<Instant>,40 touched: Option<Instant>,
32 /// Set once HandshakeComplete has been emitted (don't re-fire).41 /// Set once HandshakeComplete has been emitted (don't re-fire).
33 done: bool,42 done: bool,
34 }43 }
35 44
45+#[derive(Clone)]
36 struct Msg {46 struct Msg {
37 replay_counter: u64,47 replay_counter: u64,
38 nonce: [u8; 32],48 nonce: [u8; 32],
39 mic: [u8; 16],49 mic: [u8; 16],
40 key_ver: u8,50 key_ver: u8,
41- /// Full EAPOL frame starting at the version byte (M2 only needs it).51+ /// Full EAPOL frame starting at the version byte (M2/M3 need it).
42 raw: Vec<u8>,52 raw: Vec<u8>,
43 }53 }
44 54
@@ -51,7 +61,7 @@ impl PairState {
51 if self.m2.is_some() {61 if self.m2.is_some() {
52 m |= 1 << 1;62 m |= 1 << 1;
53 }63 }
54- if self.m3 {64+ if self.m3_seen {
55 m |= 1 << 2;65 m |= 1 << 2;
56 }66 }
57 if self.m4 {67 if self.m4 {
@@ -102,6 +112,11 @@ impl Tracker {
102 112
103 let st = self.pairs.entry((ap, sta)).or_default();113 let st = self.pairs.entry((ap, sta)).or_default();
104 st.touched = Some(Instant::now());114 st.touched = Some(Instant::now());
115+ // Partials are built at teardown with no essid argument around —
116+ // remember the latest non-empty one per pair.
117+ if !essid.is_empty() {
118+ st.essid = Some(essid.to_string());
119+ }
105 let mut emit_progress = false;120 let mut emit_progress = false;
106 121
107 match msg_no {122 match msg_no {
@@ -120,28 +135,41 @@ impl Tracker {
120 2 => {135 2 => {
121 // M2: SNonce + MIC must be nonzero to be crackable.136 // M2: SNonce + MIC must be nonzero to be crackable.
122 if key.mic.iter().any(|&b| b != 0) && key.nonce.iter().any(|&b| b != 0) {137 if key.mic.iter().any(|&b| b != 0) && key.nonce.iter().any(|&b| b != 0) {
123- st.m2 = Some(Msg {138+ let msg = Msg {
124 replay_counter: key.replay_counter,139 replay_counter: key.replay_counter,
125 nonce: key.nonce,140 nonce: key.nonce,
126 mic: key.mic,141 mic: key.mic,
127 key_ver: key.key_ver,142 key_ver: key.key_ver,
128 raw: key.raw.to_vec(),143 raw: key.raw.to_vec(),
129- });144+ };
145+ st.m2 = Some(msg.clone());
146+ // M2s arriving after completion are not partials.
147+ if !st.done {
148+ st.unpaired_m2 = Some(msg);
149+ }
130 emit_progress = true;150 emit_progress = true;
131 }151 }
132 }152 }
133 3 => {153 3 => {
134- if !st.m3 {154+ if !st.m3_seen {
135- st.m3 = true;155+ st.m3_seen = true;
136 emit_progress = true;156 emit_progress = true;
137 }157 }
138- }158+ // Partial material: the newest usable M3 (ANonce + MIC).
139- 4 => {159+ if key.mic.iter().any(|&b| b != 0) && key.nonce.iter().any(|&b| b != 0) {
140- if !st.m4 {160+ st.m3_msg = Some(Msg {
141- st.m4 = true;161+ replay_counter: key.replay_counter,
142- emit_progress = true;162+ nonce: key.nonce,
163+ mic: key.mic,
164+ key_ver: key.key_ver,
165+ raw: key.raw.to_vec(),
166+ });
143 }167 }
144 }168 }
169+ 4 if !st.m4 => {
170+ st.m4 = true;
171+ emit_progress = true;
172+ }
145 _ => {}173 _ => {}
146 }174 }
147 175
@@ -162,8 +190,8 @@ impl Tracker {
162 // Replay-counter consistency: rc(M2) == rc(M1); an M1 retransmission190 // Replay-counter consistency: rc(M2) == rc(M1); an M1 retransmission
163 // seen after M2 may be exactly one behind (rc(M1) == rc(M2) - 1),191 // seen after M2 may be exactly one behind (rc(M1) == rc(M2) - 1),
164 // both refer to the same exchange.192 // both refer to the same exchange.
165- let rc_consistent = m1.replay_counter == m2.replay_counter193+ let rc_consistent =
166- || m1.replay_counter + 1 == m2.replay_counter;194+ m1.replay_counter == m2.replay_counter || m1.replay_counter + 1 == m2.replay_counter;
167 if !rc_consistent {195 if !rc_consistent {
168 return None;196 return None;
169 }197 }
@@ -184,6 +212,34 @@ impl Tracker {
184 ))212 ))
185 }213 }
186 214
215+ /// Session-teardown partial capture: every (ap, client) pair that saw
216+ /// BOTH an M2 which never completed an M1+M2 pair AND an M3 yields a
217+ /// [`HandshakeCapture::new_partial`] — ANonce from the newest M3, SNonce
218+ /// from the newest unpaired M2, MIC + EAPOL frame from the M3, key_ver
219+ /// from the M3 key_info. The PTK/MIC math is identical, so these are
220+ /// crackable like complete captures.
221+ ///
222+ /// Pairs that already produced a complete capture are excluded, as are
223+ /// pairs whose essid was never known (no salt → uncrackable). Drained
224+ /// material is dropped: a second call returns nothing until new
225+ /// messages arrive.
226+ pub fn take_partials(&mut self) -> Vec<HandshakeCapture> {
227+ let mut out = Vec::new();
228+ for ((ap, sta), st) in self.pairs.iter_mut() {
229+ if st.done {
230+ continue;
231+ }
232+ let (unpaired_m2, m3) = (st.unpaired_m2.take(), st.m3_msg.take());
233+ let (Some(m2), Some(m3), Some(essid)) = (unpaired_m2, m3, st.essid.clone()) else {
234+ continue;
235+ };
236+ out.push(HandshakeCapture::new_partial(
237+ *ap, *sta, essid, m3.nonce, m2.nonce, m3.mic, m3.raw, m3.key_ver,
238+ ));
239+ }
240+ out
241+ }
242+
187 /// Drop pairs untouched for longer than the replay window.243 /// Drop pairs untouched for longer than the replay window.
188 fn reap(&mut self) {244 fn reap(&mut self) {
189 let now = Instant::now();245 let now = Instant::now();
@@ -201,9 +257,10 @@ fn hex_push(out: &mut String, bytes: &[u8]) {
201 }257 }
202 258
203 /// hashcat -m 22000 WPA-PBKDF2 line for a handshake (message-pair type 02):259 /// hashcat -m 22000 WPA-PBKDF2 line for a handshake (message-pair type 02):
204-/// `WPA*02*mic*mac_ap*mac_client*essid*anonce*eapol_m2*00`260+/// `WPA*02*mic*mac_ap*mac_client*essid*anonce*eapol*<pair>`
205-/// (EAPOL carries the MIC not-zeroed; the `00` message-pair field marks the261+/// (EAPOL carries the MIC not-zeroed; the trailing message-pair field is
206-/// pair replay-verified). The `WPA*` prefix is emitted for modern hashcat.262+/// `00` for a replay-verified M1+M2 capture, `02` for a partial M2+M3 one).
263+/// The `WPA*` prefix is emitted for modern hashcat.
207 pub fn handshake_hc22000(h: &HandshakeCapture) -> String {264 pub fn handshake_hc22000(h: &HandshakeCapture) -> String {
208 let mut s = String::from("WPA*02*");265 let mut s = String::from("WPA*02*");
209 hex_push(&mut s, h.mic());266 hex_push(&mut s, h.mic());
@@ -217,7 +274,7 @@ pub fn handshake_hc22000(h: &HandshakeCapture) -> String {
217 hex_push(&mut s, &h.anonce);274 hex_push(&mut s, &h.anonce);
218 s.push('*');275 s.push('*');
219 hex_push(&mut s, &h.eapol_m2);276 hex_push(&mut s, &h.eapol_m2);
220- s.push_str("*00");277+ s.push_str(if h.partial { "*02" } else { "*00" });
221 s278 s
222 }279 }
223 280
@@ -244,19 +301,22 @@ pub const CAPTURE_POLL_MS: u32 = 250;
244 /// (already bound to a monitor interface on the right channel), tracks301 /// (already bound to a monitor interface on the right channel), tracks
245 /// every EAPOL exchange involving `ap`, and emits302 /// every EAPOL exchange involving `ap`, and emits
246 /// [`Event::HandshakeProgress`]/[`Event::HandshakeComplete`] through the303 /// [`Event::HandshakeProgress`]/[`Event::HandshakeComplete`] through the
247-/// internal [`Tracker`]. Returns `Ok(flow)` once a crackable capture was304+/// internal [`Tracker`]. M1+M2 stays the primary path (HandshakeComplete
248-/// sent, the `stop` flag flipped, or nothing but timeouts arrived for a305+/// fires from inside the loop exactly as before); partial M2+M3 material is
249-/// long stretch — the caller reports whether a capture actually landed.306+/// EXTRA, surfaced only at teardown.
250 ///307 ///
251-/// Additive helper consumed by `backend.rs`; the tracker above is308+/// Returns `Ok((complete, partials))` once a crackable capture was sent,
252-/// untouched.309+/// the `stop` flag flipped, or nothing but timeouts arrived for a long
310+/// stretch: `complete` says a full M1+M2 capture landed, `partials` is the
311+/// tracker's [`Tracker::take_partials`] drain — the caller turns each into
312+/// [`Event::HandshakePartial`].
253 pub fn capture_loop(313 pub fn capture_loop(
254 sock: &RawSocket,314 sock: &RawSocket,
255 targets: &[MacAddr],315 targets: &[MacAddr],
256 essid: &str,316 essid: &str,
257 tx: &Sender<Event>,317 tx: &Sender<Event>,
258 stop: &Arc<AtomicBool>,318 stop: &Arc<AtomicBool>,
259-) -> Result<bool> {319+) -> Result<(bool, Vec<HandshakeCapture>)> {
260 sock.set_timeout(CAPTURE_POLL_MS)?;320 sock.set_timeout(CAPTURE_POLL_MS)?;
261 let _ = tx.send(Event::Log(format!(321 let _ = tx.send(Event::Log(format!(
262 "handshake: listening for 4-way on {} ({essid})",322 "handshake: listening for 4-way on {} ({essid})",
@@ -268,7 +328,8 @@ pub fn capture_loop(
268 )));328 )));
269 329
270 let mut tracker = Tracker::new();330 let mut tracker = Tracker::new();
271- let mut buf = vec![0u8; 4096];331+ let mut buf = vec![0u8; crate::rawsock::RECV_BUFSZ];
332+ let mut truncated_dropped: u64 = 0;
272 // ~4 minutes of dead air without a single EAPOL message → give up.333 // ~4 minutes of dead air without a single EAPOL message → give up.
273 let mut idle_deadline = Instant::now() + Duration::from_secs(240);334 let mut idle_deadline = Instant::now() + Duration::from_secs(240);
274 335
@@ -282,19 +343,19 @@ pub fn capture_loop(
282 343
283 loop {344 loop {
284 if stop.load(Ordering::Relaxed) {345 if stop.load(Ordering::Relaxed) {
285- return Ok(false);346+ return Ok((false, tracker.take_partials()));
286 }347 }
287 if Instant::now() >= idle_deadline {348 if Instant::now() >= idle_deadline {
288- return Ok(false);349+ return Ok((false, tracker.take_partials()));
289 }350 }
290 if last_stats.elapsed() >= STATS_EVERY {351 if last_stats.elapsed() >= STATS_EVERY {
291 last_stats = Instant::now();352 last_stats = Instant::now();
292 let _ = tx.send(Event::Log(format!(353 let _ = tx.send(Event::Log(format!(
293- "handshake: still listening — {frames} frames, {eapol_other} EAPOL on other BSSIDs"354+ "handshake: still listening — {frames} frames, {eapol_other} EAPOL on other BSSIDs, {truncated_dropped} truncated dropped"
294 )));355 )));
295 }356 }
296- let n = match sock.recv(&mut buf) {357+ let m = match sock.recv_msg(&mut buf) {
297- Ok(n) => n,358+ Ok(m) => m,
298 Err(e)359 Err(e)
299 if [libc::EAGAIN, libc::EWOULDBLOCK, libc::ETIMEDOUT]360 if [libc::EAGAIN, libc::EWOULDBLOCK, libc::ETIMEDOUT]
300 .contains(&e.raw_os_error().unwrap_or(0)) =>361 .contains(&e.raw_os_error().unwrap_or(0)) =>
@@ -303,6 +364,19 @@ pub fn capture_loop(
303 }364 }
304 Err(e) => return Err(e).context("handshake capture recv"),365 Err(e) => return Err(e).context("handshake capture recv"),
305 };366 };
367+ if m.truncated() {
368+ // Over-long frame (A-MSDU aggregate): dropped whole — a partial
369+ // frame would parse as garbage and could be spooled as if real.
370+ truncated_dropped += 1;
371+ if truncated_dropped == 1 {
372+ let _ = tx.send(Event::Log(format!(
373+ "handshake: frame >{} B dropped (truncated); counting",
374+ crate::rawsock::RECV_BUFSZ
375+ )));
376+ }
377+ continue;
378+ }
379+ let n = m.len;
306 let Some((_meta, frame)) = radiotap::strip(&buf[..n]) else {380 let Some((_meta, frame)) = radiotap::strip(&buf[..n]) else {
307 continue;381 continue;
308 };382 };
@@ -334,7 +408,7 @@ pub fn capture_loop(
334 // BSSID the user clicked).408 // BSSID the user clicked).
335 if let Some(cap) = tracker.ingest(bssid, sta, essid, &key, tx) {409 if let Some(cap) = tracker.ingest(bssid, sta, essid, &key, tx) {
336 let _ = tx.send(Event::HandshakeComplete(Box::new(cap)));410 let _ = tx.send(Event::HandshakeComplete(Box::new(cap)));
337- return Ok(true);411+ return Ok((true, tracker.take_partials()));
338 }412 }
339 }413 }
340 }414 }
@@ -409,13 +483,16 @@ mod tests {
409 let snonce = [9u8; 32];483 let snonce = [9u8; 32];
410 let mic = [0xabu8; 16];484 let mic = [0xabu8; 16];
411 485
412- assert!(t.ingest(ap(), sta(), "parafin", &parse(&m1(3, anonce)), &tx).is_none());486+ assert!(
487+ t.ingest(ap(), sta(), "testnet", &parse(&m1(3, anonce)), &tx)
488+ .is_none()
489+ );
413 let cap = t490 let cap = t
414- .ingest(ap(), sta(), "parafin", &parse(&m2(3, snonce, mic)), &tx)491+ .ingest(ap(), sta(), "testnet", &parse(&m2(3, snonce, mic)), &tx)
415 .expect("M1+M2 complete");492 .expect("M1+M2 complete");
416 assert_eq!(cap.ap, ap());493 assert_eq!(cap.ap, ap());
417 assert_eq!(cap.client, sta());494 assert_eq!(cap.client, sta());
418- assert_eq!(cap.essid, "parafin");495+ assert_eq!(cap.essid, "testnet");
419 assert_eq!(cap.anonce, anonce);496 assert_eq!(cap.anonce, anonce);
420 assert_eq!(cap.snonce, snonce);497 assert_eq!(cap.snonce, snonce);
421 assert_eq!(cap.mic(), &mic);498 assert_eq!(cap.mic(), &mic);
@@ -424,17 +501,29 @@ mod tests {
424 501
425 let evs = drain(&rx);502 let evs = drain(&rx);
426 assert!(matches!(&evs[0], Event::HandshakeProgress { have: 1, .. }));503 assert!(matches!(&evs[0], Event::HandshakeProgress { have: 1, .. }));
427- assert!(matches!(&evs[1], Event::HandshakeProgress { have: 0b0011, .. }));504+ assert!(matches!(
505+ &evs[1],
506+ Event::HandshakeProgress { have: 0b0011, .. }
507+ ));
428 508
429 // Subsequent M3/M4 inform progress but don't re-emit a capture.509 // Subsequent M3/M4 inform progress but don't re-emit a capture.
430 assert!(510 assert!(
431- t.ingest(ap(), sta(), "parafin", &parse(&m3(3, anonce, mic)), &tx)511+ t.ingest(ap(), sta(), "testnet", &parse(&m3(3, anonce, mic)), &tx)
512+ .is_none()
513+ );
514+ assert!(
515+ t.ingest(ap(), sta(), "testnet", &parse(&m4(4, mic)), &tx)
432 .is_none()516 .is_none()
433 );517 );
434- assert!(t.ingest(ap(), sta(), "parafin", &parse(&m4(4, mic)), &tx).is_none());
435 let evs = drain(&rx);518 let evs = drain(&rx);
436- assert!(matches!(&evs[0], Event::HandshakeProgress { have: 0b0111, .. }));519+ assert!(matches!(
437- assert!(matches!(&evs[1], Event::HandshakeProgress { have: 0b1111, .. }));520+ &evs[0],
521+ Event::HandshakeProgress { have: 0b0111, .. }
522+ ));
523+ assert!(matches!(
524+ &evs[1],
525+ Event::HandshakeProgress { have: 0b1111, .. }
526+ ));
438 }527 }
439 528
440 #[test]529 #[test]
@@ -443,12 +532,12 @@ mod tests {
443 let mut t = Tracker::new();532 let mut t = Tracker::new();
444 let mic = [1u8; 16];533 let mic = [1u8; 16];
445 assert!(534 assert!(
446- t.ingest(ap(), sta(), "parafin", &parse(&m2(5, [9u8; 32], mic)), &tx)535+ t.ingest(ap(), sta(), "testnet", &parse(&m2(5, [9u8; 32], mic)), &tx)
447 .is_none()536 .is_none()
448 );537 );
449 // Exact rc match.538 // Exact rc match.
450 let cap = t539 let cap = t
451- .ingest(ap(), sta(), "parafin", &parse(&m1(5, [7u8; 32])), &tx)540+ .ingest(ap(), sta(), "testnet", &parse(&m1(5, [7u8; 32])), &tx)
452 .expect("late M1 pairs with buffered M2");541 .expect("late M1 pairs with buffered M2");
453 assert_eq!(cap.snonce, [9u8; 32]);542 assert_eq!(cap.snonce, [9u8; 32]);
454 }543 }
@@ -458,10 +547,10 @@ mod tests {
458 let (tx, _rx) = crossbeam_channel::unbounded();547 let (tx, _rx) = crossbeam_channel::unbounded();
459 let mut t = Tracker::new();548 let mut t = Tracker::new();
460 let mic = [1u8; 16];549 let mic = [1u8; 16];
461- t.ingest(ap(), sta(), "parafin", &parse(&m2(5, [9u8; 32], mic)), &tx);550+ t.ingest(ap(), sta(), "testnet", &parse(&m2(5, [9u8; 32], mic)), &tx);
462 // retransmit tolerance: rc(M1) == rc(M2) - 1551 // retransmit tolerance: rc(M1) == rc(M2) - 1
463 let cap = t552 let cap = t
464- .ingest(ap(), sta(), "parafin", &parse(&m1(4, [7u8; 32])), &tx)553+ .ingest(ap(), sta(), "testnet", &parse(&m1(4, [7u8; 32])), &tx)
465 .expect("rc2-1 retransmit tolerated");554 .expect("rc2-1 retransmit tolerated");
466 assert_eq!(cap.anonce, [7u8; 32]);555 assert_eq!(cap.anonce, [7u8; 32]);
467 }556 }
@@ -471,10 +560,10 @@ mod tests {
471 let (tx, _rx) = crossbeam_channel::unbounded();560 let (tx, _rx) = crossbeam_channel::unbounded();
472 let mut t = Tracker::new();561 let mut t = Tracker::new();
473 let mic = [1u8; 16];562 let mic = [1u8; 16];
474- t.ingest(ap(), sta(), "parafin", &parse(&m1(1, [7u8; 32])), &tx);563+ t.ingest(ap(), sta(), "testnet", &parse(&m1(1, [7u8; 32])), &tx);
475 // rc(M2)=5 is neither equal nor M1+1 → no capture.564 // rc(M2)=5 is neither equal nor M1+1 → no capture.
476 assert!(565 assert!(
477- t.ingest(ap(), sta(), "parafin", &parse(&m2(5, [9u8; 32], mic)), &tx)566+ t.ingest(ap(), sta(), "testnet", &parse(&m2(5, [9u8; 32], mic)), &tx)
478 .is_none()567 .is_none()
479 );568 );
480 }569 }
@@ -484,16 +573,28 @@ mod tests {
484 let (tx, _rx) = crossbeam_channel::unbounded();573 let (tx, _rx) = crossbeam_channel::unbounded();
485 let mut t = Tracker::new();574 let mut t = Tracker::new();
486 let anonce = [7u8; 32];575 let anonce = [7u8; 32];
487- t.ingest(ap(), sta(), "parafin", &parse(&m1(3, anonce)), &tx);576+ t.ingest(ap(), sta(), "testnet", &parse(&m1(3, anonce)), &tx);
488 // Zero MIC M2 (e.g. autogenerated junk) must not complete a capture.577 // Zero MIC M2 (e.g. autogenerated junk) must not complete a capture.
489 assert!(578 assert!(
490- t.ingest(ap(), sta(), "parafin", &parse(&m2(3, [9u8; 32], [0u8; 16])), &tx)579+ t.ingest(
491- .is_none()580+ ap(),
581+ sta(),
582+ "testnet",
583+ &parse(&m2(3, [9u8; 32], [0u8; 16])),
584+ &tx
585+ )
586+ .is_none()
492 );587 );
493 // Zero nonce (bogus) likewise.588 // Zero nonce (bogus) likewise.
494 assert!(589 assert!(
495- t.ingest(ap(), sta(), "parafin", &parse(&m2(3, [0u8; 32], [1u8; 16])), &tx)590+ t.ingest(
496- .is_none()591+ ap(),
592+ sta(),
593+ "testnet",
594+ &parse(&m2(3, [0u8; 32], [1u8; 16])),
595+ &tx
596+ )
597+ .is_none()
497 );598 );
498 }599 }
499 600
@@ -503,18 +604,160 @@ mod tests {
503 let mut t = Tracker::new();604 let mut t = Tracker::new();
504 let mic = [1u8; 16];605 let mic = [1u8; 16];
505 t.ingest(ap(), sta(), "", &parse(&m1(3, [7u8; 32])), &tx);606 t.ingest(ap(), sta(), "", &parse(&m1(3, [7u8; 32])), &tx);
506- assert!(t.ingest(ap(), sta(), "", &parse(&m2(3, [9u8; 32], mic)), &tx).is_none());607+ assert!(
608+ t.ingest(ap(), sta(), "", &parse(&m2(3, [9u8; 32], mic)), &tx)
609+ .is_none()
610+ );
507 // When the ESSID becomes known, the buffered pair can complete…611 // When the ESSID becomes known, the buffered pair can complete…
508 // …but ingest needs a fresh message to re-trigger; feed an M3 (progress)612 // …but ingest needs a fresh message to re-trigger; feed an M3 (progress)
509 // then a retransmitted M1 which re-pairs.613 // then a retransmitted M1 which re-pairs.
510 }614 }
511 615
616+ #[test]
617+ fn partial_m2_m3_drained_at_teardown() {
618+ let (tx, _rx) = crossbeam_channel::unbounded();
619+ let mut t = Tracker::new();
620+ let anonce = [7u8; 32];
621+ let snonce = [9u8; 32];
622+ let mic2 = [0x11u8; 16];
623+ let mic3 = [0xabu8; 16];
624+ // M2 with no M1 yet, then M3: never completed.
625+ assert!(
626+ t.ingest(ap(), sta(), "testnet", &parse(&m2(5, snonce, mic2)), &tx)
627+ .is_none()
628+ );
629+ let m3f = m3(6, anonce, mic3);
630+ assert!(
631+ t.ingest(ap(), sta(), "testnet", &parse(&m3f), &tx)
632+ .is_none()
633+ );
634+
635+ let partials = t.take_partials();
636+ assert_eq!(partials.len(), 1);
637+ let p = &partials[0];
638+ assert!(p.partial);
639+ assert_eq!(p.ap, ap());
640+ assert_eq!(p.client, sta());
641+ assert_eq!(p.essid, "testnet");
642+ // ANonce ← M3, SNonce ← M2, MIC + EAPOL ← M3 frame.
643+ assert_eq!(p.anonce, anonce);
644+ assert_eq!(p.snonce, snonce);
645+ assert_eq!(p.mic(), &mic3);
646+ assert_eq!(p.eapol_m2, m3f);
647+ assert_eq!(p.key_ver, 2);
648+
649+ // Drain-once: material is gone until new messages arrive.
650+ assert!(t.take_partials().is_empty());
651+ }
652+
653+ #[test]
654+ fn partial_needs_both_unpaired_m2_and_m3() {
655+ let (tx, _rx) = crossbeam_channel::unbounded();
656+ let mic = [1u8; 16];
657+ // M2 only.
658+ let mut t = Tracker::new();
659+ t.ingest(ap(), sta(), "testnet", &parse(&m2(5, [9u8; 32], mic)), &tx);
660+ assert!(t.take_partials().is_empty());
661+ // M3 only.
662+ let mut t = Tracker::new();
663+ t.ingest(ap(), sta(), "testnet", &parse(&m3(5, [7u8; 32], mic)), &tx);
664+ assert!(t.take_partials().is_empty());
665+ }
666+
667+ #[test]
668+ fn completed_pair_leaves_no_partial() {
669+ let (tx, _rx) = crossbeam_channel::unbounded();
670+ let mut t = Tracker::new();
671+ let mic = [1u8; 16];
672+ t.ingest(ap(), sta(), "testnet", &parse(&m1(3, [7u8; 32])), &tx);
673+ assert!(
674+ t.ingest(ap(), sta(), "testnet", &parse(&m2(3, [9u8; 32], mic)), &tx)
675+ .is_some()
676+ );
677+ t.ingest(ap(), sta(), "testnet", &parse(&m3(4, [7u8; 32], mic)), &tx);
678+ // The M2 paired an M1 — nothing partial remains for this pair.
679+ assert!(t.take_partials().is_empty());
680+ }
681+
682+ #[test]
683+ fn partial_skipped_without_essid() {
684+ let (tx, _rx) = crossbeam_channel::unbounded();
685+ let mut t = Tracker::new();
686+ let mic = [1u8; 16];
687+ // Unknown essid: no salt → not crackable → no partial.
688+ t.ingest(ap(), sta(), "", &parse(&m2(5, [9u8; 32], mic)), &tx);
689+ t.ingest(ap(), sta(), "", &parse(&m3(6, [7u8; 32], mic)), &tx);
690+ assert!(t.take_partials().is_empty());
691+ }
692+
693+ #[test]
694+ fn partial_newest_of_each_wins() {
695+ let (tx, _rx) = crossbeam_channel::unbounded();
696+ let mut t = Tracker::new();
697+ let mic = [1u8; 16];
698+ t.ingest(ap(), sta(), "net", &parse(&m2(5, [1u8; 32], mic)), &tx);
699+ t.ingest(ap(), sta(), "net", &parse(&m2(6, [2u8; 32], mic)), &tx);
700+ t.ingest(ap(), sta(), "net", &parse(&m3(6, [3u8; 32], mic)), &tx);
701+ t.ingest(ap(), sta(), "net", &parse(&m3(7, [4u8; 32], mic)), &tx);
702+ let p = t.take_partials();
703+ assert_eq!(p.len(), 1);
704+ assert_eq!(p[0].snonce, [2u8; 32]); // newest unpaired M2
705+ assert_eq!(p[0].anonce, [4u8; 32]); // newest M3
706+ }
707+
708+ #[test]
709+ fn hc22000_message_pair_field_marks_partials() {
710+ let complete = HandshakeCapture::new(
711+ ap(),
712+ sta(),
713+ "testnet".into(),
714+ [7u8; 32],
715+ [9u8; 32],
716+ [0xabu8; 16],
717+ m2(3, [9u8; 32], [0xabu8; 16]),
718+ 2,
719+ );
720+ let line = handshake_hc22000(&complete);
721+ assert!(line.ends_with("*00"), "{line}");
722+ assert!(crate::crypto::parse_hc22000(line.strip_prefix("WPA*").unwrap()).is_ok());
723+
724+ let partial = HandshakeCapture::new_partial(
725+ ap(),
726+ sta(),
727+ "testnet".into(),
728+ [7u8; 32],
729+ [9u8; 32],
730+ [0xabu8; 16],
731+ m3(4, [7u8; 32], [0xabu8; 16]),
732+ 2,
733+ );
734+ let line = handshake_hc22000(&partial);
735+ assert!(line.ends_with("*02"), "{line}");
736+ // Must stay parseable by crypto (partial flag restored there on "02").
737+ match crate::crypto::parse_hc22000(line.strip_prefix("WPA*").unwrap()) {
738+ Ok(crate::crypto::CrackTarget::Handshake(h)) => {
739+ assert_eq!(h.ap, partial.ap);
740+ assert_eq!(h.client, partial.client);
741+ assert_eq!(h.essid, partial.essid);
742+ assert_eq!(h.anonce, partial.anonce);
743+ assert_eq!(h.mic(), partial.mic());
744+ assert_eq!(h.eapol_m2, partial.eapol_m2);
745+ assert_eq!(h.key_ver, partial.key_ver);
746+ }
747+ other => panic!("partial export must parse as a handshake: {other:?}"),
748+ }
749+ // Old field-less export form stays parseable.
750+ let bare = line.strip_prefix("WPA*").unwrap();
751+ let legacy = bare.strip_suffix("*02").unwrap();
752+ assert!(crate::crypto::parse_hc22000(legacy).is_ok());
753+ }
754+
512 #[test]755 #[test]
513 fn hc22000_handshake_shape() {756 fn hc22000_handshake_shape() {
514 let cap = HandshakeCapture::new(757 let cap = HandshakeCapture::new(
515 ap(),758 ap(),
516 sta(),759 sta(),
517- "parafin".into(),760+ "testnet".into(),
518 [7u8; 32],761 [7u8; 32],
519 [9u8; 32],762 [9u8; 32],
520 [0xabu8; 16],763 [0xabu8; 16],
@@ -529,8 +772,8 @@ mod tests {
529 assert!(bare.contains("aabbccddeeff"));772 assert!(bare.contains("aabbccddeeff"));
530 assert!(bare.contains("112233445566"));773 assert!(bare.contains("112233445566"));
531 assert!(bare.contains(&"07".repeat(32))); // anonce774 assert!(bare.contains(&"07".repeat(32))); // anonce
532- // essid "parafin" hex775+ // essid "testnet" hex
533- assert!(bare.contains("7061726166696e"));776+ assert!(bare.contains("746573746e6574"));
534 }777 }
535 778
536 #[test]779 #[test]
@@ -538,14 +781,14 @@ mod tests {
538 let cap = PmkidCapture {781 let cap = PmkidCapture {
539 ap: ap(),782 ap: ap(),
540 client: sta(),783 client: sta(),
541- essid: "parafin".into(),784+ essid: "testnet".into(),
542 pmkid: [0x42u8; 16],785 pmkid: [0x42u8; 16],
543 };786 };
544 let line = pmkid_hc22000(&cap);787 let line = pmkid_hc22000(&cap);
545 assert_eq!(788 assert_eq!(
546 line,789 line,
547 format!(790 format!(
548- "WPA*01*{}*aabbccddeeff*112233445566*7061726166696e***",791+ "WPA*01*{}*aabbccddeeff*112233445566*746573746e6574***",
549 "42".repeat(16)792 "42".repeat(16)
550 )793 )
551 );794 );
@@ -558,7 +801,7 @@ mod tests {
558 let cap = HandshakeCapture::new(801 let cap = HandshakeCapture::new(
559 ap(),802 ap(),
560 sta(),803 sta(),
561- "parafin".into(),804+ "testnet".into(),
562 [7u8; 32],805 [7u8; 32],
563 [9u8; 32],806 [9u8; 32],
564 [0xabu8; 16],807 [0xabu8; 16],
@@ -567,8 +810,8 @@ mod tests {
567 );810 );
568 let line = handshake_hc22000(&cap);811 let line = handshake_hc22000(&cap);
569 let bare = line.strip_prefix("WPA*").unwrap();812 let bare = line.strip_prefix("WPA*").unwrap();
570- let parsed = crate::crypto::parse_hc22000(bare)813+ let parsed =
571- .expect("crypto parser must accept our export");814+ crate::crypto::parse_hc22000(bare).expect("crypto parser must accept our export");
572 match parsed {815 match parsed {
573 crate::crypto::CrackTarget::Handshake(h) => {816 crate::crypto::CrackTarget::Handshake(h) => {
574 assert_eq!(h.ap, cap.ap);817 assert_eq!(h.ap, cap.ap);
@@ -586,17 +829,17 @@ mod tests {
586 let pmkid_line = pmkid_hc22000(&PmkidCapture {829 let pmkid_line = pmkid_hc22000(&PmkidCapture {
587 ap: ap(),830 ap: ap(),
588 client: sta(),831 client: sta(),
589- essid: "parafin".into(),832+ essid: "testnet".into(),
590 pmkid: [0x42u8; 16],833 pmkid: [0x42u8; 16],
591 });834 });
592 let bare = pmkid_line.strip_prefix("WPA*").unwrap();835 let bare = pmkid_line.strip_prefix("WPA*").unwrap();
593- let parsed = crate::crypto::parse_hc22000(bare)836+ let parsed =
594- .expect("crypto parser must accept our pmkid export");837+ crate::crypto::parse_hc22000(bare).expect("crypto parser must accept our pmkid export");
595 match parsed {838 match parsed {
596 crate::crypto::CrackTarget::Pmkid(p) => {839 crate::crypto::CrackTarget::Pmkid(p) => {
597 assert_eq!(p.ap, ap());840 assert_eq!(p.ap, ap());
598 assert_eq!(p.client, sta());841 assert_eq!(p.client, sta());
599- assert_eq!(p.essid, "parafin");842+ assert_eq!(p.essid, "testnet");
600 assert_eq!(p.pmkid, [0x42u8; 16]);843 assert_eq!(p.pmkid, [0x42u8; 16]);
601 }844 }
602 _ => panic!("wrong target type"),845 _ => panic!("wrong target type"),
src/iface.rsmodified+118 -61
@@ -42,32 +42,53 @@ fn iw(args: &[&str]) -> Result<String> {
42 /// move the pin instead of fighting the hopper with their own `set_freq`42 /// move the pin instead of fighting the hopper with their own `set_freq`
43 /// calls (the scanner re-asserts the pinned value, not the hop plan).43 /// calls (the scanner re-asserts the pinned value, not the hop plan).
44 ///44 ///
45-/// Two layers: `owner` is the long-lived holder's desired MHz (the45+/// Two layers: `holds` is the stack of long-lived holders' desired MHz
46-/// handshake-capture worker — it must get the channel BACK after a short46+/// (the handshake-capture workers — the radio must get the channel BACK
47-/// interruption), `active` is what the scanner currently must dwell on.47+/// after a short interruption), `active` is what the scanner currently
48-/// A deauth worker briefly [`override_freq`](ChannelPin::override_freq)s48+/// must dwell on. A deauth worker briefly
49-/// `active` per band, then [`settle`](ChannelPin::settle)s to restore the49+/// [`override_freq`](ChannelPin::override_freq)s `active` per band, then
50-/// owner's frequency (or free hop when nothing is held).50+/// [`settle`](ChannelPin::settle)s to restore the top holder's frequency
51+/// (or free hop when nothing is held).
52+///
53+/// Holds are REFCOUNTED, not single-owner: two concurrent captures on the
54+/// same band each [`hold`](ChannelPin::hold) the same MHz, and the pin
55+/// frees only when the LAST [`release`](ChannelPin::release) drops — the
56+/// first capture's worker exiting early must not un-pin the channel out
57+/// from under the second. The TOP of the stack (most recent hold of a
58+/// still-held frequency) is the owner whose frequency `settle` restores.
51 pub struct ChannelPin {59 pub struct ChannelPin {
52 active: AtomicU16,60 active: AtomicU16,
53- owner: Mutex<Option<u16>>,61+ /// Every open hold, in hold order (duplicates kept; the LAST entry is
62+ /// the owner whose frequency `settle` restores).
63+ holds: Mutex<Vec<u16>>,
54 }64 }
55 65
56 impl ChannelPin {66 impl ChannelPin {
57- /// Long-lived hold: become the owner and pin the radio to `mhz`.67+ /// Long-lived hold: push `mhz` onto the holder stack and pin the
68+ /// radio to it. Concurrent holders of the same MHz each push their
69+ /// own entry; matching [`release`](ChannelPin::release)s pop one each.
58 pub fn hold(&self, mhz: u16) {70 pub fn hold(&self, mhz: u16) {
59- *self.owner.lock().expect("pin owner poisoned") = Some(mhz);71+ self.holds.lock().expect("pin holds poisoned").push(mhz);
60 self.active.store(mhz, Ordering::Release);72 self.active.store(mhz, Ordering::Release);
61 }73 }
62 74
63- /// Release a hold — only by its owner (`owner == Some(mhz)`); a75+ /// Release ONE hold of `mhz` (a holder may hold exactly one entry per
64- /// foreign release is ignored so a stale worker can't un-pin a newer76+ /// [`hold`](ChannelPin::hold) call). A release with no matching hold —
65- /// capture. On release the scanner returns to free hopping.77+ /// e.g. a stale worker releasing a frequency it never held — is
78+ /// ignored so it can't un-pin someone else's capture. The scanner
79+ /// returns to free hopping (or the remaining top holder) only when
80+ /// the released entry was the owner; a release by a NON-owner holder
81+ /// of the same frequency leaves the pin untouched.
66 pub fn release(&self, mhz: u16) {82 pub fn release(&self, mhz: u16) {
67- let mut owner = self.owner.lock().expect("pin owner poisoned");83+ let mut holds = self.holds.lock().expect("pin holds poisoned");
68- if *owner == Some(mhz) {84+ let before = holds.last().copied();
69- *owner = None;85+ let Some(pos) = holds.iter().rposition(|&f| f == mhz) else {
70- self.active.store(0, Ordering::Release);86+ return; // foreign release: no matching hold, ignore
87+ };
88+ holds.remove(pos);
89+ let after = holds.last().copied();
90+ if after != before {
91+ self.active.store(after.unwrap_or(0), Ordering::Release);
71 }92 }
72 }93 }
73 94
@@ -81,7 +102,12 @@ impl ChannelPin {
81 /// Deauth finished: restore the owner's frequency, or free hop (0)102 /// Deauth finished: restore the owner's frequency, or free hop (0)
82 /// when nothing is held.103 /// when nothing is held.
83 pub fn settle(&self) {104 pub fn settle(&self) {
84- let owner = *self.owner.lock().expect("pin owner poisoned");105+ let owner = self
106+ .holds
107+ .lock()
108+ .expect("pin holds poisoned")
109+ .last()
110+ .copied();
85 self.active.store(owner.unwrap_or(0), Ordering::Release);111 self.active.store(owner.unwrap_or(0), Ordering::Release);
86 }112 }
87 113
@@ -95,7 +121,7 @@ impl Default for ChannelPin {
95 fn default() -> Self {121 fn default() -> Self {
96 ChannelPin {122 ChannelPin {
97 active: AtomicU16::new(0),123 active: AtomicU16::new(0),
98- owner: Mutex::new(None),124+ holds: Mutex::new(Vec::new()),
99 }125 }
100 }126 }
101 }127 }
@@ -104,8 +130,10 @@ impl Default for ChannelPin {
104 fn iface_exists(ifname: &str) -> bool {130 fn iface_exists(ifname: &str) -> bool {
105 iw(&["dev"])131 iw(&["dev"])
106 .map(|out| {132 .map(|out| {
107- out.lines()133+ out.lines().any(|l| {
108- .any(|l| l.trim_start().starts_with("Interface ") && l.trim() == format!("Interface {ifname}"))134+ l.trim_start().starts_with("Interface ")
135+ && l.trim() == format!("Interface {ifname}")
136+ })
109 })137 })
110 .unwrap_or(false)138 .unwrap_or(false)
111 }139 }
@@ -132,10 +160,8 @@ pub fn to_monitor(ifname: &str) -> Result<String> {
132 ip(&["link", "set", ifname, "down"])?;160 ip(&["link", "set", ifname, "down"])?;
133 if !iface_exists(&mon) {161 if !iface_exists(&mon) {
134 let phy = phy_of(ifname)?;162 let phy = phy_of(ifname)?;
135- iw(&[163+ iw(&["phy", &phy, "interface", "add", &mon, "type", "monitor"])
136- "phy", &phy, "interface", "add", &mon, "type", "monitor",164+ .with_context(|| format!("adding monitor vif {mon} on {phy}"))?;
137- ])
138- .with_context(|| format!("adding monitor vif {mon} on {phy}"))?;
139 }165 }
140 ip(&["link", "set", &mon, "up"])?;166 ip(&["link", "set", &mon, "up"])?;
141 Ok(mon)167 Ok(mon)
@@ -252,26 +278,6 @@ pub fn set_freq(ifname: &str, freq_mhz: u16) -> Result<()> {
252 }278 }
253 }279 }
254 280
255-/// Parse `iw dev <ifname> info` for the current channel.
256-/// Err if not determinable.
257-pub fn current_channel(ifname: &str) -> Result<u8> {
258- let out = iw(&["dev", ifname, "info"])?;
259- for line in out.lines() {
260- let line = line.trim();
261- if let Some(rest) = line.strip_prefix("channel ") {
262- let num: String = rest
263- .split(|c: char| !c.is_ascii_digit())
264- .next()
265- .unwrap_or("")
266- .to_string();
267- if let Ok(ch) = num.parse::<u8>() {
268- return Ok(ch);
269- }
270- }
271- }
272- bail!("could not parse channel from `iw dev {ifname} info`")
273-}
274-
275 /// Wireless interfaces present: /sys/class/net/<if> has DEVTYPE=wlan in its281 /// Wireless interfaces present: /sys/class/net/<if> has DEVTYPE=wlan in its
276 /// uevent, or a `wireless` directory.282 /// uevent, or a `wireless` directory.
277 pub fn list_wifi_ifaces() -> Vec<String> {283 pub fn list_wifi_ifaces() -> Vec<String> {
@@ -297,7 +303,8 @@ pub fn list_wifi_ifaces() -> Vec<String> {
297 pub fn mac_of(ifname: &str) -> Result<MacAddr> {303 pub fn mac_of(ifname: &str) -> Result<MacAddr> {
298 let s = std::fs::read_to_string(format!("/sys/class/net/{ifname}/address"))304 let s = std::fs::read_to_string(format!("/sys/class/net/{ifname}/address"))
299 .with_context(|| format!("reading MAC of {ifname}"))?;305 .with_context(|| format!("reading MAC of {ifname}"))?;
300- s.trim().parse::<MacAddr>()306+ s.trim()
307+ .parse::<MacAddr>()
301 .with_context(|| format!("parsing MAC of {ifname}"))308 .with_context(|| format!("parsing MAC of {ifname}"))
302 }309 }
303 310
@@ -322,21 +329,13 @@ pub fn networkmanager_active() -> bool {
322 /// Requires root. Restart later with [`start_networkmanager`]329 /// Requires root. Restart later with [`start_networkmanager`]
323 /// (`systemctl start NetworkManager`).330 /// (`systemctl start NetworkManager`).
324 pub fn stop_networkmanager() -> Result<()> {331 pub fn stop_networkmanager() -> Result<()> {
325- run(332+ run("systemctl", &["stop".into(), "NetworkManager".into()]).map(|_| ())
326- "systemctl",
327- &["stop".into(), "NetworkManager".into()],
328- )
329- .map(|_| ())
330 }333 }
331 334
332 /// Start NetworkManager again (mirrors [`stop_networkmanager`]), restoring335 /// Start NetworkManager again (mirrors [`stop_networkmanager`]), restoring
333 /// normal managed-mode connectivity once capture work is done. Requires root.336 /// normal managed-mode connectivity once capture work is done. Requires root.
334 pub fn start_networkmanager() -> Result<()> {337 pub fn start_networkmanager() -> Result<()> {
335- run(338+ run("systemctl", &["start".into(), "NetworkManager".into()]).map(|_| ())
336- "systemctl",
337- &["start".into(), "NetworkManager".into()],
338- )
339- .map(|_| ())
340 }339 }
341 340
342 /// True when the monitor vif `<ifname>mon` no longer exists — the post-scan341 /// True when the monitor vif `<ifname>mon` no longer exists — the post-scan
@@ -390,11 +389,6 @@ mod tests {
390 assert_eq!(is_root(), (unsafe { libc::geteuid() }) == 0);389 assert_eq!(is_root(), (unsafe { libc::geteuid() }) == 0);
391 }390 }
392 391
393- #[test]
394- fn current_channel_of_missing_iface_errors_not_panics() {
395- assert!(current_channel("definitely-not-an-iface-xyz").is_err());
396- }
397-
398 #[test]392 #[test]
399 fn pin_defaults_to_free_hop() {393 fn pin_defaults_to_free_hop() {
400 let pin = ChannelPin::default();394 let pin = ChannelPin::default();
@@ -429,7 +423,11 @@ mod tests {
429 pin.override_freq(5180);423 pin.override_freq(5180);
430 assert_eq!(pin.get(), 5180);424 assert_eq!(pin.get(), 5180);
431 pin.settle();425 pin.settle();
432- assert_eq!(pin.get(), 2437, "settle must hand the channel back to the owner");426+ assert_eq!(
427+ pin.get(),
428+ 2437,
429+ "settle must hand the channel back to the owner"
430+ );
433 pin.release(2437);431 pin.release(2437);
434 assert_eq!(pin.get(), 0);432 assert_eq!(pin.get(), 0);
435 }433 }
@@ -454,4 +452,63 @@ mod tests {
454 pin.release(5865);452 pin.release(5865);
455 assert_eq!(pin.get(), 0);453 assert_eq!(pin.get(), 0);
456 }454 }
455+
456+ #[test]
457+ fn pin_concurrent_holds_same_freq_free_on_last_release() {
458+ // Two concurrent captures on the SAME band: the first worker's
459+ // exit must NOT un-pin the channel from under the second — the
460+ // pin frees only when the LAST holder releases.
461+ let pin = ChannelPin::default();
462+ pin.hold(2437);
463+ pin.hold(2437);
464+ assert_eq!(pin.get(), 2437);
465+ pin.release(2437); // first capture's worker exits
466+ assert_eq!(pin.get(), 2437, "second capture still holds the pin");
467+ pin.release(2437); // last holder drops
468+ assert_eq!(pin.get(), 0);
469+ }
470+
471+ #[test]
472+ fn pin_settle_restores_while_same_freq_still_held() {
473+ // Deauth mid-double-capture: settling after an override must hand
474+ // the channel back to the still-held frequency, not to free hop.
475+ let pin = ChannelPin::default();
476+ pin.hold(2437);
477+ pin.hold(2437);
478+ pin.override_freq(5180);
479+ pin.settle();
480+ assert_eq!(pin.get(), 2437);
481+ pin.release(2437);
482+ assert_eq!(pin.get(), 2437);
483+ pin.release(2437);
484+ assert_eq!(pin.get(), 0);
485+ }
486+
487+ #[test]
488+ fn pin_concurrent_threads_end_free() {
489+ // N threads hold+release the same frequency with interleavings
490+ // scrambled by the scheduler; no matter the order, the pin must
491+ // end free once every holder dropped (no leaked or spuriously
492+ // freed pins), and must NEVER read 0 while a hold is still open.
493+ use std::sync::Arc;
494+ let pin = Arc::new(ChannelPin::default());
495+ let mut threads = Vec::new();
496+ for _ in 0..8 {
497+ let pin = pin.clone();
498+ threads.push(std::thread::spawn(move || {
499+ for _ in 0..200 {
500+ pin.hold(2437);
501+ assert!(
502+ pin.get() != 0,
503+ "pin must never free-hop while a hold is open"
504+ );
505+ pin.release(2437);
506+ }
507+ }));
508+ }
509+ for t in threads {
510+ t.join().expect("pin worker");
511+ }
512+ assert_eq!(pin.get(), 0, "all holds released ⇒ free hop");
513+ }
457 }514 }
src/main.rsmodified+6 -6
@@ -8,15 +8,15 @@ mod gpu;
8 mod handshake;8 mod handshake;
9 mod iface;9 mod iface;
10 mod oui;10 mod oui;
11-mod rainbow;
12-mod store;
13 mod pcapin;11 mod pcapin;
14 mod pcapout;12 mod pcapout;
15 mod pmkid;13 mod pmkid;
16 mod radiotap;14 mod radiotap;
15+mod rainbow;
17 mod rawsock;16 mod rawsock;
18 mod scanner;17 mod scanner;
19 mod service;18 mod service;
19+mod store;
20 mod ui;20 mod ui;
21 mod wordlist;21 mod wordlist;
22 22
@@ -24,14 +24,14 @@ use clap::Parser;
24 24
25 #[derive(Parser)]25 #[derive(Parser)]
26 #[command(26 #[command(
27- name = "wifilab",27+ name = "wifi_lab",
28 about = "WPA/WPA2 lab: scan, capture handshakes/PMKIDs, deauth, crack (GPU/CPU)"28 about = "WPA/WPA2 lab: scan, capture handshakes/PMKIDs, deauth, crack (GPU/CPU)"
29 )]29 )]
30 struct Cli {30 struct Cli {
31 /// Wireless interface to use (default: first detected, else wlp14s0).31 /// Wireless interface to use (default: first detected, else wlp14s0).
32 #[arg(long)]32 #[arg(long)]
33 iface: Option<String>,33 iface: Option<String>,
34- /// Dev mode: fabricated events, no device access. Same as WIFILAB_MOCK=1.34+ /// Dev mode: fabricated events, no device access. Same as WIFI_LAB_MOCK=1.
35 #[arg(long)]35 #[arg(long)]
36 mock: bool,36 mock: bool,
37 /// Internal: run as the privileged radio service (spawned by the UI,37 /// Internal: run as the privileged radio service (spawned by the UI,
@@ -125,7 +125,7 @@ fn main() {
125 }125 }
126 let mock = cli.mock126 let mock = cli.mock
127 || matches!(127 || matches!(
128- std::env::var_os("WIFILAB_MOCK"),128+ std::env::var_os("WIFI_LAB_MOCK"),
129 Some(v) if v != "0" && v != "false"129 Some(v) if v != "0" && v != "false"
130 );130 );
131 // Significantly loud one-liner: mode + iface + root status.131 // Significantly loud one-liner: mode + iface + root status.
@@ -134,7 +134,7 @@ fn main() {
134 .clone()134 .clone()
135 .unwrap_or_else(|| "(auto-detect at window open)".to_string());135 .unwrap_or_else(|| "(auto-detect at window open)".to_string());
136 println!(136 println!(
137- "wifilab: mode={} iface={} root={} — {}",137+ "wifi_lab: mode={} iface={} root={} — {}",
138 if mock { "MOCK" } else { "real" },138 if mock { "MOCK" } else { "real" },
139 iface,139 iface,
140 iface::is_root(),140 iface::is_root(),
src/oui.rsmodified+33 -9
@@ -25,9 +25,11 @@ fn parse24(src: &'static str) -> Vec<(u32, &'static str)> {
25 }25 }
26 26
27 /// Parsed `(prefix, vendor)` pairs from `data/oui.txt` (24-bit MA-L).27 /// Parsed `(prefix, vendor)` pairs from `data/oui.txt` (24-bit MA-L).
28-static TABLE24: LazyLock<Vec<(u32, &'static str)>> = LazyLock::new(|| parse24(include_str!("data/oui.txt")));28+static TABLE24: LazyLock<Vec<(u32, &'static str)>> =
29+ LazyLock::new(|| parse24(include_str!("data/oui.txt")));
29 /// MA-M 28-bit sub-assignments.30 /// MA-M 28-bit sub-assignments.
30-static TABLE28: LazyLock<Vec<(u32, &'static str)>> = LazyLock::new(|| parse24(include_str!("data/oui28.txt")));31+static TABLE28: LazyLock<Vec<(u32, &'static str)>> =
32+ LazyLock::new(|| parse24(include_str!("data/oui28.txt")));
31 /// MA-S 36-bit sub-assignments.33 /// MA-S 36-bit sub-assignments.
32 static TABLE36: LazyLock<Vec<(u64, &'static str)>> = LazyLock::new(|| {34 static TABLE36: LazyLock<Vec<(u64, &'static str)>> = LazyLock::new(|| {
33 include_str!("data/oui36.txt")35 include_str!("data/oui36.txt")
@@ -63,7 +65,8 @@ pub fn lookup(mac: &MacAddr) -> Option<&'static str> {
63 if let Ok(i) = t36.binary_search_by_key(&key36, |&(k, _)| k) {65 if let Ok(i) = t36.binary_search_by_key(&key36, |&(k, _)| k) {
64 return Some(t36[i].1);66 return Some(t36[i].1);
65 }67 }
66- let key28 = ((m[0] as u32) << 20) | ((m[1] as u32) << 12) | ((m[2] as u32) << 4) | (m[3] >> 4) as u32;68+ let key28 =
69+ ((m[0] as u32) << 20) | ((m[1] as u32) << 12) | ((m[2] as u32) << 4) | (m[3] >> 4) as u32;
67 let t28 = &*TABLE28;70 let t28 = &*TABLE28;
68 if let Ok(i) = t28.binary_search_by_key(&key28, |&(k, _)| k) {71 if let Ok(i) = t28.binary_search_by_key(&key28, |&(k, _)| k) {
69 return Some(t28[i].1);72 return Some(t28[i].1);
@@ -86,14 +89,35 @@ mod tests {
86 #[test]89 #[test]
87 fn tables_are_populated_and_sorted() {90 fn tables_are_populated_and_sorted() {
88 let t = &*TABLE24;91 let t = &*TABLE24;
89- assert!(t.len() > 10_000, "expected a real MA-L snapshot, got {}", t.len());92+ assert!(
90- assert!(t.windows(2).all(|w| w[0].0 < w[1].0), "MA-L must be sorted+unique");93+ t.len() > 10_000,
94+ "expected a real MA-L snapshot, got {}",
95+ t.len()
96+ );
97+ assert!(
98+ t.windows(2).all(|w| w[0].0 < w[1].0),
99+ "MA-L must be sorted+unique"
100+ );
91 let t = &*TABLE28;101 let t = &*TABLE28;
92- assert!(t.len() > 1_000, "expected a real MA-M snapshot, got {}", t.len());102+ assert!(
93- assert!(t.windows(2).all(|w| w[0].0 < w[1].0), "MA-M must be sorted+unique");103+ t.len() > 1_000,
104+ "expected a real MA-M snapshot, got {}",
105+ t.len()
106+ );
107+ assert!(
108+ t.windows(2).all(|w| w[0].0 < w[1].0),
109+ "MA-M must be sorted+unique"
110+ );
94 let t = &*TABLE36;111 let t = &*TABLE36;
95- assert!(t.len() > 1_000, "expected a real MA-S snapshot, got {}", t.len());112+ assert!(
96- assert!(t.windows(2).all(|w| w[0] .0 < w[1].0), "MA-S must be sorted+unique");113+ t.len() > 1_000,
114+ "expected a real MA-S snapshot, got {}",
115+ t.len()
116+ );
117+ assert!(
118+ t.windows(2).all(|w| w[0].0 < w[1].0),
119+ "MA-S must be sorted+unique"
120+ );
97 }121 }
98 122
99 #[test]123 #[test]
src/pcapin.rsmodified+46 -32
@@ -23,7 +23,7 @@ use std::collections::BTreeMap;
23 use std::io::{self, ErrorKind};23 use std::io::{self, ErrorKind};
24 use std::path::Path;24 use std::path::Path;
25 25
26-use anyhow::{bail, Context, Result};26+use anyhow::{Context, Result, bail};
27 use byteorder::{BigEndian as BE, LittleEndian as LE, ReadBytesExt};27 use byteorder::{BigEndian as BE, LittleEndian as LE, ReadBytesExt};
28 28
29 use crate::common::{ImportedCapture, MacAddr, PmkidCapture};29 use crate::common::{ImportedCapture, MacAddr, PmkidCapture};
@@ -57,17 +57,25 @@ pub(crate) fn frames(path: &Path) -> io::Result<(u32, Vec<Vec<u8>>)> {
57 return Err(io::Error::new(57 return Err(io::Error::new(
58 ErrorKind::InvalidData,58 ErrorKind::InvalidData,
59 format!("pcap: bad magic 0x{magic:08x}"),59 format!("pcap: bad magic 0x{magic:08x}"),
60- ))60+ ));
61 }61 }
62 };62 };
63 macro_rules! read_u16 {63 macro_rules! read_u16 {
64 ($c:expr) => {64 ($c:expr) => {
65- if big_endian { $c.read_u16::<BE>() } else { $c.read_u16::<LE>() }65+ if big_endian {
66+ $c.read_u16::<BE>()
67+ } else {
68+ $c.read_u16::<LE>()
69+ }
66 };70 };
67 }71 }
68 macro_rules! read_u32 {72 macro_rules! read_u32 {
69 ($c:expr) => {73 ($c:expr) => {
70- if big_endian { $c.read_u32::<BE>() } else { $c.read_u32::<LE>() }74+ if big_endian {
75+ $c.read_u32::<BE>()
76+ } else {
77+ $c.read_u32::<LE>()
78+ }
71 };79 };
72 }80 }
73 let _version_major = read_u16!(&mut cur)?;81 let _version_major = read_u16!(&mut cur)?;
@@ -129,18 +137,19 @@ pub fn extract(path: &Path) -> Result<Vec<ImportedCapture>> {
129 }137 }
130 }138 }
131 if strip_failures > 0 {139 if strip_failures > 0 {
132- tracing::warn!("pcap import: {strip_failures} frames with malformed radiotap headers skipped");140+ tracing::warn!(
141+ "pcap import: {strip_failures} frames with malformed radiotap headers skipped"
142+ );
133 }143 }
134 144
135 // Pass 1: bssid → essid map from beacons and probe responses.145 // Pass 1: bssid → essid map from beacons and probe responses.
136 let mut essids: BTreeMap<MacAddr, String> = BTreeMap::new();146 let mut essids: BTreeMap<MacAddr, String> = BTreeMap::new();
137 for f in &dot11_frames {147 for f in &dot11_frames {
138- if let Some(info) = dot11::parse_beacon_or_probe(f) {148+ if let Some(info) = dot11::parse_beacon_or_probe(f)
139- if let Some(ssid) = info.ssid {149+ && let Some(ssid) = info.ssid
140- if !ssid.is_empty() {150+ && !ssid.is_empty()
141- essids.entry(info.bssid).or_insert(ssid);151+ {
142- }152+ essids.entry(info.bssid).or_insert(ssid);
143- }
144 }153 }
145 }154 }
146 155
@@ -169,18 +178,19 @@ pub fn extract(path: &Path) -> Result<Vec<ImportedCapture>> {
169 // skip once a completion/PMKID actually appears below.178 // skip once a completion/PMKID actually appears below.
170 }179 }
171 // PMKID lives in the M1 key-data (AP → station message).180 // PMKID lives in the M1 key-data (AP → station message).
172- if ap_sender && eapol_4way_msg(&key) == 1 {181+ if ap_sender
173- if let Some(pmkid) = crate::pmkid::extract_pmkid(key.key_data) {182+ && eapol_4way_msg(&key) == 1
174- if essid.is_empty() {183+ && let Some(pmkid) = crate::pmkid::extract_pmkid(key.key_data)
175- skipped_no_essid += 1;184+ {
176- } else {185+ if essid.is_empty() {
177- captures.push(ImportedCapture::Pmkid(PmkidCapture {186+ skipped_no_essid += 1;
178- ap: bssid,187+ } else {
179- client: sta,188+ captures.push(ImportedCapture::Pmkid(PmkidCapture {
180- essid: essid.clone(),189+ ap: bssid,
181- pmkid,190+ client: sta,
182- }));191+ essid: essid.clone(),
183- }192+ pmkid,
193+ }));
184 }194 }
185 }195 }
186 if let Some(cap) = tracker.ingest(bssid, sta, &essid, &key, &tx) {196 if let Some(cap) = tracker.ingest(bssid, sta, &essid, &key, &tx) {
@@ -214,7 +224,7 @@ mod tests {
214 #[test]224 #[test]
215 fn pcap_roundtrip_frame_bytes() {225 fn pcap_roundtrip_frame_bytes() {
216 let dir = std::env::temp_dir().join(format!(226 let dir = std::env::temp_dir().join(format!(
217- "wifilab-pcapin-test-{}-roundtrip",227+ "wifi_lab-pcapin-test-{}-roundtrip",
218 std::process::id()228 std::process::id()
219 ));229 ));
220 std::fs::create_dir_all(&dir).unwrap();230 std::fs::create_dir_all(&dir).unwrap();
@@ -240,7 +250,7 @@ mod tests {
240 #[test]250 #[test]
241 fn extract_rejects_ethernet_linktype() {251 fn extract_rejects_ethernet_linktype() {
242 let dir = std::env::temp_dir().join(format!(252 let dir = std::env::temp_dir().join(format!(
243- "wifilab-pcapin-test-{}-linktype",253+ "wifi_lab-pcapin-test-{}-linktype",
244 std::process::id()254 std::process::id()
245 ));255 ));
246 std::fs::create_dir_all(&dir).unwrap();256 std::fs::create_dir_all(&dir).unwrap();
@@ -343,10 +353,8 @@ mod tests {
343 353
344 #[test]354 #[test]
345 fn extract_imports_handshake_e2e() {355 fn extract_imports_handshake_e2e() {
346- let dir = std::env::temp_dir().join(format!(356+ let dir =
347- "wifilab-pcapin-test-{}-e2e",357+ std::env::temp_dir().join(format!("wifi_lab-pcapin-test-{}-e2e", std::process::id()));
348- std::process::id()
349- ));
350 std::fs::create_dir_all(&dir).unwrap();358 std::fs::create_dir_all(&dir).unwrap();
351 let path = dir.join("import.pcap");359 let path = dir.join("import.pcap");
352 360
@@ -359,7 +367,10 @@ mod tests {
359 367
360 let frames = vec![368 let frames = vec![
361 radiotap_wrap(test_beacon()),369 radiotap_wrap(test_beacon()),
362- radiotap_wrap(build_eapol_frame(true, &eapol_key(true, 7, anonce, [0; 16]))),370+ radiotap_wrap(build_eapol_frame(
371+ true,
372+ &eapol_key(true, 7, anonce, [0; 16]),
373+ )),
363 radiotap_wrap(build_eapol_frame(false, &eapol_key(false, 8, snonce, mic))),374 radiotap_wrap(build_eapol_frame(false, &eapol_key(false, 8, snonce, mic))),
364 ];375 ];
365 {376 {
@@ -388,7 +399,7 @@ mod tests {
388 #[test]399 #[test]
389 fn extract_skips_handshake_without_essid() {400 fn extract_skips_handshake_without_essid() {
390 let dir = std::env::temp_dir().join(format!(401 let dir = std::env::temp_dir().join(format!(
391- "wifilab-pcapin-test-{}-noessid",402+ "wifi_lab-pcapin-test-{}-noessid",
392 std::process::id()403 std::process::id()
393 ));404 ));
394 std::fs::create_dir_all(&dir).unwrap();405 std::fs::create_dir_all(&dir).unwrap();
@@ -401,7 +412,10 @@ mod tests {
401 mic[0] = 0xcc;412 mic[0] = 0xcc;
402 // No beacon in the file → essid unresolvable → no capture.413 // No beacon in the file → essid unresolvable → no capture.
403 let frames = vec![414 let frames = vec![
404- radiotap_wrap(build_eapol_frame(true, &eapol_key(true, 1, anonce, [0; 16]))),415+ radiotap_wrap(build_eapol_frame(
416+ true,
417+ &eapol_key(true, 1, anonce, [0; 16]),
418+ )),
405 radiotap_wrap(build_eapol_frame(false, &eapol_key(false, 2, snonce, mic))),419 radiotap_wrap(build_eapol_frame(false, &eapol_key(false, 2, snonce, mic))),
406 ];420 ];
407 {421 {
src/pmkid.rsmodified+10 -9
@@ -24,11 +24,7 @@ pub(crate) fn extract_pmkid(key_data: &[u8]) -> Option<[u8; 16]> {
24 while let (Some(&id), Some(&len)) = (key_data.get(cur), key_data.get(cur + 1)) {24 while let (Some(&id), Some(&len)) = (key_data.get(cur), key_data.get(cur + 1)) {
25 let len = len as usize;25 let len = len as usize;
26 let body = key_data.get(cur + 2..cur + 2 + len)?;26 let body = key_data.get(cur + 2..cur + 2 + len)?;
27- if id == 0xdd27+ if id == 0xdd && len >= 20 && body[0..3] == [0x00, 0x0f, 0xac] && body[3] == 4 {
28- && len >= 20
29- && body[0..3] == [0x00, 0x0f, 0xac]
30- && body[3] == 4
31- {
32 return body.get(4..20)?.try_into().ok();28 return body.get(4..20)?.try_into().ok();
33 }29 }
34 cur += 2 + len;30 cur += 2 + len;
@@ -62,11 +58,16 @@ pub fn grab(
62 let _ = tx.send(Event::Log(format!("pmkid: assoc-req sent to {ap}")));58 let _ = tx.send(Event::Log(format!("pmkid: assoc-req sent to {ap}")));
63 59
64 let deadline = Instant::now() + GRAB_WINDOW;60 let deadline = Instant::now() + GRAB_WINDOW;
65- let mut buf = vec![0u8; 4096];61+ // 16 KiB covers any real 802.11 frame; recv_msg flags over-long
62+ // garbage so we drop it instead of parsing a truncated prefix.
63+ let mut buf = vec![0u8; crate::rawsock::RECV_BUFSZ];
66 while Instant::now() < deadline {64 while Instant::now() < deadline {
67- match sock.recv(&mut buf) {65+ match sock.recv_msg(&mut buf) {
68- Ok(n) => {66+ Ok(msg) => {
69- let Some((_meta, frame)) = strip(&buf[..n]) else {67+ if msg.truncated() {
68+ continue;
69+ }
70+ let Some((_meta, frame)) = strip(&buf[..msg.len]) else {
70 continue;71 continue;
71 };72 };
72 // addr1 (receiver, at offset 4 of any 802.11 header) must73 // addr1 (receiver, at offset 4 of any 802.11 header) must
src/radiotap.rsmodified+1 -1
@@ -171,7 +171,7 @@ mod tests {
171 let mut f = vec![0u8, 0, 0, 0, 0x21, 0x00, 0x00, 0x80]; // present w0: tsft|antenna|ext171 let mut f = vec![0u8, 0, 0, 0, 0x21, 0x00, 0x00, 0x80]; // present w0: tsft|antenna|ext
172 f.extend_from_slice(&0u32.to_le_bytes()); // present w1: empty, ends bitmap172 f.extend_from_slice(&0u32.to_le_bytes()); // present w1: empty, ends bitmap
173 let fields_start = f.len(); // 12173 let fields_start = f.len(); // 12
174- let pad = (fields_start + 7) / 8 * 8 - fields_start;174+ let pad = fields_start.div_ceil(8) * 8 - fields_start;
175 f.resize(fields_start + pad + 8 + 1, 0u8);175 f.resize(fields_start + pad + 8 + 1, 0u8);
176 let rssi_at = fields_start + pad + 8;176 let rssi_at = fields_start + pad + 8;
177 f[rssi_at] = (-30i8) as u8;177 f[rssi_at] = (-30i8) as u8;
src/rainbow.rsmodified+569 -107
@@ -6,48 +6,116 @@
6 //! turns every later run against that SSID into a raw compare (millions of6 //! turns every later run against that SSID into a raw compare (millions of
7 //! candidates per second), at disk cost of ~64 B per entry.7 //! candidates per second), at disk cost of ~64 B per entry.
8 //!8 //!
9-//! Text format, one entry per line:9+//! Current text format (v2), one entry per line, all binary data hex-coded
10+//! so no passphrase byte (newline, `=`, high-bit) can corrupt the frame:
10 //! ```text11 //! ```text
11-//! # wifilab-pmk v1 ssid=Parafin12+//! # wifi_lab-pmk v2 ssid=<hex of SSID>
12-//! <64 lowercase hex chars of PMK> <passphrase bytes to end of line>13+//! <64 lowercase hex chars of PMK> <lowercase hex of passphrase>
14+//! # wifi_lab-pmk v2 end count=<entries> sha1=<40 lowercase hex>
13 //! ```15 //! ```
14-//! The passphrase runs to the end of the line (spaces allowed); only the16+//! The footer carries the entry count and a SHA-1 over the raw bytes of
15-//! first space separates it from the hex PMK. Lines that are empty, start17+//! every entry line (without its newline); [`open`] validates both eagerly
16-//! with `#`, or fail to parse are skipped.18+//! and REFUSES a truncated or mutated table instead of silently dropping
19+//! entries. Legacy v1 files (`# wifi_lab-pmk v1 ssid=<plaintext>`, raw
20+//! passphrase to end of line) are still read — with a `tracing::warn!` — but
21+//! every write produces v2.
17 22
23+use std::collections::HashSet;
18 use std::fs::File;24 use std::fs::File;
19-use std::io::{BufRead, BufReader, BufWriter, Write};25+use std::io::{BufRead, BufReader, BufWriter, Seek, SeekFrom, Write};
20 use std::path::Path;26 use std::path::Path;
27+use std::sync::atomic::{AtomicU64, Ordering};
21 28
22 use anyhow::{Context, Result, bail};29 use anyhow::{Context, Result, bail};
30+use sha1::{Digest, Sha1};
23 31
24-const MAGIC: &str = "# wifilab-pmk v1";32+const MAGIC_V1: &str = "# wifi_lab-pmk v1";
33+const MAGIC_V2: &str = "# wifi_lab-pmk v2";
34+const FOOTER: &str = "# wifi_lab-pmk v2 end";
35+
36+/// Process-wide count of table lines skipped by [`open`] iterators while
37+/// streaming v1/headerless files (malformed lines; v2 files are validated
38+/// eagerly and never reach the iterator with bad lines).
39+static SKIPPED_LINES: AtomicU64 = AtomicU64::new(0);
40+
41+/// Cumulative number of PMK-table lines skipped since process start (see
42+/// [`SKIPPED_LINES`]). Read before/after exhausting an iterator; the delta
43+/// is that file's skipped total.
44+pub fn skipped_lines() -> u64 {
45+ SKIPPED_LINES.load(Ordering::Relaxed)
46+}
25 47
26 struct PmkIter {48 struct PmkIter {
27- lines: std::io::Lines<BufReader<File>>,49+ reader: BufReader<File>,
28- /// First line, kept when it turned out to be an entry, not the header.50+ /// v2 body (hex-coded passphrases, footer-terminated) vs legacy v1
29- pending: Option<String>,51+ /// (raw passphrase to end of line).
52+ v2: bool,
53+ /// First line, kept (trimmed) when it turned out to be an entry, not
54+ /// the header.
55+ pending: Option<Vec<u8>>,
56+}
57+
58+/// Strip the line terminator: `\n`, then one `\r` of a CRLF pair.
59+fn trim_eol(mut line: Vec<u8>) -> Vec<u8> {
60+ if line.last() == Some(&b'\n') {
61+ line.pop();
62+ if line.last() == Some(&b'\r') {
63+ line.pop();
64+ }
65+ }
66+ line
30 }67 }
31 68
32 impl Iterator for PmkIter {69 impl Iterator for PmkIter {
33 type Item = ([u8; 32], Vec<u8>);70 type Item = ([u8; 32], Vec<u8>);
34 71
35 fn next(&mut self) -> Option<Self::Item> {72 fn next(&mut self) -> Option<Self::Item> {
36- if let Some(first) = self.pending.take() {73+ let mut buf = Vec::new();
37- return parse_entry(first.as_bytes());74+ loop {
38- }75+ let line = if let Some(first) = self.pending.take() {
39- for line in self.lines.by_ref() {76+ first
40- let Ok(line) = line else { continue }; // unreadable line: skip, keep streaming77+ } else {
41- let Some(entry) = parse_entry(line.as_bytes()) else {78+ buf.clear();
42- continue;79+ match self.reader.read_until(b'\n', &mut buf) {
80+ Ok(0) => return None,
81+ Ok(_) => trim_eol(std::mem::take(&mut buf)),
82+ // Unreadable line: count it and stop — a persistent read
83+ // error would otherwise spin forever.
84+ Err(_) => {
85+ SKIPPED_LINES.fetch_add(1, Ordering::Relaxed);
86+ return None;
87+ }
88+ }
43 };89 };
44- return Some(entry);90+ if self.v2 {
91+ if line.starts_with(FOOTER.as_bytes()) {
92+ return None; // end of entries
93+ }
94+ match parse_entry_v2(&line) {
95+ Some(entry) => return Some(entry),
96+ None => {
97+ SKIPPED_LINES.fetch_add(1, Ordering::Relaxed);
98+ continue;
99+ }
100+ }
101+ }
102+ // v1 / headerless: comments and empty lines are by design, not
103+ // counted as skipped.
104+ if line.is_empty() || line.starts_with(b"#") {
105+ continue;
106+ }
107+ match parse_entry(&line) {
108+ Some(entry) => return Some(entry),
109+ None => {
110+ SKIPPED_LINES.fetch_add(1, Ordering::Relaxed);
111+ continue;
112+ }
113+ }
45 }114 }
46- None
47 }115 }
48 }116 }
49 117
50-/// `<64 hex> <pass>` → `(pmk, pass)`, or None when malformed.118+/// `<64 hex> <pass>` → `(pmk, pass)`, or None when malformed (v1).
51 fn parse_entry(line: &[u8]) -> Option<([u8; 32], Vec<u8>)> {119 fn parse_entry(line: &[u8]) -> Option<([u8; 32], Vec<u8>)> {
52 if line.len() < 66 || line[64] != b' ' {120 if line.len() < 66 || line[64] != b' ' {
53 return None;121 return None;
@@ -62,45 +130,118 @@ fn parse_entry(line: &[u8]) -> Option<([u8; 32], Vec<u8>)> {
62 Some((pmk, pass))130 Some((pmk, pass))
63 }131 }
64 132
133+/// `<64 hex> <hex-pass>` → `(pmk, pass)`, or None when malformed (v2).
134+fn parse_entry_v2(line: &[u8]) -> Option<([u8; 32], Vec<u8>)> {
135+ if line.len() < 65 || line[64] != b' ' {
136+ return None;
137+ }
138+ let pmk = hex32(&line[..64])?;
139+ let pass = unhex(&line[65..])?;
140+ if !(8..=63).contains(&pass.len()) {
141+ return None;
142+ }
143+ Some((pmk, pass))
144+}
145+
65 /// Strict lowercase-or-uppercase 64-char hex → 32 bytes.146 /// Strict lowercase-or-uppercase 64-char hex → 32 bytes.
66 fn hex32(s: &[u8]) -> Option<[u8; 32]> {147 fn hex32(s: &[u8]) -> Option<[u8; 32]> {
67 if s.len() != 64 {148 if s.len() != 64 {
68 return None;149 return None;
69 }150 }
70- let nibble = |b: u8| -> Option<u8> {
71- match b {
72- b'0'..=b'9' => Some(b - b'0'),
73- b'a'..=b'f' => Some(b - b'a' + 10),
74- b'A'..=b'F' => Some(b - b'A' + 10),
75- _ => None,
76- }
77- };
78 let mut out = [0u8; 32];151 let mut out = [0u8; 32];
79- for (i, pair) in s.chunks_exact(2).enumerate() {152+ for (i, pair) in s.as_chunks::<2>().0.iter().enumerate() {
80 out[i] = (nibble(pair[0])? << 4) | nibble(pair[1])?;153 out[i] = (nibble(pair[0])? << 4) | nibble(pair[1])?;
81 }154 }
82 Some(out)155 Some(out)
83 }156 }
84 157
158+/// Even-length lowercase-or-uppercase hex → bytes.
159+fn unhex(s: &[u8]) -> Option<Vec<u8>> {
160+ if !s.len().is_multiple_of(2) {
161+ return None;
162+ }
163+ let mut out = Vec::with_capacity(s.len() / 2);
164+ for pair in s.as_chunks::<2>().0 {
165+ out.push((nibble(pair[0])? << 4) | nibble(pair[1])?);
166+ }
167+ Some(out)
168+}
169+
170+fn nibble(b: u8) -> Option<u8> {
171+ match b {
172+ b'0'..=b'9' => Some(b - b'0'),
173+ b'a'..=b'f' => Some(b - b'a' + 10),
174+ b'A'..=b'F' => Some(b - b'A' + 10),
175+ _ => None,
176+ }
177+}
178+
179+fn hex_push(out: &mut String, bytes: &[u8]) {
180+ const HEX: &[u8; 16] = b"0123456789abcdef";
181+ for b in bytes {
182+ out.push(HEX[(b >> 4) as usize] as char);
183+ out.push(HEX[(b & 0xf) as usize] as char);
184+ }
185+}
186+
187+/// Streaming `(pmk, passphrase)` entries of an opened table.
188+pub type EntryIter = Box<dyn Iterator<Item = ([u8; 32], Vec<u8>)> + Send>;
189+
85 /// Open a table for cracking. Returns the SSID recorded in the header190 /// Open a table for cracking. Returns the SSID recorded in the header
86 /// (`None` when the file has no header) plus a streaming iterator of191 /// (`None` when the file has no header) plus a streaming iterator of
87 /// `(pmk, passphrase)` entries. The caller MUST verify the header SSID192 /// `(pmk, passphrase)` entries. The caller MUST verify the header SSID
88 /// matches the target — PMKs are salt-bound to the SSID and compare-fail193 /// matches the target — PMKs are salt-bound to the SSID and compare-fail
89 /// silently otherwise.194 /// silently otherwise.
90-pub fn open(path: &Path) -> Result<(Option<String>, Box<dyn Iterator<Item = ([u8; 32], Vec<u8>)> + Send>)> {195+///
91- let f = File::open(path)196+/// v2 tables are validated EAGERLY (one extra read pass): every entry line
92- .with_context(|| format!("opening PMK table {}", path.display()))?;197+/// must parse, the footer must be present and last, its entry count and
198+/// SHA-1 (over the raw entry-line bytes) must match — any violation is an
199+/// error here, not silently dropped entries mid-crack. v1 tables load with
200+/// a `tracing::warn!` (legacy, unauthenticated format).
201+pub fn open(path: &Path) -> Result<(Option<String>, EntryIter)> {
202+ let f = File::open(path).with_context(|| format!("opening PMK table {}", path.display()))?;
93 let mut reader = BufReader::with_capacity(1 << 20, f);203 let mut reader = BufReader::with_capacity(1 << 20, f);
94- // Peek the first line for the header.204+ // Peek the first line (byte-based: entry passphrases need not be UTF-8).
95- let mut first = String::new();205+ let mut first = Vec::new();
96 let n = reader206 let n = reader
97- .read_line(&mut first)207+ .read_until(b'\n', &mut first)
98 .with_context(|| format!("reading PMK table {}", path.display()))?;208 .with_context(|| format!("reading PMK table {}", path.display()))?;
209+ let first = trim_eol(first);
210+
211+ if n > 0 && first.starts_with(MAGIC_V2.as_bytes()) {
212+ let ssid = parse_header_v2(&first)
213+ .with_context(|| format!("malformed v2 header in PMK table {}", path.display()))?;
214+ validate_v2_body(&mut reader, path)?;
215+ // Validated: rewind past the header and stream the entries.
216+ let mut f = reader.into_inner();
217+ f.seek(SeekFrom::Start(0))
218+ .with_context(|| format!("rewinding PMK table {}", path.display()))?;
219+ let mut reader = BufReader::with_capacity(1 << 20, f);
220+ let mut header = Vec::new();
221+ reader
222+ .read_until(b'\n', &mut header)
223+ .with_context(|| format!("reading PMK table {}", path.display()))?;
224+ return Ok((
225+ Some(ssid),
226+ Box::new(PmkIter {
227+ reader,
228+ v2: true,
229+ pending: None,
230+ }),
231+ ));
232+ }
233+
99 let (ssid, pending) = if n > 0 {234 let (ssid, pending) = if n > 0 {
100- let trimmed = first.trim_end_matches(['\r', '\n']);235+ match std::str::from_utf8(&first).ok().and_then(parse_header_v1) {
101- match parse_header(trimmed) {236+ Some(s) => {
102- Some(s) => (Some(s), None),237+ tracing::warn!(
103- // Not a header: the first line is an entry — don't drop it.238+ "PMK table {} uses the legacy v1 format (no integrity check) — rebuild it to upgrade to v2",
239+ path.display()
240+ );
241+ (Some(s), None)
242+ }
243+ // Not a header: the first line is an entry — keep it (TRIMMED:
244+ // the bytes yielded must not carry the line terminator).
104 None => (None, Some(first)),245 None => (None, Some(first)),
105 }246 }
106 } else {247 } else {
@@ -109,70 +250,202 @@ pub fn open(path: &Path) -> Result<(Option<String>, Box<dyn Iterator<Item = ([u8
109 Ok((250 Ok((
110 ssid,251 ssid,
111 Box::new(PmkIter {252 Box::new(PmkIter {
112- lines: reader.lines(),253+ reader,
254+ v2: false,
113 pending,255 pending,
114 }),256 }),
115 ))257 ))
116 }258 }
117 259
118-/// `# wifilab-pmk v1 ssid=<essid>` → Some(essid); anything else → None.260+/// Eager integrity pass over the v2 body (header already consumed): every
119-fn parse_header(line: &str) -> Option<String> {261+/// line until the footer must be a well-formed entry; the footer must be
120- let rest = line.strip_prefix(MAGIC)?;262+/// the last line and its `count`/`sha1` must match the body.
263+fn validate_v2_body(reader: &mut BufReader<File>, path: &Path) -> Result<()> {
264+ let mut hash = Sha1::new();
265+ let mut count = 0u64;
266+ let mut footer: Option<(u64, [u8; 20])> = None;
267+ let mut buf = Vec::new();
268+ loop {
269+ buf.clear();
270+ let n = reader
271+ .read_until(b'\n', &mut buf)
272+ .with_context(|| format!("reading PMK table {}", path.display()))?;
273+ if n == 0 {
274+ break;
275+ }
276+ let line = trim_eol(std::mem::take(&mut buf));
277+ if let Some(f) = parse_footer(&line) {
278+ footer = Some(f);
279+ // The footer must terminate the file.
280+ let mut tail = Vec::new();
281+ let m = reader
282+ .read_until(b'\n', &mut tail)
283+ .with_context(|| format!("reading PMK table {}", path.display()))?;
284+ if m != 0 {
285+ bail!(
286+ "PMK table {}: mutated — entries after the footer",
287+ path.display()
288+ );
289+ }
290+ break;
291+ }
292+ if parse_entry_v2(&line).is_none() {
293+ bail!(
294+ "PMK table {}: mutated — malformed or unexpected line in v2 table",
295+ path.display()
296+ );
297+ }
298+ hash.update(&line);
299+ count += 1;
300+ }
301+ let Some((want_count, want_digest)) = footer else {
302+ bail!(
303+ "PMK table {}: truncated — v2 footer missing (partial write?)",
304+ path.display()
305+ );
306+ };
307+ if want_count != count {
308+ bail!(
309+ "PMK table {}: corrupted — footer says {want_count} entries, body has {count}",
310+ path.display()
311+ );
312+ }
313+ let digest: [u8; 20] = hash.finalize().into();
314+ if digest != want_digest {
315+ bail!(
316+ "PMK table {}: corrupted — entry checksum mismatch",
317+ path.display()
318+ );
319+ }
320+ Ok(())
321+}
322+
323+/// `# wifi_lab-pmk v1 ssid=<essid>` → Some(essid); anything else → None.
324+fn parse_header_v1(line: &str) -> Option<String> {
325+ let rest = line.strip_prefix(MAGIC_V1)?;
121 rest.strip_prefix(" ssid=").map(str::to_string)326 rest.strip_prefix(" ssid=").map(str::to_string)
122 }327 }
123 328
124-/// Streaming table writer: [`create`], [`TableWriter::push`], done.329+/// `# wifi_lab-pmk v2 ssid=<hex essid>` → Some(essid); anything else → None.
330+fn parse_header_v2(line: &[u8]) -> Option<String> {
331+ let rest = line.strip_prefix(MAGIC_V2.as_bytes())?;
332+ let rest = rest.strip_prefix(b" ssid=")?;
333+ String::from_utf8(unhex(rest)?).ok()
334+}
335+
336+/// `# wifi_lab-pmk v2 end count=<n> sha1=<40 hex>` → Some((n, digest)).
337+fn parse_footer(line: &[u8]) -> Option<(u64, [u8; 20])> {
338+ let s = std::str::from_utf8(line).ok()?;
339+ let rest = s.strip_prefix(FOOTER)?.strip_prefix(" count=")?;
340+ let (count_s, digest_s) = rest.split_once(" sha1=")?;
341+ let count: u64 = count_s.parse().ok()?;
342+ let digest: [u8; 20] = unhex(digest_s.as_bytes())?.try_into().ok()?;
343+ Some((count, digest))
344+}
345+
346+/// Streaming table writer: [`create`], [`TableWriter::push`],
347+/// [`TableWriter::finish`] (writing the integrity footer). The file is only
348+/// valid v2 once `finish` ran — a crash mid-build leaves a footer-less file
349+/// that [`open`] reports as truncated instead of trusting.
125 pub struct TableWriter {350 pub struct TableWriter {
126 w: BufWriter<File>,351 w: BufWriter<File>,
352+ /// Total entries in the file (preloaded + pushed this session).
127 entries: u64,353 entries: u64,
354+ /// Entries pushed by THIS session's [`TableWriter::push`] calls (what
355+ /// [`TableWriter::finish`] reports back to the caller).
356+ session_new: u64,
357+ /// Passphrases already in the file (dedupe), preloaded on append.
358+ seen: HashSet<Vec<u8>>,
359+ /// Running SHA-1 over the raw entry-line bytes (footer checksum).
360+ hash: Sha1,
128 }361 }
129 362
130 impl TableWriter {363 impl TableWriter {
131 /// Append one entry. `pass` must be 8..=63 bytes (WPA passphrase range).364 /// Append one entry. `pass` must be 8..=63 bytes (WPA passphrase range).
365+ /// A passphrase already in the table is skipped silently (dedupe); the
366+ /// file keeps exactly one entry per passphrase.
132 pub fn push(&mut self, pmk: &[u8; 32], pass: &[u8]) -> std::io::Result<()> {367 pub fn push(&mut self, pmk: &[u8; 32], pass: &[u8]) -> std::io::Result<()> {
368+ self.push_inner(pmk, pass, true)
369+ }
370+
371+ fn push_inner(
372+ &mut self,
373+ pmk: &[u8; 32],
374+ pass: &[u8],
375+ count_as_new: bool,
376+ ) -> std::io::Result<()> {
133 debug_assert!((8..=63).contains(&pass.len()));377 debug_assert!((8..=63).contains(&pass.len()));
134- const HEX: &[u8; 16] = b"0123456789abcdef";378+ if !self.seen.insert(pass.to_vec()) {
135- let mut hex = [0u8; 64];379+ return Ok(()); // duplicate passphrase — deduped
136- for (i, b) in pmk.iter().enumerate() {
137- hex[i * 2] = HEX[(b >> 4) as usize];
138- hex[i * 2 + 1] = HEX[(b & 0xf) as usize];
139 }380 }
140- self.w.write_all(&hex)?;381+ let mut line = String::with_capacity(64 + 1 + pass.len() * 2);
141- self.w.write_all(b" ")?;382+ hex_push(&mut line, pmk);
142- self.w.write_all(pass)?;383+ line.push(' ');
143- self.w.write_all(b"\n")?;384+ hex_push(&mut line, pass);
385+ self.hash.update(line.as_bytes());
386+ line.push('\n');
387+ self.w.write_all(line.as_bytes())?;
144 self.entries += 1;388 self.entries += 1;
389+ if count_as_new {
390+ self.session_new += 1;
391+ }
145 Ok(())392 Ok(())
146 }393 }
147 394
148- /// Entries written so far. Flushes the buffer.395+ /// Write the integrity footer and flush. Returns the number of entries
396+ /// appended by THIS session (preloaded/kept entries don't count).
149 pub fn finish(mut self) -> std::io::Result<u64> {397 pub fn finish(mut self) -> std::io::Result<u64> {
398+ let digest = std::mem::take(&mut self.hash).finalize();
399+ let mut footer = String::with_capacity(80);
400+ footer.push_str(FOOTER);
401+ footer.push_str(" count=");
402+ footer.push_str(&self.entries.to_string());
403+ footer.push_str(" sha1=");
404+ hex_push(&mut footer, &digest);
405+ footer.push('\n');
406+ self.w.write_all(footer.as_bytes())?;
150 self.w.flush()?;407 self.w.flush()?;
151- Ok(self.entries)408+ Ok(self.session_new)
152 }409 }
153 }410 }
154 411
155-/// Create a table file with the header for `ssid`. Existing file is412+/// Create a v2 table file with the header for `ssid`. Existing file is
156 /// truncated. Parent directories are created.413 /// truncated. Parent directories are created.
157 pub fn create(path: &Path, ssid: &str) -> Result<TableWriter> {414 pub fn create(path: &Path, ssid: &str) -> Result<TableWriter> {
158 if let Some(parent) = path.parent() {415 if let Some(parent) = path.parent() {
159 std::fs::create_dir_all(parent)416 std::fs::create_dir_all(parent)
160 .with_context(|| format!("creating PMK table directory {}", parent.display()))?;417 .with_context(|| format!("creating PMK table directory {}", parent.display()))?;
161 }418 }
162- let f = File::create(path)419+ let f = File::create(path).with_context(|| format!("creating PMK table {}", path.display()))?;
163- .with_context(|| format!("creating PMK table {}", path.display()))?;
164 let mut w = BufWriter::with_capacity(1 << 20, f);420 let mut w = BufWriter::with_capacity(1 << 20, f);
165- writeln!(w, "{MAGIC} ssid={ssid}")421+ let mut header = String::with_capacity(MAGIC_V2.len() + 8 + ssid.len() * 2);
422+ header.push_str(MAGIC_V2);
423+ header.push_str(" ssid=");
424+ hex_push(&mut header, ssid.as_bytes());
425+ header.push('\n');
426+ w.write_all(header.as_bytes())
166 .with_context(|| format!("writing PMK table header {}", path.display()))?;427 .with_context(|| format!("writing PMK table header {}", path.display()))?;
167- Ok(TableWriter { w, entries: 0 })428+ Ok(TableWriter {
429+ w,
430+ entries: 0,
431+ session_new: 0,
432+ seen: HashSet::new(),
433+ hash: Sha1::new(),
434+ })
168 }435 }
169 436
170-/// Open `path` for APPENDING as the table for `ssid` (per-SSID PMK cache437+/// Open `path` as the table for `ssid` (per-SSID PMK cache writer): a
171-/// writer): a missing or zero-length file is created with a fresh header438+/// missing or zero-length file is created fresh (`create` semantics); an
172-/// (`create` semantics); an existing non-empty file MUST carry a header439+/// existing non-empty file MUST carry a header whose SSID passes
173-/// whose SSID passes [`check_ssid`] against `ssid` — anything else is an440+/// [`check_ssid`] against `ssid` — anything else is an error (refusing to
174-/// error (refusing to corrupt a table belonging to another SSID). The441+/// corrupt a table belonging to another SSID).
175-/// file is opened append-mode, so existing entries are never touched.442+///
443+/// v2 tables can't grow by blind appending (the footer carries a checksum
444+/// and entry count), so the existing entries are read — v2 integrity
445+/// validated, so a truncated/mutated table errors here — and REWRITTEN
446+/// together with the new ones; [`TableWriter::push`] dedupes against the
447+/// existing passphrases. The file on disk never mixes formats: what leaves
448+/// this function is always a valid v2 stream.
176 pub fn append_open(path: &Path, ssid: &str) -> Result<TableWriter> {449 pub fn append_open(path: &Path, ssid: &str) -> Result<TableWriter> {
177 let needs_header = match std::fs::metadata(path) {450 let needs_header = match std::fs::metadata(path) {
178 Ok(m) => m.len() == 0,451 Ok(m) => m.len() == 0,
@@ -184,27 +457,21 @@ pub fn append_open(path: &Path, ssid: &str) -> Result<TableWriter> {
184 if needs_header {457 if needs_header {
185 return create(path, ssid);458 return create(path, ssid);
186 }459 }
187- // Existing table: verify the recorded SSID before appending (PMKs are460+ // Existing table: verify the recorded SSID and load its entries BEFORE
188- // salt-bound to the SSID; mixing tables would poison the cache).461+ // truncating (v2 validation happens inside open).
189- let first = {462+ let existing: Vec<([u8; 32], Vec<u8>)> = {
190- let f = File::open(path)463+ let (table_ssid, entries) =
191- .with_context(|| format!("opening PMK table {}", path.display()))?;464+ open(path).with_context(|| format!("reading existing PMK table {}", path.display()))?;
192- let mut reader = BufReader::new(f);465+ check_ssid(table_ssid.as_deref(), ssid)
193- let mut line = String::new();466+ .with_context(|| format!("cannot append to PMK table {}", path.display()))?;
194- reader467+ entries.collect()
195- .read_line(&mut line)
196- .with_context(|| format!("reading PMK table header {}", path.display()))?;
197- line
198 };468 };
199- let header = parse_header(first.trim_end_matches(['\r', '\n']));469+ let mut w = create(path, ssid)?;
200- check_ssid(header.as_deref(), ssid)470+ for (pmk, pass) in &existing {
201- .with_context(|| format!("cannot append to PMK table {}", path.display()))?;471+ w.push_inner(pmk, pass, false)
202- let f = std::fs::OpenOptions::new()472+ .with_context(|| format!("rewriting PMK table {}", path.display()))?;
203- .append(true)473+ }
204- .open(path)474+ Ok(w)
205- .with_context(|| format!("appending to PMK table {}", path.display()))?;
206- let w = BufWriter::with_capacity(1 << 20, f);
207- Ok(TableWriter { w, entries: 0 })
208 }475 }
209 476
210 /// Guard used before starting a rainbow run: the table's SSID must equal477 /// Guard used before starting a rainbow run: the table's SSID must equal
@@ -222,19 +489,42 @@ pub fn check_ssid(table_ssid: Option<&str>, target_ssid: &str) -> Result<()> {
222 #[cfg(test)]489 #[cfg(test)]
223 mod tests {490 mod tests {
224 use super::*;491 use super::*;
492+ use std::io::Write;
493+
494+ /// Serializes tests that assert on the process-wide skip counter
495+ /// (parking_lot isn't a direct dependency; recover from poisoning
496+ /// instead of unwrapping).
497+ static SKIP_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
498+
499+ fn skip_lock() -> std::sync::MutexGuard<'static, ()> {
500+ SKIP_LOCK.lock().unwrap_or_else(|e| e.into_inner())
501+ }
502+
503+ fn tmp(name: &str) -> std::path::PathBuf {
504+ std::env::temp_dir().join(format!("wifi_lab-{name}-{}", std::process::id()))
505+ }
225 506
226 #[test]507 #[test]
227 fn header_parse() {508 fn header_parse() {
228 assert_eq!(509 assert_eq!(
229- parse_header("# wifilab-pmk v1 ssid=Parafin"),510+ parse_header_v1("# wifi_lab-pmk v1 ssid=Testnet"),
230- Some("Parafin".to_string())511+ Some("Testnet".to_string())
231 );512 );
232 assert_eq!(513 assert_eq!(
233- parse_header("# wifilab-pmk v1 ssid=with space"),514+ parse_header_v1("# wifi_lab-pmk v1 ssid=with space"),
234 Some("with space".to_string())515 Some("with space".to_string())
235 );516 );
236- assert_eq!(parse_header("# wifilab-pmk v1"), None);517+ assert_eq!(parse_header_v1("# wifi_lab-pmk v1"), None);
237- assert_eq!(parse_header("garbage"), None);518+ assert_eq!(parse_header_v1("garbage"), None);
519+ // v2: hex-ssid roundtrip, incl. spaces/UTF-8.
520+ let mut h = String::from("# wifi_lab-pmk v2 ssid=");
521+ hex_push(&mut h, "mit Leerzeichen".as_bytes());
522+ assert_eq!(
523+ parse_header_v2(h.as_bytes()),
524+ Some("mit Leerzeichen".into())
525+ );
526+ assert_eq!(parse_header_v2(b"# wifi_lab-pmk v2 ssid=zz"), None);
527+ assert_eq!(parse_header_v2(b"# wifi_lab-pmk v2"), None);
238 }528 }
239 529
240 #[test]530 #[test]
@@ -250,44 +540,173 @@ mod tests {
250 assert!(parse_entry(b"ab short").is_none());540 assert!(parse_entry(b"ab short").is_none());
251 assert!(parse_entry(format!("{}zz p", &hex[..62]).as_bytes()).is_none());541 assert!(parse_entry(format!("{}zz p", &hex[..62]).as_bytes()).is_none());
252 assert!(parse_entry(format!("{hex} short").as_bytes()).is_none());542 assert!(parse_entry(format!("{hex} short").as_bytes()).is_none());
543+ // v2: hex passphrase, odd length/bad nibble rejected.
544+ let v2 = format!("{hex} {}", "70".repeat(9));
545+ let (p2, w2) = parse_entry_v2(v2.as_bytes()).expect("v2 parses");
546+ assert_eq!(p2, pmk);
547+ assert_eq!(w2, b"ppppppppp");
548+ assert!(parse_entry_v2(format!("{hex} abc").as_bytes()).is_none());
549+ assert!(parse_entry_v2(format!("{hex} 7z").as_bytes()).is_none());
253 }550 }
254 551
255 #[test]552 #[test]
256 fn roundtrip_write_read() {553 fn roundtrip_write_read() {
257- let path = std::env::temp_dir().join(format!("wifilab-rainbow-test-{}", std::process::id()));554+ let path = tmp("rainbow-test");
258 let entries: Vec<([u8; 32], Vec<u8>)> = vec![555 let entries: Vec<([u8; 32], Vec<u8>)> = vec![
259 ([0x11; 32], b"password1".to_vec()),556 ([0x11; 32], b"password1".to_vec()),
260 ([0x22; 32], b"two words here".to_vec()),557 ([0x22; 32], b"two words here".to_vec()),
261 ([0x33; 32], b"a".repeat(63)),558 ([0x33; 32], b"a".repeat(63)),
262 ];559 ];
263 {560 {
264- let mut w = create(&path, "Parafin").unwrap();561+ let mut w = create(&path, "Testnet").unwrap();
265 for (pmk, pass) in &entries {562 for (pmk, pass) in &entries {
266 w.push(pmk, pass).unwrap();563 w.push(pmk, pass).unwrap();
267 }564 }
268 assert_eq!(w.finish().unwrap(), 3);565 assert_eq!(w.finish().unwrap(), 3);
269 }566 }
270 let (ssid, it) = open(&path).unwrap();567 let (ssid, it) = open(&path).unwrap();
271- assert_eq!(ssid.as_deref(), Some("Parafin"));568+ assert_eq!(ssid.as_deref(), Some("Testnet"));
569+ let got: Vec<_> = it.collect();
570+ assert_eq!(got, entries);
571+ let _ = std::fs::remove_file(&path);
572+ }
573+
574+ #[test]
575+ fn v2_roundtrips_binary_passphrases() {
576+ // Passphrase bytes that would corrupt a line-based v1 table:
577+ // newline, carriage return, '=', leading/trailing spaces, high-bit.
578+ let path = tmp("rainbow-bin");
579+ let nasty: Vec<u8> = {
580+ let mut v = b"give".to_vec();
581+ v.extend_from_slice(b"me\nliberty=or giveme death \xf0\x9f\x94\x91");
582+ v.truncate(40);
583+ v
584+ };
585+ assert!(nasty.len() <= 63);
586+ let entries: Vec<([u8; 32], Vec<u8>)> = vec![
587+ ([0x01; 32], b"with\nnewline".to_vec()),
588+ ([0x02; 32], b"trail=eq==".to_vec()),
589+ ([0x03; 32], nasty.clone()),
590+ ([0x04; 32], b"\xff\xfepass\x80\x81".to_vec()),
591+ ];
592+ {
593+ let mut w = create(&path, "bin net").unwrap();
594+ for (pmk, pass) in &entries {
595+ w.push(pmk, pass).unwrap();
596+ }
597+ assert_eq!(w.finish().unwrap(), 4);
598+ }
599+ // On disk: no raw newline/"=" from passphrases — just hex.
600+ let raw = std::fs::read_to_string(&path).unwrap();
601+ assert_eq!(raw.lines().count(), 2 + 4); // header + 4 entries + footer
602+ let (ssid, it) = open(&path).unwrap();
603+ assert_eq!(ssid.as_deref(), Some("bin net"));
272 let got: Vec<_> = it.collect();604 let got: Vec<_> = it.collect();
273 assert_eq!(got, entries);605 assert_eq!(got, entries);
274 let _ = std::fs::remove_file(&path);606 let _ = std::fs::remove_file(&path);
275 }607 }
276 608
277 #[test]609 #[test]
278- fn headerless_table_reads_with_none_ssid() {610+ fn headerless_table_first_entry_has_exact_bytes() {
279- let path = std::env::temp_dir().join(format!("wifilab-rainbow-hdr-{}", std::process::id()));611+ // Regression: the peeked first line kept its trailing \r\n, so entry
280- std::fs::write(&path, format!("{} passw0rd\n", "cd".repeat(32))).unwrap();612+ // #1's passphrase gained a newline and first-line hits were wrong.
613+ let path = tmp("rainbow-hdr");
614+ std::fs::write(
615+ &path,
616+ format!(
617+ "{} firstp4ss\r\n{} secondp4ss\n",
618+ "cd".repeat(32),
619+ "ef".repeat(32)
620+ ),
621+ )
622+ .unwrap();
281 let (ssid, it) = open(&path).unwrap();623 let (ssid, it) = open(&path).unwrap();
282 assert_eq!(ssid, None);624 assert_eq!(ssid, None);
283- assert_eq!(it.count(), 1);625+ let got: Vec<_> = it.collect();
626+ assert_eq!(
627+ got,
628+ vec![
629+ ([0xcd; 32], b"firstp4ss".to_vec()),
630+ ([0xef; 32], b"secondp4ss".to_vec()),
631+ ]
632+ );
633+ let _ = std::fs::remove_file(&path);
634+ }
635+
636+ #[test]
637+ fn v1_table_reads_with_legacy_entries() {
638+ let _g = skip_lock();
639+ let path = tmp("rainbow-v1");
640+ {
641+ let mut f = File::create(&path).unwrap();
642+ writeln!(f, "# wifi_lab-pmk v1 ssid=Legacy").unwrap();
643+ writeln!(f, "{} pass word1", "ab".repeat(32)).unwrap();
644+ // Raw high-bit bytes in a v1 passphrase: still readable.
645+ f.write_all("cd".repeat(32).as_bytes()).unwrap();
646+ f.write_all(b" p\xe4ssw\xF6rd\n").unwrap();
647+ // Malformed line: skipped (and counted), not fatal.
648+ writeln!(f, "this is not an entry").unwrap();
649+ }
650+ let before = skipped_lines();
651+ let (ssid, it) = open(&path).unwrap();
652+ assert_eq!(ssid.as_deref(), Some("Legacy"));
653+ let got: Vec<_> = it.collect();
654+ assert_eq!(
655+ got,
656+ vec![
657+ ([0xab; 32], b"pass word1".to_vec()),
658+ ([0xcd; 32], b"p\xe4ssw\xF6rd".to_vec()),
659+ ]
660+ );
661+ assert_eq!(skipped_lines() - before, 1);
662+ let _ = std::fs::remove_file(&path);
663+ }
664+
665+ #[test]
666+ fn v2_corruption_and_truncation_detected() {
667+ let path = tmp("rainbow-corrupt");
668+ {
669+ let mut w = create(&path, "Testnet").unwrap();
670+ w.push(&[0x11; 32], b"password1").unwrap();
671+ w.push(&[0x22; 32], b"password2").unwrap();
672+ w.finish().unwrap();
673+ }
674+ let good = std::fs::read(&path).unwrap();
675+
676+ // Truncated (footer missing / partial build) → error, not partial read.
677+ let footer_at = good
678+ .windows(FOOTER.len())
679+ .rposition(|w| w == FOOTER.as_bytes())
680+ .unwrap();
681+ std::fs::write(&path, &good[..footer_at]).unwrap();
682+ let e = open(&path).err().expect("truncated table refused");
683+ assert!(format!("{e:#}").contains("truncated"), "{e:#}");
684+
685+ // Mutated entry (flip one hex char of a passphrase) → checksum error.
686+ let mut mutated = good.clone();
687+ // First entry line starts right after the header line.
688+ let off = good.iter().position(|&b| b == b'\n').unwrap() + 1 + 70;
689+ mutated[off] = if mutated[off] == b'0' { b'1' } else { b'0' };
690+ std::fs::write(&path, &mutated).unwrap();
691+ let e = open(&path).err().expect("mutated table refused");
692+ assert!(format!("{e:#}").contains("checksum"), "{e:#}");
693+
694+ // Entry inserted after the footer → error.
695+ let mut appended = good.clone();
696+ appended.extend_from_slice(format!("{} passw0rd3\n", "ab".repeat(32)).as_bytes());
697+ std::fs::write(&path, &appended).unwrap();
698+ assert!(open(&path).is_err());
699+
700+ // Untouched file still opens.
701+ std::fs::write(&path, &good).unwrap();
702+ let (_, it) = open(&path).unwrap();
703+ assert_eq!(it.count(), 2);
284 let _ = std::fs::remove_file(&path);704 let _ = std::fs::remove_file(&path);
285 }705 }
286 706
287 #[test]707 #[test]
288 fn append_open_create_vs_append() {708 fn append_open_create_vs_append() {
289- let path =709+ let path = tmp("append-pmk");
290- std::env::temp_dir().join(format!("wifilab-append-pmk-{}", std::process::id()));
291 let _ = std::fs::remove_file(&path);710 let _ = std::fs::remove_file(&path);
292 // Missing file → created WITH a header, writable.711 // Missing file → created WITH a header, writable.
293 {712 {
@@ -317,10 +736,47 @@ mod tests {
317 let _ = std::fs::remove_file(&path);736 let _ = std::fs::remove_file(&path);
318 }737 }
319 738
739+ #[test]
740+ fn append_open_dedupes_existing_entries() {
741+ let path = tmp("append-dedupe");
742+ {
743+ let mut w = create(&path, "net1").unwrap();
744+ w.push(&[0x11; 32], b"password1").unwrap();
745+ w.push(&[0x22; 32], b"password2").unwrap();
746+ assert_eq!(w.finish().unwrap(), 2);
747+ }
748+ // Duplicates inside one session are dropped too.
749+ {
750+ let mut w = create(&path, "net1").unwrap();
751+ w.push(&[0xaa; 32], b"password1").unwrap();
752+ w.push(&[0xbb; 32], b"password1").unwrap();
753+ w.push(&[0x22; 32], b"password2").unwrap();
754+ assert_eq!(w.finish().unwrap(), 2);
755+ }
756+ {
757+ let mut w = append_open(&path, "net1").unwrap();
758+ // password2 already in the table → deduped, not counted as new.
759+ w.push(&[0x33; 32], b"password2").unwrap();
760+ w.push(&[0x44; 32], b"password3").unwrap();
761+ assert_eq!(w.finish().unwrap(), 1);
762+ }
763+ let (ssid, it) = open(&path).unwrap();
764+ assert_eq!(ssid.as_deref(), Some("net1"));
765+ let got: Vec<_> = it.collect();
766+ assert_eq!(
767+ got,
768+ vec![
769+ ([0xaa; 32], b"password1".to_vec()),
770+ ([0x22; 32], b"password2".to_vec()),
771+ ([0x44; 32], b"password3".to_vec()),
772+ ]
773+ );
774+ let _ = std::fs::remove_file(&path);
775+ }
776+
320 #[test]777 #[test]
321 fn append_open_refuses_ssid_mismatch() {778 fn append_open_refuses_ssid_mismatch() {
322- let path =779+ let path = tmp("append-mix");
323- std::env::temp_dir().join(format!("wifilab-append-mix-{}", std::process::id()));
324 {780 {
325 let mut w = create(&path, "net1").unwrap();781 let mut w = create(&path, "net1").unwrap();
326 w.push(&[0x11; 32], b"password1").unwrap();782 w.push(&[0x11; 32], b"password1").unwrap();
@@ -330,17 +786,23 @@ mod tests {
330 let e = append_open(&path, "othernet").err().expect("refused");786 let e = append_open(&path, "othernet").err().expect("refused");
331 assert!(format!("{e:#}").contains("othernet"), "{e:#}");787 assert!(format!("{e:#}").contains("othernet"), "{e:#}");
332 // Headerless existing file: unverifiable → also refused.788 // Headerless existing file: unverifiable → also refused.
333- let raw = std::env::temp_dir().join(format!("wifilab-append-raw-{}", std::process::id()));789+ let raw = tmp("append-raw");
334 std::fs::write(&raw, format!("{} passw0rd\n", "cd".repeat(32))).unwrap();790 std::fs::write(&raw, format!("{} passw0rd\n", "cd".repeat(32))).unwrap();
335 assert!(append_open(&raw, "net1").is_err());791 assert!(append_open(&raw, "net1").is_err());
792+ // Corrupt v2 table: integrity error surfaces instead of silent loss.
793+ let mut bytes = std::fs::read(&path).unwrap();
794+ let off = bytes.iter().position(|&b| b == b'\n').unwrap() + 1 + 70;
795+ bytes[off] = if bytes[off] == b'0' { b'1' } else { b'0' };
796+ std::fs::write(&path, &bytes).unwrap();
797+ assert!(append_open(&path, "net1").is_err());
336 let _ = std::fs::remove_file(&path);798 let _ = std::fs::remove_file(&path);
337 let _ = std::fs::remove_file(&raw);799 let _ = std::fs::remove_file(&raw);
338 }800 }
339 801
340 #[test]802 #[test]
341 fn ssid_guard() {803 fn ssid_guard() {
342- assert!(check_ssid(Some("Parafin"), "Parafin").is_ok());804+ assert!(check_ssid(Some("Testnet"), "Testnet").is_ok());
343- assert!(check_ssid(Some("other"), "Parafin").is_err());805+ assert!(check_ssid(Some("other"), "Testnet").is_err());
344- assert!(check_ssid(None, "Parafin").is_err());806+ assert!(check_ssid(None, "Testnet").is_err());
345 }807 }
346 }808 }
src/rawsock.rsmodified+111 -14
@@ -8,11 +8,35 @@ use std::ffi::CString;
8 use std::io;8 use std::io;
9 use std::mem::size_of;9 use std::mem::size_of;
10 10
11+/// Receive buffer size covering any real 802.11 frame: the largest A-MSDU
12+/// aggregate tops out at 11454 octets (802.11-2020 §9.3.2.1 max MPDU) and a
13+/// monitor-mode radiotap header is at most a few hundred bytes; 16 KiB
14+/// leaves generous headroom.
15+pub const RECV_BUFSZ: usize = 16384;
16+
17+/// Outcome of [`RawSocket::recv_msg`]: bytes copied into the caller's
18+/// buffer plus the frame's true on-wire length, so truncation is visible
19+/// instead of silent.
20+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
21+pub struct RecvMsg {
22+ /// Bytes actually written into the caller's buffer.
23+ pub len: usize,
24+ /// Full frame length as reported by the kernel (MSG_TRUNC).
25+ pub orig_len: usize,
26+}
27+
28+impl RecvMsg {
29+ /// True when the frame didn't fit the buffer and `len` bytes are a
30+ /// prefix of a longer packet.
31+ pub fn truncated(&self) -> bool {
32+ self.orig_len > self.len
33+ }
34+}
35+
11 pub struct RawSocket {36 pub struct RawSocket {
12 fd: i32,37 fd: i32,
13 #[allow(dead_code)]38 #[allow(dead_code)]
14 ifindex: i32,39 ifindex: i32,
15- ifname: String,
16 }40 }
17 41
18 impl RawSocket {42 impl RawSocket {
@@ -59,24 +83,27 @@ impl RawSocket {
59 Ok(RawSocket {83 Ok(RawSocket {
60 fd,84 fd,
61 ifindex: ifindex as i32,85 ifindex: ifindex as i32,
62- ifname: ifname.to_string(),
63 })86 })
64 }87 }
65 }88 }
66 89
67- pub fn ifname(&self) -> String {90+ /// Truncation-aware receive: passes MSG_TRUNC on a packet socket, so
68- self.ifname.clone()91+ /// the kernel reports the frame's true length even when it exceeds
69- }92+ /// `buf`. The caller MUST check [`RecvMsg::truncated`] and drop the
70-93+ /// prefix (or enlarge the buffer) — the buffer then holds only the
71- /// Blocking receive of one L2 frame (radiotap + 802.11 in monitor mode).94+ /// first `len` bytes of a longer frame.
72- /// Retries transparently on EINTR.95+ pub fn recv_msg(&self, buf: &mut [u8]) -> io::Result<RecvMsg> {
73- pub fn recv(&self, buf: &mut [u8]) -> io::Result<usize> {
74 loop {96 loop {
75 // SAFETY: fd is a live socket owned by self; buf is valid for97 // SAFETY: fd is a live socket owned by self; buf is valid for
76 // buf.len() writable bytes.98 // buf.len() writable bytes.
77- let n = unsafe { libc::recv(self.fd, buf.as_mut_ptr().cast(), buf.len(), 0) };99+ let n =
100+ unsafe { libc::recv(self.fd, buf.as_mut_ptr().cast(), buf.len(), libc::MSG_TRUNC) };
78 if n >= 0 {101 if n >= 0 {
79- return Ok(n as usize);102+ let orig_len = n as usize;
103+ return Ok(RecvMsg {
104+ len: orig_len.min(buf.len()),
105+ orig_len,
106+ });
80 }107 }
81 let err = io::Error::last_os_error();108 let err = io::Error::last_os_error();
82 if err.kind() != io::ErrorKind::Interrupted {109 if err.kind() != io::ErrorKind::Interrupted {
@@ -145,19 +172,20 @@ mod tests {
145 172
146 /// Without root/CAP_NET_RAW this returns EPERM; with it, loopback opens173 /// Without root/CAP_NET_RAW this returns EPERM; with it, loopback opens
147 /// fine. Both outcomes are acceptable — the point is no panic and that a174 /// fine. Both outcomes are acceptable — the point is no panic and that a
148- /// successful open reports its name.175+ /// successful open accepts a timeout.
149 #[test]176 #[test]
150 fn open_loopback_best_effort() {177 fn open_loopback_best_effort() {
151 match RawSocket::open("lo") {178 match RawSocket::open("lo") {
152 Ok(sock) => {179 Ok(sock) => {
153- assert_eq!(sock.ifname(), "lo");
154 assert!(sock.set_timeout(100).is_ok());180 assert!(sock.set_timeout(100).is_ok());
155 }181 }
156 Err(e) => {182 Err(e) => {
157 let k = e.kind();183 let k = e.kind();
158 assert!(matches!(184 assert!(matches!(
159 k,185 k,
160- io::ErrorKind::PermissionDenied | io::ErrorKind::NotFound | io::ErrorKind::Other186+ io::ErrorKind::PermissionDenied
187+ | io::ErrorKind::NotFound
188+ | io::ErrorKind::Other
161 ));189 ));
162 }190 }
163 }191 }
@@ -168,4 +196,73 @@ mod tests {
168 let res = RawSocket::open("no_such_iface_zz");196 let res = RawSocket::open("no_such_iface_zz");
169 assert!(res.is_err());197 assert!(res.is_err());
170 }198 }
199+
200+ /// MSG_TRUNC reporting semantics: a frame longer than the buffer shows
201+ /// len == buf.len() < orig_len; anything else is complete.
202+ #[test]
203+ fn recv_msg_truncation_flag() {
204+ let m = RecvMsg {
205+ len: 100,
206+ orig_len: 200,
207+ };
208+ assert!(m.truncated());
209+ let m = RecvMsg {
210+ len: 200,
211+ orig_len: 200,
212+ };
213+ assert!(!m.truncated());
214+ let m = RecvMsg {
215+ len: 100,
216+ orig_len: 100,
217+ };
218+ assert!(!m.truncated());
219+ }
220+
221+ /// Live MSG_TRUNC round-trip: send a big UDP datagram over loopback via
222+ /// an AF_PACKET socket and confirm recv_msg reports the full length
223+ /// while delivering only a prefix. Skipped silently without
224+ /// CAP_NET_RAW (same posture as `open_loopback_best_effort`).
225+ #[test]
226+ fn recv_msg_reports_full_length_on_truncation() {
227+ let Ok(sock) = RawSocket::open("lo") else {
228+ return; // no CAP_NET_RAW in the test sandbox
229+ };
230+ // UDP needs root for raw sends on lo through AF_PACKET? No — we
231+ // send an ordinary UDP datagram; the packet socket sees it twice
232+ // (outgoing + incoming) with the full L2/L3/L4 framing.
233+ let udp = match std::net::UdpSocket::bind("127.0.0.1:0") {
234+ Ok(s) => s,
235+ Err(_) => return,
236+ };
237+ if udp.connect("127.0.0.1:9").is_err() {
238+ return;
239+ }
240+ let payload = vec![0xabu8; 6000]; // fits loopback MTU (65536)
241+ if udp.send(&payload).is_err() {
242+ return;
243+ }
244+ sock.set_timeout(500).expect("set_timeout");
245+ let mut tiny = [0u8; 128];
246+ // Read until an over-long packet arrives: the datagram shows up as
247+ // outgoing + incoming copies, both >128 bytes. Small stray traffic
248+ // (ARP, ICMP errors) is skipped.
249+ for _ in 0..8 {
250+ match sock.recv_msg(&mut tiny) {
251+ Ok(m) if m.truncated() => {
252+ assert_eq!(m.len, tiny.len());
253+ assert!(m.orig_len > tiny.len());
254+ return;
255+ }
256+ Ok(_) => continue, // short frame — not ours, keep looking
257+ Err(e)
258+ if e.kind() == io::ErrorKind::WouldBlock
259+ || e.kind() == io::ErrorKind::TimedOut =>
260+ {
261+ break;
262+ }
263+ Err(_) => continue,
264+ }
265+ }
266+ panic!("no over-long packet observed on loopback packet socket");
267+ }
171 }268 }
src/scanner.rsmodified+522 -133
@@ -4,8 +4,8 @@
4 //! correlation happens in [`crate::handshake`].4 //! correlation happens in [`crate::handshake`].
5 5
6 use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};6 use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
7-use std::sync::{Arc, Mutex};
8 use std::sync::atomic::{AtomicBool, Ordering};7 use std::sync::atomic::{AtomicBool, Ordering};
8+use std::sync::{Arc, Mutex};
9 use std::time::{Duration, Instant};9 use std::time::{Duration, Instant};
10 // `Instant` is still used for dwell timing; timestamps going into shared10 // `Instant` is still used for dwell timing; timestamps going into shared
11 // types are `u64` millis (`crate::common::now_ms`) so they serialize.11 // types are `u64` millis (`crate::common::now_ms`) so they serialize.
@@ -39,6 +39,28 @@ const DEAUTH_ALERT_COOLDOWN_MS: u64 = 30_000;
39 /// window prune keeps it small in practice).39 /// window prune keeps it small in practice).
40 const DEAUTH_HIST_CAP: usize = 32;40 const DEAUTH_HIST_CAP: usize = 32;
41 41
42+/// Consecutive non-timeout recv failures after which the scanner gives up:
43+/// a persistent error (ENODEV — card yanked, EIO — firmware wedged) would
44+/// otherwise spin the dwell loop re-emitting the identical event forever.
45+const RECV_ERROR_ABORT_THRESHOLD: u32 = 3;
46+
47+/// EMA weight of each new RSSI sample (~5-sample effective window): a
48+/// station walking away visibly decays within a second or two of normal
49+/// beacon traffic, while single-frame fades don't reorder the UI.
50+const RSSI_EMA_ALPHA: f32 = 0.4;
51+
52+/// Exponential moving average of RSSI samples; the stored/emitted value is
53+/// the rounded i8 so the on-wire event types stay unchanged. Replaces the
54+/// earlier peak-hold rule (only-updates-on-improvement) that left stale
55+/// inflated signal on stations that moved away.
56+fn ema_next(prev: f32, sample: i8) -> f32 {
57+ RSSI_EMA_ALPHA * sample as f32 + (1.0 - RSSI_EMA_ALPHA) * prev
58+}
59+
60+fn ema_report(ema: f32) -> i8 {
61+ ema.round().clamp(i8::MIN as f32, i8::MAX as f32) as i8
62+}
63+
42 // ---------------------------------------------------------------------------64 // ---------------------------------------------------------------------------
43 // device identity groups (MAC-randomization pairing)65 // device identity groups (MAC-randomization pairing)
44 // ---------------------------------------------------------------------------66 // ---------------------------------------------------------------------------
@@ -121,10 +143,11 @@ impl GroupBook {
121 m.last_seq = seq.or(m.last_seq);143 m.last_seq = seq.or(m.last_seq);
122 }144 }
123 g.fps.insert(fp);145 g.fps.insert(fp);
124- if let Some(s) = ssid {146+ if let Some(s) = ssid
125- if !s.is_empty() && g.ssids.len() < 64 {147+ && !s.is_empty()
126- g.ssids.insert(s.to_string());148+ && g.ssids.len() < 64
127- }149+ {
150+ g.ssids.insert(s.to_string());
128 }151 }
129 return None;152 return None;
130 }153 }
@@ -147,14 +170,13 @@ impl GroupBook {
147 for gi in hits {170 for gi in hits {
148 let g = &self.groups[gi];171 let g = &self.groups[gi];
149 let fresh = g.macs.values().max_by_key(|m| m.last_seen_ms);172 let fresh = g.macs.values().max_by_key(|m| m.last_seen_ms);
150- let ssid_match =173+ let ssid_match = ssid.is_some_and(|s| !s.is_empty() && g.ssids.contains(s));
151- ssid.is_some_and(|s| !s.is_empty() && g.ssids.contains(s));174+ let seq_continues =
152- let seq_continues = seq175+ seq.zip(fresh.and_then(|m| m.last_seq))
153- .zip(fresh.and_then(|m| m.last_seq))176+ .is_some_and(|(a, b)| {
154- .is_some_and(|(a, b)| {177+ let d = a.wrapping_sub(b);
155- let d = a.wrapping_sub(b);178+ (1..=32).contains(&d)
156- d >= 1 && d <= 32179+ });
157- });
158 let conf = if ssid_match || seq_continues {180 let conf = if ssid_match || seq_continues {
159 IdentConfidence::Strong181 IdentConfidence::Strong
160 } else {182 } else {
@@ -182,15 +204,23 @@ impl GroupBook {
182 };204 };
183 205
184 let g = &mut self.groups[gi];206 let g = &mut self.groups[gi];
185- g.macs.insert(sta, MacSeen { last_seen_ms: now, last_seq: seq, conf });207+ g.macs.insert(
208+ sta,
209+ MacSeen {
210+ last_seen_ms: now,
211+ last_seq: seq,
212+ conf,
213+ },
214+ );
186 g.fps.insert(fp);215 g.fps.insert(fp);
187 if uuid.is_some() {216 if uuid.is_some() {
188 g.uuid = uuid;217 g.uuid = uuid;
189 }218 }
190- if let Some(s) = ssid {219+ if let Some(s) = ssid
191- if !s.is_empty() && g.ssids.len() < 64 {220+ && !s.is_empty()
192- g.ssids.insert(s.to_string());221+ && g.ssids.len() < 64
193- }222+ {
223+ g.ssids.insert(s.to_string());
194 }224 }
195 self.mac_to_group.insert(sta, gi);225 self.mac_to_group.insert(sta, gi);
196 self.fp_to_groups.entry(fp).or_default().push(gi);226 self.fp_to_groups.entry(fp).or_default().push(gi);
@@ -276,17 +306,103 @@ fn freq_to_channel(freq_mhz: u16) -> Option<u8> {
276 2484 => Some(14),306 2484 => Some(14),
277 // 5 GHz: ch = (freq - 5000) / 5.307 // 5 GHz: ch = (freq - 5000) / 5.
278 5000..=5900 => Some(((freq_mhz - 5000) / 5) as u8),308 5000..=5900 => Some(((freq_mhz - 5000) / 5) as u8),
279- // 6 GHz: ch = (freq - 5950) / 5 (collides numerically with 2.4 GHz;309+ // 6 GHz (802.11ax): 20 MHz channel center = 5950 + 5·ch for
280- // display-only usage here).310+ // ch 1..=233 (so 5955 → ch 1). The band-edge outlier 5935 MHz is
281- 5945..=6425 => Some(((freq_mhz - 5950) / 5) as u8),311+ // ch 2 of the same numbering (iw / IEEE precedent); 5940/5945 are
312+ // wide-channel center artifacts, not 20 MHz channels — unmapped.
313+ // NB: 5945..5950 must never reach the subtraction arm (u16
314+ // underflow → debug panic).
315+ 5935 => Some(2),
316+ 5955..=7115 => Some(((freq_mhz - 5950) / 5) as u8),
282 _ => None,317 _ => None,
283 }318 }
284 }319 }
285 320
321+/// One full parse of a stripped 802.11 frame, shared between the run-loop
322+/// stats block and [`Scanner::ingest_classified`] so each frame on the RX
323+/// hot path is parsed exactly once. Parser precedence mirrors the
324+/// historical ingest order.
325+enum FrameClass {
326+ /// Beacon or probe-response (AP-producing).
327+ Beacon(dot11::MgmtInfo),
328+ /// Well-formed probe request carrying client identity material.
329+ ProbeIdent(dot11::ProbeIdent),
330+ /// Association / reassociation request.
331+ Association(dot11::AssocIdent),
332+ /// Deauthentication or disassociation.
333+ Deauth { from: MacAddr, target: MacAddr },
334+ /// Data frame with resolvable (bssid, station) endpoints.
335+ Data { bssid: MacAddr, sta: MacAddr },
336+ /// Stats-only bucket: probe-request FC (caught by the cheap
337+ /// [`dot11::parse_probe_req`]) but the deeper identity walk
338+ /// ([`dot11::parse_probe_ident`]) failed on malformed IEs — counts as
339+ /// a parsed mgmt frame, carries nothing to ingest.
340+ ProbeReqMalformed,
341+ /// Anything else (control frames, unknown types, garbage).
342+ Other,
343+}
344+
345+impl FrameClass {
346+ /// Whether the historical stats block counted this frame as a parsed
347+ /// 802.11 management frame (beacon/probe family or deauth/disassoc).
348+ fn counts_as_mgmt(&self) -> bool {
349+ matches!(
350+ self,
351+ FrameClass::Beacon(_)
352+ | FrameClass::ProbeIdent(_)
353+ | FrameClass::ProbeReqMalformed
354+ | FrameClass::Deauth { .. }
355+ )
356+ }
357+}
358+
359+/// Classify + parse a stripped 802.11 frame in one pass. Fallback order
360+/// matches ingest semantics exactly: a frame that succeeds an earlier
361+/// parser is never offered to a later one.
362+fn classify(frame: &[u8]) -> FrameClass {
363+ if let Some(m) = dot11::parse_beacon_or_probe(frame) {
364+ return FrameClass::Beacon(m);
365+ }
366+ if let Some(ident) = dot11::parse_probe_ident(frame) {
367+ return FrameClass::ProbeIdent(ident);
368+ }
369+ if let Some(ident) = dot11::parse_assoc_ident(frame) {
370+ return FrameClass::Association(ident);
371+ }
372+ if let Some((from, target)) = dot11::parse_deauth(frame) {
373+ return FrameClass::Deauth { from, target };
374+ }
375+ if let Some((bssid, sta)) = dot11::data_endpoints(frame) {
376+ return FrameClass::Data { bssid, sta };
377+ }
378+ // The stats heartbeat also counted probe requests whose deeper
379+ // identity parse failed — cheap FC-level re-check, only reached by
380+ // frames every real parser already rejected.
381+ if dot11::parse_probe_req(frame).is_some() {
382+ return FrameClass::ProbeReqMalformed;
383+ }
384+ FrameClass::Other
385+}
386+
387+/// One frame's MAC-randomization correlation material (bundle for
388+/// [`Scanner::note_ident`]): IE fingerprint, WPS UUID-E, SSID,
389+/// sequence number and observation clock.
390+struct IdentObs<'a> {
391+ fp: u32,
392+ uuid: Option<[u8; 16]>,
393+ ssid: Option<&'a str>,
394+ seq: Option<u16>,
395+ now: u64,
396+}
397+
286 /// Stateful discovery engine — owned by `run`, unit-tested via `ingest`.398 /// Stateful discovery engine — owned by `run`, unit-tested via `ingest`.
287 struct Scanner {399 struct Scanner {
288 aps: BTreeMap<MacAddr, AccessPoint>,400 aps: BTreeMap<MacAddr, AccessPoint>,
289 clients: BTreeMap<MacAddr, ClientInfo>,401 clients: BTreeMap<MacAddr, ClientInfo>,
402+ /// RSSI EMA state per AP/client — the emitted `rssi_dbm` is the rounded
403+ /// average, so peak-hold can't freeze a stale strong signal on screen.
404+ ap_rssi_ema: HashMap<MacAddr, f32>,
405+ client_rssi_ema: HashMap<MacAddr, f32>,
290 rssi_floor: i8,406 rssi_floor: i8,
291 /// Own monitor-interface MAC + user-triggered deauth BSSIDs: frames407 /// Own monitor-interface MAC + user-triggered deauth BSSIDs: frames
292 /// sourced from these are suppressed in the storm detector.408 /// sourced from these are suppressed in the storm detector.
@@ -312,6 +428,8 @@ impl Scanner {
312 Self {428 Self {
313 aps: BTreeMap::new(),429 aps: BTreeMap::new(),
314 clients: BTreeMap::new(),430 clients: BTreeMap::new(),
431+ ap_rssi_ema: HashMap::new(),
432+ client_rssi_ema: HashMap::new(),
315 rssi_floor,433 rssi_floor,
316 own_mac,434 own_mac,
317 deauth_suppress,435 deauth_suppress,
@@ -324,10 +442,29 @@ impl Scanner {
324 442
325 /// Feed one received frame. Radiotap metadata in `meta`, 802.11 bytes in443 /// Feed one received frame. Radiotap metadata in `meta`, 802.11 bytes in
326 /// `frame` (already stripped), clock in `now` ms since the process-local444 /// `frame` (already stripped), clock in `now` ms since the process-local
327- /// epoch ([`common::now_ms`], test-injectable).445+ /// epoch ([`common::now_ms`], test-injectable). Test-only convenience:
446+ /// the run loop uses [`Scanner::ingest_classified`] with its own
447+ /// single-parse [`classify`] outcome.
448+ #[cfg(test)]
328 fn ingest(&mut self, meta: &RxMeta, frame: &[u8], now: u64, tx: &Sender<Event>) {449 fn ingest(&mut self, meta: &RxMeta, frame: &[u8], now: u64, tx: &Sender<Event>) {
450+ self.ingest_classified(meta, frame, classify(frame), now, tx);
451+ }
452+
453+ /// Ingest with the parse already done by [`classify`] — the run loop
454+ /// parses each frame once and hands the same outcome to its stats
455+ /// block and to this path (no double walks on the RX hot path).
456+ /// `frame` is still needed for the sequence-number pairing witness
457+ /// ([`dot11::seq_of`]).
458+ fn ingest_classified(
459+ &mut self,
460+ meta: &RxMeta,
461+ frame: &[u8],
462+ class: FrameClass,
463+ now: u64,
464+ tx: &Sender<Event>,
465+ ) {
329 // AP from beacon / probe-response.466 // AP from beacon / probe-response.
330- if let Some(m) = dot11::parse_beacon_or_probe(frame) {467+ if let FrameClass::Beacon(m) = class {
331 // Trust the DS-parameter IE; fall back to the radiotap carrier468 // Trust the DS-parameter IE; fall back to the radiotap carrier
332 // frequency hint when the IE is absent.469 // frequency hint when the IE is absent.
333 let channel = m470 let channel = m
@@ -338,9 +475,17 @@ impl Scanner {
338 match self.aps.get_mut(&m.bssid) {475 match self.aps.get_mut(&m.bssid) {
339 Some(ap) => {476 Some(ap) => {
340 let mut changed = false;477 let mut changed = false;
341- if meta.rssi_dbm != 0 && meta.rssi_dbm > ap.rssi_dbm {478+ if meta.rssi_dbm != 0 {
342- ap.rssi_dbm = meta.rssi_dbm;479+ let ema = self
343- changed = true;480+ .ap_rssi_ema
481+ .entry(m.bssid)
482+ .or_insert(ap.rssi_dbm as f32);
483+ *ema = ema_next(*ema, meta.rssi_dbm);
484+ let r = ema_report(*ema);
485+ if r != ap.rssi_dbm {
486+ ap.rssi_dbm = r;
487+ changed = true;
488+ }
344 }489 }
345 if !ssid.is_empty() && ap.ssid != ssid {490 if !ssid.is_empty() && ap.ssid != ssid {
346 ap.ssid = ssid.clone();491 ap.ssid = ssid.clone();
@@ -378,6 +523,9 @@ impl Scanner {
378 last_seen_ms: now,523 last_seen_ms: now,
379 akms: m.akms.clone(),524 akms: m.akms.clone(),
380 };525 };
526+ if meta.rssi_dbm != 0 {
527+ self.ap_rssi_ema.insert(m.bssid, meta.rssi_dbm as f32);
528+ }
381 self.aps.insert(m.bssid, ap.clone());529 self.aps.insert(m.bssid, ap.clone());
382 let _ = tx.send(Event::ApUpdated(ap));530 let _ = tx.send(Event::ApUpdated(ap));
383 }531 }
@@ -386,7 +534,7 @@ impl Scanner {
386 }534 }
387 535
388 // Client probing.536 // Client probing.
389- if let Some(ident) = dot11::parse_probe_ident(frame) {537+ if let FrameClass::ProbeIdent(ident) = class {
390 let sta = ident.sta;538 let sta = ident.sta;
391 if sta.is_multicast() || sta.is_zero() {539 if sta.is_multicast() || sta.is_zero() {
392 return;540 return;
@@ -411,11 +559,13 @@ impl Scanner {
411 // already carries the group id (no follow-up stamp needed).559 // already carries the group id (no follow-up stamp needed).
412 self.note_ident(560 self.note_ident(
413 sta,561 sta,
414- ident.fingerprint,562+ IdentObs {
415- ident.uuid,563+ fp: ident.fingerprint,
416- ident.ssid.as_deref(),564+ uuid: ident.uuid,
417- dot11::seq_of(frame),565+ ssid: ident.ssid.as_deref(),
418- now,566+ seq: dot11::seq_of(frame),
567+ now,
568+ },
419 tx,569 tx,
420 );570 );
421 self.note_client(sta, None, meta, now, tx);571 self.note_client(sta, None, meta, now, tx);
@@ -424,18 +574,20 @@ impl Scanner {
424 574
425 // Association/reassociation request: the station names the SSID it575 // Association/reassociation request: the station names the SSID it
426 // joins — the only on-air witness that reveals a hidden AP's SSID.576 // joins — the only on-air witness that reveals a hidden AP's SSID.
427- if let Some(ident) = dot11::parse_assoc_ident(frame) {577+ if let FrameClass::Association(ident) = class {
428 let sta = ident.sta;578 let sta = ident.sta;
429 if !sta.is_multicast() && !sta.is_zero() {579 if !sta.is_multicast() && !sta.is_zero() {
430 // Pairing first: the creation event then already carries580 // Pairing first: the creation event then already carries
431 // the group id.581 // the group id.
432 self.note_ident(582 self.note_ident(
433 sta,583 sta,
434- ident.fingerprint,584+ IdentObs {
435- ident.uuid,585+ fp: ident.fingerprint,
436- ident.ssid.as_deref(),586+ uuid: ident.uuid,
437- dot11::seq_of(frame),587+ ssid: ident.ssid.as_deref(),
438- now,588+ seq: dot11::seq_of(frame),
589+ now,
590+ },
439 tx,591 tx,
440 );592 );
441 self.note_client(sta, Some(ident.bssid), meta, now, tx);593 self.note_client(sta, Some(ident.bssid), meta, now, tx);
@@ -456,7 +608,7 @@ impl Scanner {
456 // the row. Either side can be the station: AP → client (target) or608 // the row. Either side can be the station: AP → client (target) or
457 // client-initiated (transmitter). Frames between unknown parties are609 // client-initiated (transmitter). Frames between unknown parties are
458 // noise — we only flip state on stations we already track.610 // noise — we only flip state on stations we already track.
459- if let Some((from, target)) = dot11::parse_deauth(frame) {611+ if let FrameClass::Deauth { from, target } = class {
460 self.track_foreign_deauth(from, target, now, tx);612 self.track_foreign_deauth(from, target, now, tx);
461 let sta = if !target.is_multicast() && !target.is_zero() {613 let sta = if !target.is_multicast() && !target.is_zero() {
462 self.clients.contains_key(&target).then_some(target)614 self.clients.contains_key(&target).then_some(target)
@@ -482,7 +634,7 @@ impl Scanner {
482 634
483 // Clients talking data: learn station side; the bssid side refreshes635 // Clients talking data: learn station side; the bssid side refreshes
484 // the AP liveness (channel/time) without bumping beacon count.636 // the AP liveness (channel/time) without bumping beacon count.
485- if let Some((bssid, sta)) = dot11::data_endpoints(frame) {637+ if let FrameClass::Data { bssid, sta } = class {
486 if !sta.is_multicast() && !sta.is_zero() {638 if !sta.is_multicast() && !sta.is_zero() {
487 self.note_client(sta, Some(bssid), meta, now, tx);639 self.note_client(sta, Some(bssid), meta, now, tx);
488 }640 }
@@ -536,17 +688,11 @@ impl Scanner {
536 /// MAC-randomization pairing: fold one frame's correlation material688 /// MAC-randomization pairing: fold one frame's correlation material
537 /// into the group book; emit [`Event::ClientIdent`] exactly once per689 /// into the group book; emit [`Event::ClientIdent`] exactly once per
538 /// pairing decision (first assignment or re-entry after expiry).690 /// pairing decision (first assignment or re-entry after expiry).
539- fn note_ident(691+ fn note_ident(&mut self, sta: MacAddr, obs: IdentObs<'_>, tx: &Sender<Event>) {
540- &mut self,692+ let Some((group, confidence)) = self
541- sta: MacAddr,693+ .groups
542- fp: u32,694+ .note(sta, obs.fp, obs.uuid, obs.ssid, obs.seq, obs.now)
543- uuid: Option<[u8; 16]>,695+ else {
544- ssid: Option<&str>,
545- seq: Option<u16>,
546- now: u64,
547- tx: &Sender<Event>,
548- ) {
549- let Some((group, confidence)) = self.groups.note(sta, fp, uuid, ssid, seq, now) else {
550 return;696 return;
551 };697 };
552 let _ = tx.send(Event::ClientIdent {698 let _ = tx.send(Event::ClientIdent {
@@ -575,16 +721,21 @@ impl Scanner {
575 match self.clients.get_mut(&sta) {721 match self.clients.get_mut(&sta) {
576 Some(c) => {722 Some(c) => {
577 let mut changed = false;723 let mut changed = false;
578- if meta.rssi_dbm != 0 && meta.rssi_dbm > c.rssi_dbm {724+ if meta.rssi_dbm != 0 {
579- c.rssi_dbm = meta.rssi_dbm;725+ let ema = self.client_rssi_ema.entry(sta).or_insert(c.rssi_dbm as f32);
580- changed = true;726+ *ema = ema_next(*ema, meta.rssi_dbm);
581- }727+ let r = ema_report(*ema);
582- if let Some(b) = ap {728+ if r != c.rssi_dbm {
583- if c.ap != Some(b) {729+ c.rssi_dbm = r;
584- c.ap = Some(b);
585 changed = true;730 changed = true;
586 }731 }
587 }732 }
733+ if let Some(b) = ap
734+ && c.ap != Some(b)
735+ {
736+ c.ap = Some(b);
737+ changed = true;
738+ }
588 // Any frame from the station proves liveness: clear the739 // Any frame from the station proves liveness: clear the
589 // deauth-flagged disconnect (the flip rides the normal740 // deauth-flagged disconnect (the flip rides the normal
590 // `changed` emit below — no separate storm).741 // `changed` emit below — no separate storm).
@@ -613,6 +764,9 @@ impl Scanner {
613 ident_group: ident.map(|(g, _)| g),764 ident_group: ident.map(|(g, _)| g),
614 ident_conf: ident.map(|(_, c)| c),765 ident_conf: ident.map(|(_, c)| c),
615 };766 };
767+ if meta.rssi_dbm != 0 {
768+ self.client_rssi_ema.insert(sta, meta.rssi_dbm as f32);
769+ }
616 self.clients.insert(sta, c.clone());770 self.clients.insert(sta, c.clone());
617 let _ = tx.send(Event::ClientUpdated(c));771 let _ = tx.send(Event::ClientUpdated(c));
618 }772 }
@@ -630,6 +784,7 @@ impl Scanner {
630 .collect();784 .collect();
631 for b in gone {785 for b in gone {
632 self.aps.remove(&b);786 self.aps.remove(&b);
787+ self.ap_rssi_ema.remove(&b);
633 let _ = tx.send(Event::ApLost(b));788 let _ = tx.send(Event::ApLost(b));
634 }789 }
635 let gone: Vec<MacAddr> = self790 let gone: Vec<MacAddr> = self
@@ -640,6 +795,7 @@ impl Scanner {
640 .collect();795 .collect();
641 for m in gone {796 for m in gone {
642 self.clients.remove(&m);797 self.clients.remove(&m);
798+ self.client_rssi_ema.remove(&m);
643 let _ = tx.send(Event::ClientLost(m));799 let _ = tx.send(Event::ClientLost(m));
644 }800 }
645 // Reap detector/dedup state alongside the row expiry so long801 // Reap detector/dedup state alongside the row expiry so long
@@ -682,13 +838,17 @@ struct ScanStats {
682 /// addr3 histogram of beacon_fc frames: answers "are other BSSIDs even838 /// addr3 histogram of beacon_fc frames: answers "are other BSSIDs even
683 /// reaching the card" without trusting any parser.839 /// reaching the card" without trusting any parser.
684 bssid_hist: std::collections::BTreeMap<crate::common::MacAddr, u64>,840 bssid_hist: std::collections::BTreeMap<crate::common::MacAddr, u64>,
841+ /// Frames dropped because the kernel reported them longer than the
842+ /// receive buffer (MSG_TRUNC) — would otherwise enter the pipeline
843+ /// (and the pcap spool) truncated.
844+ truncated_dropped: u64,
685 }845 }
686 846
687 /// Blocking channel-hop passive scan on an interface the caller already put847 /// Blocking channel-hop passive scan on an interface the caller already put
688 /// into monitor mode. Returns when `stop` flips true.848 /// into monitor mode. Returns when `stop` flips true.
689 pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Result<()> {849 pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Result<()> {
690- let sock = RawSocket::open(&cfg.ifname)850+ let sock =
691- .with_context(|| format!("opening {} for scan", cfg.ifname))?;851+ RawSocket::open(&cfg.ifname).with_context(|| format!("opening {} for scan", cfg.ifname))?;
692 sock.set_timeout(cfg.dwell_ms).context("set_timeout")?;852 sock.set_timeout(cfg.dwell_ms).context("set_timeout")?;
693 853
694 let freqs: Vec<u16> = if cfg.freqs.is_empty() {854 let freqs: Vec<u16> = if cfg.freqs.is_empty() {
@@ -704,7 +864,10 @@ pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Resu
704 )));864 )));
705 865
706 let mut scanner = Scanner::new(cfg.rssi_floor, cfg.own_mac, cfg.deauth_suppress.clone());866 let mut scanner = Scanner::new(cfg.rssi_floor, cfg.own_mac, cfg.deauth_suppress.clone());
707- let mut buf = vec![0u8; 4096];867+ // 16 KiB covers every real 802.11 frame (max A-MSDU 11454 + radiotap);
868+ // anything bigger is a driver/kernel anomaly — recv_msg flags it and
869+ // the frame is dropped instead of parsed/spooled truncated.
870+ let mut buf = vec![0u8; crate::rawsock::RECV_BUFSZ];
708 let mut ch_idx = 0usize;871 let mut ch_idx = 0usize;
709 let mut stats = ScanStats::default();872 let mut stats = ScanStats::default();
710 let mut last_stats_log = Instant::now();873 let mut last_stats_log = Instant::now();
@@ -718,6 +881,9 @@ pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Resu
718 // Last frequency actually tuned — suppresses re-asserting the same881 // Last frequency actually tuned — suppresses re-asserting the same
719 // channel every dwell (iw spam) while the pin is steady.882 // channel every dwell (iw spam) while the pin is steady.
720 let mut last_set: u16 = 0;883 let mut last_set: u16 = 0;
884+ // Streak of non-timeout recv errors (card yanked / firmware wedged) —
885+ // reaching the threshold aborts the scanner instead of storming the UI.
886+ let mut recv_err_streak: u32 = 0;
721 887
722 while !stop.load(Ordering::Relaxed) {888 while !stop.load(Ordering::Relaxed) {
723 // Channel arbitration: a nonzero pin (capture hold or deauth889 // Channel arbitration: a nonzero pin (capture hold or deauth
@@ -748,8 +914,27 @@ pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Resu
748 // Drain frames until the dwell elapses (recv timeout bounds it).914 // Drain frames until the dwell elapses (recv timeout bounds it).
749 let dwell_start = Instant::now();915 let dwell_start = Instant::now();
750 loop {916 loop {
751- match sock.recv(&mut buf) {917+ match sock.recv_msg(&mut buf) {
752- Ok(n) => {918+ // Over-long frame (>16 KiB — not a real 802.11 frame; a
919+ // driver/kernel anomaly): drop it WHOLE — a truncated
920+ // prefix is neither parseable nor a complete pcap record.
921+ // Separate arm (not `continue`) so the dwell/stop checks at
922+ // the loop tail still run under an over-long frame flood.
923+ Ok(msg) if msg.truncated() => {
924+ recv_err_streak = 0;
925+ stats.truncated_dropped += 1;
926+ if stats.truncated_dropped == 1 || stats.truncated_dropped % 100 == 0 {
927+ let _ = tx.send(Event::Log(format!(
928+ "scanner: dropped {} over-long frame(s) (>{} bytes, last {} bytes)",
929+ stats.truncated_dropped,
930+ buf.len(),
931+ msg.orig_len
932+ )));
933+ }
934+ }
935+ Ok(msg) => {
936+ recv_err_streak = 0;
937+ let n = msg.len;
753 stats.raw_frames_received += 1;938 stats.raw_frames_received += 1;
754 let now = now_ms();939 let now = now_ms();
755 // Pcap spool: the RAW frame straight off the socket,940 // Pcap spool: the RAW frame straight off the socket,
@@ -762,9 +947,8 @@ pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Resu
762 spool_failures += 1;947 spool_failures += 1;
763 if spool_failures >= 3 {948 if spool_failures >= 3 {
764 spool_enabled = false;949 spool_enabled = false;
765- let _ = tx.send(Event::Log(format!(950+ let _ = tx
766- "pcap spool disabled: {e}"951+ .send(Event::Log(format!("pcap spool disabled: {e}")));
767- )));
768 }952 }
769 }953 }
770 },954 },
@@ -772,9 +956,8 @@ pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Resu
772 spool_failures += 1;956 spool_failures += 1;
773 if spool_failures >= 3 {957 if spool_failures >= 3 {
774 spool_enabled = false;958 spool_enabled = false;
775- let _ = tx.send(Event::Log(format!(959+ let _ =
776- "pcap spool disabled: {e}"960+ tx.send(Event::Log(format!("pcap spool disabled: {e}")));
777- )));
778 }961 }
779 }962 }
780 }963 }
@@ -784,8 +967,8 @@ pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Resu
784 // Per-channel attribution: trust the radiotap967 // Per-channel attribution: trust the radiotap
785 // carrier frequency; fall back to the channel we968 // carrier frequency; fall back to the channel we
786 // last tuned to (radiotap freq is occasionally 0).969 // last tuned to (radiotap freq is occasionally 0).
787- let ch = freq_to_channel(meta.freq_mhz)970+ let ch =
788- .or_else(|| freq_to_channel(last_set));971+ freq_to_channel(meta.freq_mhz).or_else(|| freq_to_channel(last_set));
789 let is_beacon_fc =972 let is_beacon_fc =
790 frame.len() >= 24 && (frame[0] == 0x80 || frame[0] == 0x50);973 frame.len() >= 24 && (frame[0] == 0x80 || frame[0] == 0x50);
791 if let Some(ch) = ch {974 if let Some(ch) = ch {
@@ -807,27 +990,41 @@ pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Resu
807 .entry(crate::common::MacAddr(mac))990 .entry(crate::common::MacAddr(mac))
808 .or_insert(0) += 1;991 .or_insert(0) += 1;
809 }992 }
810- if dot11::parse_beacon_or_probe(frame).is_some() {993+ // ONE parse per frame: stats and ingest both
994+ // consume the classification.
995+ let class = classify(frame);
996+ if class.counts_as_mgmt() {
811 stats.mgmt_80211_parsed += 1;997 stats.mgmt_80211_parsed += 1;
998+ }
999+ if matches!(class, FrameClass::Beacon(_)) {
812 stats.beacons_ap_ingested += 1;1000 stats.beacons_ap_ingested += 1;
813- } else if dot11::parse_probe_req(frame).is_some()
814- || dot11::parse_deauth(frame).is_some()
815- {
816- stats.mgmt_80211_parsed += 1;
817 }1001 }
818- scanner.ingest(&meta, frame, now, &tx);1002+ scanner.ingest_classified(&meta, frame, class, now, &tx);
819 }1003 }
820 }1004 }
821 Err(e)1005 Err(e)
822 if e.kind() == std::io::ErrorKind::WouldBlock1006 if e.kind() == std::io::ErrorKind::WouldBlock
823 || e.kind() == std::io::ErrorKind::TimedOut =>1007 || e.kind() == std::io::ErrorKind::TimedOut =>
824 {1008 {
1009+ recv_err_streak = 0;
825 break; // dwell over (set_timeout)1010 break; // dwell over (set_timeout)
826 }1011 }
827 Err(e) if e.kind() == std::io::ErrorKind::Interrupted => continue,1012 Err(e) if e.kind() == std::io::ErrorKind::Interrupted => continue,
828 Err(e) => {1013 Err(e) => {
1014+ // A persistent error here (ENODEV — card yanked, EIO —
1015+ // firmware wedged) repeats identically every dwell;
1016+ // without a cap the UI would get the same event ~10/s
1017+ // forever. Emit it once per episode, then abort.
1018+ recv_err_streak += 1;
1019+ if recv_err_streak >= RECV_ERROR_ABORT_THRESHOLD {
1020+ let _ = tx.send(Event::Error(format!(
1021+ "scanner aborted: recv failing repeatedly on {} (last: {e}) — interface down?",
1022+ cfg.ifname
1023+ )));
1024+ return Err(e).context("scanner recv failing repeatedly");
1025+ }
829 let _ = tx.send(Event::Error(format!("scanner recv: {e}")));1026 let _ = tx.send(Event::Error(format!("scanner recv: {e}")));
830- break;1027+ break; // hop to the next channel and let recv retry
831 }1028 }
832 }1029 }
833 if dwell_start.elapsed() >= Duration::from_millis(cfg.dwell_ms as u64) * 4 {1030 if dwell_start.elapsed() >= Duration::from_millis(cfg.dwell_ms as u64) * 4 {
@@ -860,7 +1057,7 @@ pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Resu
860 let top: String = {1057 let top: String = {
861 let mut v: Vec<(crate::common::MacAddr, u64)> =1058 let mut v: Vec<(crate::common::MacAddr, u64)> =
862 stats.bssid_hist.iter().map(|(m, c)| (*m, *c)).collect();1059 stats.bssid_hist.iter().map(|(m, c)| (*m, *c)).collect();
863- v.sort_unstable_by(|a, b| b.1.cmp(&a.1));1060+ v.sort_unstable_by_key(|a| std::cmp::Reverse(a.1));
864 v.truncate(4);1061 v.truncate(4);
865 v.iter()1062 v.iter()
866 .map(|(m, c)| format!("{m}({c})"))1063 .map(|(m, c)| format!("{m}({c})"))
@@ -868,13 +1065,14 @@ pub fn run(cfg: ScannerConfig, tx: Sender<Event>, stop: Arc<AtomicBool>) -> Resu
868 .join(", ")1065 .join(", ")
869 };1066 };
870 let _ = tx.send(Event::Log(format!(1067 let _ = tx.send(Event::Log(format!(
871- "scan: rx={} strip={} beaconfc={} beacons={} aps={} ch={} top=[{}]",1068+ "scan: rx={} strip={} beaconfc={} beacons={} aps={} ch={} trunc={} top=[{}]",
872 stats.raw_frames_received,1069 stats.raw_frames_received,
873 stats.radiotap_strip_ok,1070 stats.radiotap_strip_ok,
874 stats.beacon_fc_rx,1071 stats.beacon_fc_rx,
875 stats.beacons_ap_ingested,1072 stats.beacons_ap_ingested,
876 scanner.aps.len(),1073 scanner.aps.len(),
877 cur_ch,1074 cur_ch,
1075+ stats.truncated_dropped,
878 top1076 top
879 )));1077 )));
880 }1078 }
@@ -957,11 +1155,7 @@ mod tests {
957 1155
958 /// Scanner under test: no suppression, unknown own MAC.1156 /// Scanner under test: no suppression, unknown own MAC.
959 fn test_scanner() -> Scanner {1157 fn test_scanner() -> Scanner {
960- Scanner::new(1158+ Scanner::new(-85, MacAddr::ZERO, Arc::new(Mutex::new(HashSet::new())))
961- -85,
962- MacAddr::ZERO,
963- Arc::new(Mutex::new(HashSet::new())),
964- )
965 }1159 }
966 1160
967 // -- frames with a caller-picked sequence number (pairing tests) ------1161 // -- frames with a caller-picked sequence number (pairing tests) ------
@@ -992,7 +1186,10 @@ mod tests {
992 }1186 }
993 1187
994 fn probe_seq(sta: &MacAddr, ssid: Option<&str>, seq: u16) -> Vec<u8> {1188 fn probe_seq(sta: &MacAddr, ssid: Option<&str>, seq: u16) -> Vec<u8> {
995- let ies = [ie_bytes(1, &[0x82, 0x84, 0x8b, 0x96]), ie_bytes(50, &[0x0c, 0x12])];1189+ let ies = [
1190+ ie_bytes(1, &[0x82, 0x84, 0x8b, 0x96]),
1191+ ie_bytes(50, &[0x0c, 0x12]),
1192+ ];
996 probe_req_ies(sta, ssid, &ies, seq)1193 probe_req_ies(sta, ssid, &ies, seq)
997 }1194 }
998 1195
@@ -1005,16 +1202,63 @@ mod tests {
1005 ie_bytes(dot11::IE_VENDOR, &body)1202 ie_bytes(dot11::IE_VENDOR, &body)
1006 }1203 }
1007 1204
1205+ /// 6 GHz regression: frequencies just below 5950 must not underflow the
1206+ /// (freq - 5950) subtraction (u16 debug panic / garbage channel in
1207+ /// release). Grid per 802.11ax: center = 5950 + 5·ch; 5935 = ch 2
1208+ /// (band-edge outlier, iw precedent); 5940/5945 aren't 20 MHz channels.
1209+ #[test]
1210+ fn freq_to_channel_6ghz_edge_freqs() {
1211+ assert_eq!(freq_to_channel(5935), Some(2));
1212+ assert_eq!(freq_to_channel(5940), None);
1213+ assert_eq!(freq_to_channel(5945), None);
1214+ assert_eq!(freq_to_channel(5955), Some(1));
1215+ assert_eq!(freq_to_channel(5980), Some(6)); // PSC ch 6
1216+ assert_eq!(freq_to_channel(6415), Some(93)); // last freq in HOP_FREQS_ALL
1217+ assert_eq!(freq_to_channel(7115), Some(233)); // ch 233 = 6 GHz top
1218+ assert_eq!(freq_to_channel(7116), None);
1219+ // Existing bands untouched.
1220+ assert_eq!(freq_to_channel(2412), Some(1));
1221+ assert_eq!(freq_to_channel(2484), Some(14));
1222+ assert_eq!(freq_to_channel(5180), Some(36));
1223+ assert_eq!(freq_to_channel(5920), None); // 5 GHz top edge: not a 5-grid ch
1224+ // Every frequency we actually hop maps to SOME channel.
1225+ for &f in HOP_FREQS_ALL {
1226+ assert!(freq_to_channel(f).is_some(), "hop freq {f} unmapped");
1227+ }
1228+ }
1229+
1230+ /// The single-parse classifier: each fixture lands in the bucket the
1231+ /// ingest semantics expect, and stats predicates still match the
1232+ /// historical definition.
1233+ #[test]
1234+ fn classify_matches_frame_type() {
1235+ assert!(matches!(
1236+ classify(&beacon_frame(&ap(), "testnet", 6)),
1237+ FrameClass::Beacon(_)
1238+ ));
1239+ let class = classify(&probe_req_frame(&sta(), Some("net")));
1240+ assert!(matches!(class, FrameClass::ProbeIdent(_)));
1241+ assert!(class.counts_as_mgmt());
1242+ let deauth = dot11::build_deauth(&ap(), &sta(), 7);
1243+ let class = classify(&deauth);
1244+ assert!(matches!(class, FrameClass::Deauth { .. }));
1245+ assert!(class.counts_as_mgmt());
1246+ let class = classify(&data_frame_tods(&ap(), &sta()));
1247+ assert!(matches!(class, FrameClass::Data { .. }));
1248+ assert!(!class.counts_as_mgmt());
1249+ assert!(matches!(classify(&[0u8; 4]), FrameClass::Other));
1250+ }
1251+
1008 #[test]1252 #[test]
1009 fn beacon_attached_creates_ap_with_ssid_and_channel() {1253 fn beacon_attached_creates_ap_with_ssid_and_channel() {
1010 let (tx, rx) = crossbeam_channel::unbounded();1254 let (tx, rx) = crossbeam_channel::unbounded();
1011 let mut sc = test_scanner();1255 let mut sc = test_scanner();
1012 let now: u64 = 0;1256 let now: u64 = 0;
1013- sc.ingest(&meta(-42, 0), &beacon_frame(&ap(), "parafin", 6), now, &tx);1257+ sc.ingest(&meta(-42, 0), &beacon_frame(&ap(), "testnet", 6), now, &tx);
1014 match rx.try_recv() {1258 match rx.try_recv() {
1015 Ok(Event::ApUpdated(a)) => {1259 Ok(Event::ApUpdated(a)) => {
1016 assert_eq!(a.bssid, ap());1260 assert_eq!(a.bssid, ap());
1017- assert_eq!(a.ssid, "parafin");1261+ assert_eq!(a.ssid, "testnet");
1018 assert_eq!(a.channel, 6);1262 assert_eq!(a.channel, 6);
1019 assert_eq!(a.rssi_dbm, -42);1263 assert_eq!(a.rssi_dbm, -42);
1020 }1264 }
@@ -1027,7 +1271,7 @@ mod tests {
1027 let (tx, rx) = crossbeam_channel::unbounded();1271 let (tx, rx) = crossbeam_channel::unbounded();
1028 let mut sc = test_scanner();1272 let mut sc = test_scanner();
1029 let now: u64 = 0;1273 let now: u64 = 0;
1030- let mut f = beacon_frame(&ap(), "parafin", 6);1274+ let mut f = beacon_frame(&ap(), "testnet", 6);
1031 f.truncate(f.len() - 3); // drop DS IE1275 f.truncate(f.len() - 3); // drop DS IE
1032 sc.ingest(&meta(-40, 2437), &f, now, &tx);1276 sc.ingest(&meta(-40, 2437), &f, now, &tx);
1033 match rx.try_recv() {1277 match rx.try_recv() {
@@ -1042,31 +1286,120 @@ mod tests {
1042 let mut sc = test_scanner();1286 let mut sc = test_scanner();
1043 let now: u64 = 0;1287 let now: u64 = 0;
1044 // -90 < floor: no event, no entry.1288 // -90 < floor: no event, no entry.
1045- sc.ingest(&meta(-90, 0), &beacon_frame(&ap(), "parafin", 6), now, &tx);1289+ sc.ingest(&meta(-90, 0), &beacon_frame(&ap(), "testnet", 6), now, &tx);
1046 assert!(rx.try_recv().is_err());1290 assert!(rx.try_recv().is_err());
1047 assert!(sc.aps.is_empty());1291 assert!(sc.aps.is_empty());
1048 // Once created (hit stronger frame), later weak updates are accepted:1292 // Once created (hit stronger frame), later weak updates are accepted:
1049- // beacon counter still advances even though no event is emitted.1293+ // the beacon counter advances and the EMA decay is reported.
1050- sc.ingest(&meta(-60, 0), &beacon_frame(&ap(), "parafin", 6), now, &tx);1294+ sc.ingest(&meta(-60, 0), &beacon_frame(&ap(), "testnet", 6), now, &tx);
1051 assert!(rx.try_recv().is_ok());1295 assert!(rx.try_recv().is_ok());
1052- sc.ingest(&meta(-90, 0), &beacon_frame(&ap(), "parafin", 6), now, &tx);1296+ sc.ingest(&meta(-90, 0), &beacon_frame(&ap(), "testnet", 6), now, &tx);
1053 assert_eq!(sc.aps[&ap()].beacons, 2);1297 assert_eq!(sc.aps[&ap()].beacons, 2);
1054 }1298 }
1055 1299
1300+ /// Peak-hold is gone: sustained weaker samples decay the reported RSSI
1301+ /// (station walking away), and it recovers on stronger ones. The EMA
1302+ /// keeps single-frame fades from reordering the UI (first -75 sample
1303+ /// moves the average only -70 → -72).
1056 #[test]1304 #[test]
1057- fn rssi_improvement_emits_update_worsening_does_not() {1305+ fn rssi_ema_decays_and_recovers() {
1058 let (tx, rx) = crossbeam_channel::unbounded();1306 let (tx, rx) = crossbeam_channel::unbounded();
1059 let mut sc = test_scanner();1307 let mut sc = test_scanner();
1060 let now: u64 = 0;1308 let now: u64 = 0;
1061- sc.ingest(&meta(-70, 0), &beacon_frame(&ap(), "parafin", 6), now, &tx);1309+ sc.ingest(&meta(-70, 0), &beacon_frame(&ap(), "testnet", 6), now, &tx);
1062- let _ = rx.try_recv(); // creation
1063- sc.ingest(&meta(-75, 0), &beacon_frame(&ap(), "parafin", 6), now, &tx);
1064- assert!(rx.try_recv().is_err()); // worse: silent
1065- sc.ingest(&meta(-50, 0), &beacon_frame(&ap(), "parafin", 6), now, &tx);
1066 match rx.try_recv() {1310 match rx.try_recv() {
1067- Ok(Event::ApUpdated(a)) => assert_eq!(a.rssi_dbm, -50),1311+ Ok(Event::ApUpdated(a)) => assert_eq!(a.rssi_dbm, -70),
1068- other => panic!("expected ApUpdated improvement, got {other:?}"),1312+ other => panic!("expected creation ApUpdated, got {other:?}"),
1069 }1313 }
1314+ // One weaker sample: EMA -70 → -72 — decay is reported now (the old
1315+ // peak-hold rule kept -70 forever).
1316+ sc.ingest(&meta(-75, 0), &beacon_frame(&ap(), "testnet", 6), now, &tx);
1317+ match rx.try_recv() {
1318+ Ok(Event::ApUpdated(a)) => assert_eq!(a.rssi_dbm, -72),
1319+ other => panic!("expected decay ApUpdated, got {other:?}"),
1320+ }
1321+ // Repeated weak samples keep walking the average down (monotonic,
1322+ // one rounded dBm per event, skipping no-change steps) until it
1323+ // settles on the sample value.
1324+ let mut last = -72;
1325+ for _ in 0..20 {
1326+ sc.ingest(&meta(-75, 0), &beacon_frame(&ap(), "testnet", 6), now, &tx);
1327+ match rx.try_recv() {
1328+ Ok(Event::ApUpdated(a)) => {
1329+ assert!(a.rssi_dbm < last, "decay must be monotonic");
1330+ assert!(a.rssi_dbm >= -75, "never overshoots the sample");
1331+ last = a.rssi_dbm;
1332+ }
1333+ Ok(other) => panic!("unexpected event {other:?}"),
1334+ Err(_) => {} // sample didn't move the rounded average
1335+ }
1336+ }
1337+ assert_eq!(last, -75, "EMA converges to the repeated sample");
1338+ // Settled: identical samples emit nothing (no event storm).
1339+ sc.ingest(&meta(-75, 0), &beacon_frame(&ap(), "testnet", 6), now, &tx);
1340+ assert!(rx.try_recv().is_err());
1341+ // Recovery: one strong sample lifts the average -75 → -65.
1342+ sc.ingest(&meta(-50, 0), &beacon_frame(&ap(), "testnet", 6), now, &tx);
1343+ match rx.try_recv() {
1344+ Ok(Event::ApUpdated(a)) => assert_eq!(a.rssi_dbm, -65),
1345+ other => panic!("expected recovery ApUpdated, got {other:?}"),
1346+ }
1347+ // Frames without an antenna-signal field (rssi 0) leave the
1348+ // average untouched.
1349+ sc.ingest(&meta(0, 0), &beacon_frame(&ap(), "testnet", 6), now, &tx);
1350+ assert!(rx.try_recv().is_err());
1351+ assert_eq!(sc.aps[&ap()].rssi_dbm, -65);
1352+ }
1353+
1354+ /// Clients use the same EMA: a station moving away decays instead of
1355+ /// pinning its strongest-ever sample.
1356+ #[test]
1357+ fn client_rssi_ema_decays() {
1358+ let (tx, rx) = crossbeam_channel::unbounded();
1359+ let mut sc = test_scanner();
1360+ let now: u64 = 0;
1361+ sc.ingest(
1362+ &meta(-60, 0),
1363+ &probe_req_frame(&sta(), Some("net")),
1364+ now,
1365+ &tx,
1366+ );
1367+ let _ = rx.try_recv(); // ProbeObserved
1368+ let _ = rx.try_recv(); // ClientIdent
1369+ match rx.try_recv() {
1370+ Ok(Event::ClientUpdated(c)) => assert_eq!(c.rssi_dbm, -60),
1371+ other => panic!("expected ClientUpdated creation, got {other:?}"),
1372+ }
1373+ // -60 → 0.4·(-80) + 0.6·(-60) = -68.
1374+ sc.ingest(
1375+ &meta(-80, 0),
1376+ &probe_req_frame(&sta(), Some("net")),
1377+ now,
1378+ &tx,
1379+ );
1380+ loop {
1381+ match rx.try_recv() {
1382+ Ok(Event::ClientUpdated(c)) => {
1383+ assert_eq!(c.rssi_dbm, -68);
1384+ break;
1385+ }
1386+ Ok(_) => continue, // ProbeObserved/dedup chatter
1387+ other => panic!("expected decayed ClientUpdated, got {other:?}"),
1388+ }
1389+ }
1390+ }
1391+
1392+ /// The pure EMA helpers: convergence on constant input, alpha weighting,
1393+ /// and rounding of the reported value.
1394+ #[test]
1395+ fn ema_helpers_behave() {
1396+ let mut e = -50.0f32;
1397+ for _ in 0..50 {
1398+ e = ema_next(e, -90);
1399+ }
1400+ assert_eq!(ema_report(e), -90);
1401+ // α=0.4: one step from -70 with -75 lands exactly on -72.
1402+ assert_eq!(ema_report(ema_next(-70.0, -75)), -72);
1070 }1403 }
1071 1404
1072 #[test]1405 #[test]
@@ -1074,19 +1407,28 @@ mod tests {
1074 let (tx, rx) = crossbeam_channel::unbounded();1407 let (tx, rx) = crossbeam_channel::unbounded();
1075 let mut sc = test_scanner();1408 let mut sc = test_scanner();
1076 let now: u64 = 0;1409 let now: u64 = 0;
1077- sc.ingest(&meta(-55, 0), &probe_req_frame(&sta(), Some("parafin")), now, &tx);1410+ sc.ingest(
1411+ &meta(-55, 0),
1412+ &probe_req_frame(&sta(), Some("testnet")),
1413+ now,
1414+ &tx,
1415+ );
1078 // Novel probe → ProbeObserved first, then the pairing decision,1416 // Novel probe → ProbeObserved first, then the pairing decision,
1079 // then the client creation carrying the group id already.1417 // then the client creation carrying the group id already.
1080 match rx.try_recv() {1418 match rx.try_recv() {
1081 Ok(Event::ProbeObserved(p)) => {1419 Ok(Event::ProbeObserved(p)) => {
1082 assert_eq!(p.client, sta());1420 assert_eq!(p.client, sta());
1083- assert_eq!(p.ssid.as_deref(), Some("parafin"));1421+ assert_eq!(p.ssid.as_deref(), Some("testnet"));
1084 assert_eq!(p.rssi_dbm, -55);1422 assert_eq!(p.rssi_dbm, -55);
1085 }1423 }
1086 other => panic!("expected ProbeObserved, got {other:?}"),1424 other => panic!("expected ProbeObserved, got {other:?}"),
1087 }1425 }
1088 match rx.try_recv() {1426 match rx.try_recv() {
1089- Ok(Event::ClientIdent { mac, group, confidence }) => {1427+ Ok(Event::ClientIdent {
1428+ mac,
1429+ group,
1430+ confidence,
1431+ }) => {
1090 assert_eq!(mac, sta());1432 assert_eq!(mac, sta());
1091 assert_eq!(confidence, IdentConfidence::Probable);1433 assert_eq!(confidence, IdentConfidence::Probable);
1092 let _ = group;1434 let _ = group;
@@ -1104,7 +1446,12 @@ mod tests {
1104 // A repeat of the SAME probe inside 60 s is deduped — no1446 // A repeat of the SAME probe inside 60 s is deduped — no
1105 // ProbeObserved (the client liveness refresh is silent here since1447 // ProbeObserved (the client liveness refresh is silent here since
1106 // neither RSSI nor ap changed).1448 // neither RSSI nor ap changed).
1107- sc.ingest(&meta(-55, 0), &probe_req_frame(&sta(), Some("parafin")), now, &tx);1449+ sc.ingest(
1450+ &meta(-55, 0),
1451+ &probe_req_frame(&sta(), Some("testnet")),
1452+ now,
1453+ &tx,
1454+ );
1108 assert!(rx.try_recv().is_err());1455 assert!(rx.try_recv().is_err());
1109 // A different SSID from the same client is a fresh observation.1456 // A different SSID from the same client is a fresh observation.
1110 sc.ingest(&meta(-55, 0), &probe_req_frame(&sta(), None), now, &tx);1457 sc.ingest(&meta(-55, 0), &probe_req_frame(&sta(), None), now, &tx);
@@ -1125,7 +1472,12 @@ mod tests {
1125 let (tx, rx) = crossbeam_channel::unbounded();1472 let (tx, rx) = crossbeam_channel::unbounded();
1126 let mut sc = test_scanner();1473 let mut sc = test_scanner();
1127 let now: u64 = 0;1474 let now: u64 = 0;
1128- sc.ingest(&meta(-55, 0), &probe_req_frame(&sta(), Some("parafin")), now, &tx);1475+ sc.ingest(
1476+ &meta(-55, 0),
1477+ &probe_req_frame(&sta(), Some("testnet")),
1478+ now,
1479+ &tx,
1480+ );
1129 let _ = rx.try_recv(); // ProbeObserved1481 let _ = rx.try_recv(); // ProbeObserved
1130 let _ = rx.try_recv(); // ClientIdent (pairing decision)1482 let _ = rx.try_recv(); // ClientIdent (pairing decision)
1131 let _ = rx.try_recv(); // creation event1483 let _ = rx.try_recv(); // creation event
@@ -1155,11 +1507,21 @@ mod tests {
1155 let (tx, rx) = crossbeam_channel::unbounded();1507 let (tx, rx) = crossbeam_channel::unbounded();
1156 let mut sc = test_scanner();1508 let mut sc = test_scanner();
1157 let now: u64 = 0;1509 let now: u64 = 0;
1158- sc.ingest(&meta(-55, 0), &probe_req_frame(&sta(), Some("parafin")), now, &tx);1510+ sc.ingest(
1511+ &meta(-55, 0),
1512+ &probe_req_frame(&sta(), Some("testnet")),
1513+ now,
1514+ &tx,
1515+ );
1159 let _ = rx.try_recv(); // ProbeObserved1516 let _ = rx.try_recv(); // ProbeObserved
1160 let _ = rx.try_recv(); // ClientIdent (pairing decision)1517 let _ = rx.try_recv(); // ClientIdent (pairing decision)
1161 let _ = rx.try_recv(); // creation1518 let _ = rx.try_recv(); // creation
1162- sc.ingest(&meta(-50, 0), &dot11::build_deauth(&ap(), &sta(), 7), now, &tx);1519+ sc.ingest(
1520+ &meta(-50, 0),
1521+ &dot11::build_deauth(&ap(), &sta(), 7),
1522+ now,
1523+ &tx,
1524+ );
1163 let _ = rx.try_recv(); // disconnect flip1525 let _ = rx.try_recv(); // disconnect flip
1164 assert!(!sc.clients[&sta()].connected);1526 assert!(!sc.clients[&sta()].connected);
1165 1527
@@ -1215,7 +1577,12 @@ mod tests {
1215 1577
1216 // Unknown target: neither side tracked.1578 // Unknown target: neither side tracked.
1217 let other: MacAddr = "de:ad:be:ef:00:01".parse().unwrap();1579 let other: MacAddr = "de:ad:be:ef:00:01".parse().unwrap();
1218- sc.ingest(&meta(-50, 0), &dot11::build_deauth(&ap(), &other, 7), now, &tx);1580+ sc.ingest(
1581+ &meta(-50, 0),
1582+ &dot11::build_deauth(&ap(), &other, 7),
1583+ now,
1584+ &tx,
1585+ );
1219 assert!(rx.try_recv().is_err());1586 assert!(rx.try_recv().is_err());
1220 assert!(sc.clients[&sta()].connected);1587 assert!(sc.clients[&sta()].connected);
1221 1588
@@ -1247,7 +1614,7 @@ mod tests {
1247 let (tx, rx) = crossbeam_channel::unbounded();1614 let (tx, rx) = crossbeam_channel::unbounded();
1248 let mut sc = test_scanner();1615 let mut sc = test_scanner();
1249 let t0: u64 = 1_000;1616 let t0: u64 = 1_000;
1250- sc.ingest(&meta(-40, 0), &beacon_frame(&ap(), "parafin", 6), t0, &tx);1617+ sc.ingest(&meta(-40, 0), &beacon_frame(&ap(), "testnet", 6), t0, &tx);
1251 sc.ingest(&meta(-40, 0), &probe_req_frame(&sta(), None), t0, &tx);1618 sc.ingest(&meta(-40, 0), &probe_req_frame(&sta(), None), t0, &tx);
1252 let _ = rx.try_recv(); // ApUpdated1619 let _ = rx.try_recv(); // ApUpdated
1253 let _ = rx.try_recv(); // ProbeObserved1620 let _ = rx.try_recv(); // ProbeObserved
@@ -1302,7 +1669,12 @@ mod tests {
1302 );1669 );
1303 }1670 }
1304 assert!(rx.try_recv().is_err());1671 assert!(rx.try_recv().is_err());
1305- sc.ingest(&meta(-40, 0), &dot11::build_deauth(&evil, &sta(), 7), now + 9, &tx);1672+ sc.ingest(
1673+ &meta(-40, 0),
1674+ &dot11::build_deauth(&evil, &sta(), 7),
1675+ now + 9,
1676+ &tx,
1677+ );
1306 match rx.try_recv() {1678 match rx.try_recv() {
1307 Ok(Event::DeauthAlert {1679 Ok(Event::DeauthAlert {
1308 source,1680 source,
@@ -1338,8 +1710,18 @@ mod tests {
1338 // Blasts from our monitor MAC and from the user-deauthed AP both1710 // Blasts from our monitor MAC and from the user-deauthed AP both
1339 // stay silent even past the threshold.1711 // stay silent even past the threshold.
1340 for i in 0..20u64 {1712 for i in 0..20u64 {
1341- sc.ingest(&meta(-40, 0), &dot11::build_deauth(&own, &sta(), 7), now + i, &tx);1713+ sc.ingest(
1342- sc.ingest(&meta(-40, 0), &dot11::build_deauth(&ap(), &sta(), 7), now + i, &tx);1714+ &meta(-40, 0),
1715+ &dot11::build_deauth(&own, &sta(), 7),
1716+ now + i,
1717+ &tx,
1718+ );
1719+ sc.ingest(
1720+ &meta(-40, 0),
1721+ &dot11::build_deauth(&ap(), &sta(), 7),
1722+ now + i,
1723+ &tx,
1724+ );
1343 }1725 }
1344 assert!(rx.try_recv().is_err());1726 assert!(rx.try_recv().is_err());
1345 }1727 }
@@ -1370,7 +1752,7 @@ mod tests {
1370 f.extend_from_slice(&10u16.to_le_bytes()); // listen interval1752 f.extend_from_slice(&10u16.to_le_bytes()); // listen interval
1371 f.push(0); // SSID IE1753 f.push(0); // SSID IE
1372 f.push(7);1754 f.push(7);
1373- f.extend_from_slice(b"parafin");1755+ f.extend_from_slice(b"testnet");
1374 sc.ingest(&meta(-50, 0), &f, now, &tx);1756 sc.ingest(&meta(-50, 0), &f, now, &tx);
1375 // Pairing decision first, then client creation, then the ApUpdated1757 // Pairing decision first, then client creation, then the ApUpdated
1376 // revealing the ssid.1758 // revealing the ssid.
@@ -1385,23 +1767,25 @@ mod tests {
1385 match rx.try_recv() {1767 match rx.try_recv() {
1386 Ok(Event::ApUpdated(a)) => {1768 Ok(Event::ApUpdated(a)) => {
1387 assert_eq!(a.bssid, ap());1769 assert_eq!(a.bssid, ap());
1388- assert_eq!(a.ssid, "parafin");1770+ assert_eq!(a.ssid, "testnet");
1389 }1771 }
1390 other => panic!("expected ApUpdated(revealed), got {other:?}"),1772 other => panic!("expected ApUpdated(revealed), got {other:?}"),
1391 }1773 }
1392- assert_eq!(sc.aps[&ap()].ssid, "parafin");1774+ assert_eq!(sc.aps[&ap()].ssid, "testnet");
1393 }1775 }
1394 1776
1395 // -- MAC-randomization pairing ---------------------------------------1777 // -- MAC-randomization pairing ---------------------------------------
1396 1778
1397 /// Pop events up to and including the next ClientIdent (probe-panel1779 /// Pop events up to and including the next ClientIdent (probe-panel
1398 /// and client-row events are ingestion noise for pairing tests).1780 /// and client-row events are ingestion noise for pairing tests).
1399- fn expect_ident(1781+ fn expect_ident(rx: &crossbeam_channel::Receiver<Event>) -> (MacAddr, u64, IdentConfidence) {
1400- rx: &crossbeam_channel::Receiver<Event>,
1401- ) -> (MacAddr, u64, IdentConfidence) {
1402 loop {1782 loop {
1403 match rx.try_recv() {1783 match rx.try_recv() {
1404- Ok(Event::ClientIdent { mac, group, confidence }) => {1784+ Ok(Event::ClientIdent {
1785+ mac,
1786+ group,
1787+ confidence,
1788+ }) => {
1405 return (mac, group, confidence);1789 return (mac, group, confidence);
1406 }1790 }
1407 Ok(_) => continue,1791 Ok(_) => continue,
@@ -1422,11 +1806,16 @@ mod tests {
1422 let m1: MacAddr = "02:aa:aa:aa:aa:01".parse().unwrap();1806 let m1: MacAddr = "02:aa:aa:aa:aa:01".parse().unwrap();
1423 let m2: MacAddr = "06:bb:bb:bb:bb:02".parse().unwrap();1807 let m2: MacAddr = "06:bb:bb:bb:bb:02".parse().unwrap();
1424 1808
1425- sc.ingest(&meta(-50, 0), &probe_seq(&m1, Some("parafin"), 7), now, &tx);1809+ sc.ingest(&meta(-50, 0), &probe_seq(&m1, Some("testnet"), 7), now, &tx);
1426 let (mac, g1, conf) = expect_ident(&rx);1810 let (mac, g1, conf) = expect_ident(&rx);
1427 assert_eq!(mac, m1);1811 assert_eq!(mac, m1);
1428 assert_eq!(conf, IdentConfidence::Probable);1812 assert_eq!(conf, IdentConfidence::Probable);
1429- sc.ingest(&meta(-48, 0), &probe_seq(&m2, Some("parafin"), 8), now + 1, &tx);1813+ sc.ingest(
1814+ &meta(-48, 0),
1815+ &probe_seq(&m2, Some("testnet"), 8),
1816+ now + 1,
1817+ &tx,
1818+ );
1430 let (mac, g2, conf) = expect_ident(&rx);1819 let (mac, g2, conf) = expect_ident(&rx);
1431 // Same IE chain + same probed SSID = same radio, strong witness.1820 // Same IE chain + same probed SSID = same radio, strong witness.
1432 assert_eq!(mac, m2);1821 assert_eq!(mac, m2);
@@ -1472,7 +1861,7 @@ mod tests {
1472 let m2: MacAddr = "06:ee:ee:ee:ee:05".parse().unwrap();1861 let m2: MacAddr = "06:ee:ee:ee:ee:05".parse().unwrap();
1473 let uuid = [0xABu8; 16];1862 let uuid = [0xABu8; 16];
1474 1863
1475- let f1 = probe_req_ies(&m1, Some("parafin"), &[wps_uuid_ie(&uuid)], 7);1864+ let f1 = probe_req_ies(&m1, Some("testnet"), &[wps_uuid_ie(&uuid)], 7);
1476 sc.ingest(&meta(-50, 0), &f1, now, &tx);1865 sc.ingest(&meta(-50, 0), &f1, now, &tx);
1477 let _ = expect_ident(&rx);1866 let _ = expect_ident(&rx);
1478 let f2 = probe_req_ies(&m2, None, &[wps_uuid_ie(&uuid)], 9);1867 let f2 = probe_req_ies(&m2, None, &[wps_uuid_ie(&uuid)], 9);
@@ -1483,12 +1872,7 @@ mod tests {
1483 // Same UUID but a COMPLETELY different IE chain (firmware update1872 // Same UUID but a COMPLETELY different IE chain (firmware update
1484 // between rotations, fingerprint unusable) still pairs.1873 // between rotations, fingerprint unusable) still pairs.
1485 let m3: MacAddr = "0a:dd:dd:dd:dd:07".parse().unwrap();1874 let m3: MacAddr = "0a:dd:dd:dd:dd:07".parse().unwrap();
1486- let f3 = probe_req_ies(1875+ let f3 = probe_req_ies(&m3, None, &[ie_bytes(3, &[1u8]), wps_uuid_ie(&uuid)], 40);
1487- &m3,
1488- None,
1489- &[ie_bytes(3, &[1u8]), wps_uuid_ie(&uuid)],
1490- 40,
1491- );
1492 sc.ingest(&meta(-50, 0), &f3, now + 2, &tx);1876 sc.ingest(&meta(-50, 0), &f3, now + 2, &tx);
1493 let (mac, g3, conf) = expect_ident(&rx);1877 let (mac, g3, conf) = expect_ident(&rx);
1494 assert_eq!(mac, m3);1878 assert_eq!(mac, m3);
@@ -1504,12 +1888,12 @@ mod tests {
1504 let m1: MacAddr = "02:aa:aa:aa:aa:01".parse().unwrap();1888 let m1: MacAddr = "02:aa:aa:aa:aa:01".parse().unwrap();
1505 let m2: MacAddr = "06:bb:bb:bb:bb:02".parse().unwrap();1889 let m2: MacAddr = "06:bb:bb:bb:bb:02".parse().unwrap();
1506 1890
1507- sc.ingest(&meta(-50, 0), &probe_seq(&m1, Some("parafin"), 7), now, &tx);1891+ sc.ingest(&meta(-50, 0), &probe_seq(&m1, Some("testnet"), 7), now, &tx);
1508 let (_, g1, _) = expect_ident(&rx);1892 let (_, g1, _) = expect_ident(&rx);
1509 // Same probed SSID, DIFFERENT IE chain → different device class.1893 // Same probed SSID, DIFFERENT IE chain → different device class.
1510 let other = probe_req_ies(1894 let other = probe_req_ies(
1511 &m2,1895 &m2,
1512- Some("parafin"),1896+ Some("testnet"),
1513 &[ie_bytes(1, &[0x82, 0x84]), ie_bytes(3, &[6u8])],1897 &[ie_bytes(1, &[0x82, 0x84]), ie_bytes(3, &[6u8])],
1514 8,1898 8,
1515 );1899 );
@@ -1526,13 +1910,18 @@ mod tests {
1526 let m1: MacAddr = "02:aa:aa:aa:aa:01".parse().unwrap();1910 let m1: MacAddr = "02:aa:aa:aa:aa:01".parse().unwrap();
1527 let m2: MacAddr = "06:ff:ff:ff:ff:06".parse().unwrap();1911 let m2: MacAddr = "06:ff:ff:ff:ff:06".parse().unwrap();
1528 1912
1529- sc.ingest(&meta(-50, 0), &probe_seq(&m1, Some("parafin"), 7), t0, &tx);1913+ sc.ingest(&meta(-50, 0), &probe_seq(&m1, Some("testnet"), 7), t0, &tx);
1530 let (_, g1, _) = expect_ident(&rx);1914 let (_, g1, _) = expect_ident(&rx);
1531 // Client row expires (60 s), but the group lives for minutes.1915 // Client row expires (60 s), but the group lives for minutes.
1532 sc.expire(t0 + 61_000, &tx);1916 sc.expire(t0 + 61_000, &tx);
1533 drain(&rx);1917 drain(&rx);
1534 // The rotated MAC appears late and still pairs (shared SSID).1918 // The rotated MAC appears late and still pairs (shared SSID).
1535- sc.ingest(&meta(-46, 0), &probe_seq(&m2, Some("parafin"), 8), t0 + 65_000, &tx);1919+ sc.ingest(
1920+ &meta(-46, 0),
1921+ &probe_seq(&m2, Some("testnet"), 8),
1922+ t0 + 65_000,
1923+ &tx,
1924+ );
1536 let (_, g2, conf) = expect_ident(&rx);1925 let (_, g2, conf) = expect_ident(&rx);
1537 assert_eq!(g1, g2, "group identity survives the client-row TTL");1926 assert_eq!(g1, g2, "group identity survives the client-row TTL");
1538 assert_eq!(conf, IdentConfidence::Strong);1927 assert_eq!(conf, IdentConfidence::Strong);
src/service.rsmodified+350 -74
@@ -38,7 +38,7 @@ use crate::{deauth, dot11, handshake, iface, pmkid, radiotap, scanner};
38 /// Exact banner the service prints on stdout before any event line. The38 /// Exact banner the service prints on stdout before any event line. The
39 /// client prefix-matches lines against this while waiting (pkexec may39 /// client prefix-matches lines against this while waiting (pkexec may
40 /// prepend its own chatter).40 /// prepend its own chatter).
41-pub const READY_LINE: &str = "WIFILAB-SVC-READY";41+pub const READY_LINE: &str = "WIFI_LAB-SVC-READY";
42 42
43 /// How long the client waits for the service's READY banner (the polkit43 /// How long the client waits for the service's READY banner (the polkit
44 /// dialog can block on a slow human).44 /// dialog can block on a slow human).
@@ -56,6 +56,49 @@ fn log_err(tx: &Sender<Event>, msg: impl Into<String>) {
56 send(tx, Event::Error(msg.into()));56 send(tx, Event::Error(msg.into()));
57 }57 }
58 58
59+/// Byte-count-bounded truncation that NEVER straddles a multi-byte UTF-8
60+/// character: a naive `&s[..s.len().min(n)]` PANICS when byte `n` lands
61+/// inside a multi-byte char — a UTF-8 garbage command line or a UTF-8
62+/// ESSID in a malformed event line would kill the privileged service's
63+/// command loop (interface left in monitor mode) or the UI's reader
64+/// thread respectively.
65+fn truncate_utf8(s: &str, max: usize) -> &str {
66+ if s.len() <= max {
67+ return s;
68+ }
69+ let mut end = max;
70+ while !s.is_char_boundary(end) {
71+ end -= 1;
72+ }
73+ &s[..end]
74+}
75+
76+/// Human-readable content of a panic payload (`catch_unwind`/`join` Err).
77+fn panic_message(payload: &(dyn std::any::Any + Send + 'static)) -> String {
78+ if let Some(s) = payload.downcast_ref::<&str>() {
79+ (*s).to_string()
80+ } else if let Some(s) = payload.downcast_ref::<String>() {
81+ s.clone()
82+ } else {
83+ "<non-string panic payload>".to_string()
84+ }
85+}
86+
87+/// Join one worker handle; a panic inside the worker must surface on the
88+/// event pipe instead of dying silently (the UI otherwise waits forever
89+/// on a "running" job whose thread is gone).
90+fn join_worker(h: JoinHandle<()>, tx: &Sender<Event>, what: &str) {
91+ if let Err(payload) = h.join() {
92+ log_err(
93+ tx,
94+ format!(
95+ "{what}: worker thread panicked: {}",
96+ panic_message(&*payload)
97+ ),
98+ );
99+ }
100+}
101+
59 /// RAII release of a [`iface::ChannelPin::hold`] — the capture worker's102 /// RAII release of a [`iface::ChannelPin::hold`] — the capture worker's
60 /// channel hold is released on EVERY worker exit path (normal, error,103 /// channel hold is released on EVERY worker exit path (normal, error,
61 /// early return), never leaving the scanner pinned forever.104 /// early return), never leaving the scanner pinned forever.
@@ -84,12 +127,21 @@ fn injection_canary(mon: &str) -> Result<bool> {
84 let sa = iface::mac_of(mon)?;127 let sa = iface::mac_of(mon)?;
85 let mut frame = radiotap::INJECT_HDR.to_vec();128 let mut frame = radiotap::INJECT_HDR.to_vec();
86 frame.extend_from_slice(&dot11::build_probe_req(&[], &sa));129 frame.extend_from_slice(&dot11::build_probe_req(&[], &sa));
87- let mut buf = [0u8; 2048];130+ let mut buf = [0u8; crate::rawsock::RECV_BUFSZ];
88 let deadline = Instant::now() + Duration::from_millis(1200);131 let deadline = Instant::now() + Duration::from_millis(1200);
132+ // ~10 probes across the window. A send() error is a SOCKET-level
133+ // failure (ENXIO/ENODEV: interface gone, ring broken) — the exact
134+ // opposite of the silent wedge (send succeeds, nothing radiates), so
135+ // it must abort WITH the error, letting the caller report instead of
136+ // reloading a driver that was never at fault.
89 while Instant::now() < deadline {137 while Instant::now() < deadline {
90- let _ = sock.send(&frame); // ~10 probes across the window138+ let n = sock
91- match sock.recv(&mut buf) {139+ .send(&frame)
92- Ok(n) if is_probe_response(&buf[..n]) => return Ok(true),140+ .context("canary send failed (socket-level TX error — not a driver wedge)")?;
141+ debug_assert!(n == frame.len(), "short canary send: {n} bytes");
142+ match sock.recv_msg(&mut buf) {
143+ // A truncated frame is never a valid probe response.
144+ Ok(m) if !m.truncated() && is_probe_response(&buf[..m.len]) => return Ok(true),
93 Ok(_) => {}145 Ok(_) => {}
94 Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => {}146 Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => {}
95 Err(e) => return Err(e).context("canary recv"),147 Err(e) => return Err(e).context("canary recv"),
@@ -100,7 +152,10 @@ fn injection_canary(mon: &str) -> Result<bool> {
100 152
101 /// radiotap-wrapped 802.11 frame → is it a probe response (mgmt, st 5)?153 /// radiotap-wrapped 802.11 frame → is it a probe response (mgmt, st 5)?
102 fn is_probe_response(f: &[u8]) -> bool {154 fn is_probe_response(f: &[u8]) -> bool {
103- let Some(rt_len) = f.get(2..4).map(|b| u16::from_le_bytes([b[0], b[1]]) as usize) else {155+ let Some(rt_len) = f
156+ .get(2..4)
157+ .map(|b| u16::from_le_bytes([b[0], b[1]]) as usize)
158+ else {
104 return false;159 return false;
105 };160 };
106 let Some(fc) = f161 let Some(fc) = f
@@ -162,9 +217,7 @@ impl RadioService {
162 }217 }
163 218
164 fn mon(&self) -> Option<String> {219 fn mon(&self) -> Option<String> {
165- self.mon_ifname220+ self.mon_ifname.clone().or_else(|| self.orig_ifname.clone())
166- .clone()
167- .or_else(|| self.orig_ifname.clone())
168 }221 }
169 222
170 /// Verify injected frames actually radiate; on failure reload the223 /// Verify injected frames actually radiate; on failure reload the
@@ -174,7 +227,10 @@ impl RadioService {
174 fn ensure_injection(&self, base: &str, mon: String) -> String {227 fn ensure_injection(&self, base: &str, mon: String) -> String {
175 match injection_canary(&mon) {228 match injection_canary(&mon) {
176 Ok(true) => {229 Ok(true) => {
177- log(&self.tx, "injection canary: probe responses seen — TX path OK");230+ log(
231+ &self.tx,
232+ "injection canary: probe responses seen — TX path OK",
233+ );
178 mon234 mon
179 }235 }
180 Ok(false) => {236 Ok(false) => {
@@ -189,7 +245,9 @@ impl RadioService {
189 Ok(new_mon) => {245 Ok(new_mon) => {
190 log(246 log(
191 &self.tx,247 &self.tx,
192- format!("driver reloaded, monitor vif {new_mon} recreated — re-running canary"),248+ format!(
249+ "driver reloaded, monitor vif {new_mon} recreated — re-running canary"
250+ ),
193 );251 );
194 match injection_canary(&new_mon) {252 match injection_canary(&new_mon) {
195 Ok(true) => log(&self.tx, "injection canary after recovery: OK"),253 Ok(true) => log(&self.tx, "injection canary after recovery: OK"),
@@ -198,21 +256,29 @@ impl RadioService {
198 "injection STILL dead after driver reload — scanning works but \256 "injection STILL dead after driver reload — scanning works but \
199 deauth/PMKID will not; check for a kernel/firmware update",257 deauth/PMKID will not; check for a kernel/firmware update",
200 ),258 ),
201- Err(e) => log_err(&self.tx, format!("post-recovery canary inconclusive: {e:#}")),259+ Err(e) => log_err(
260+ &self.tx,
261+ format!("post-recovery canary inconclusive: {e:#}"),
262+ ),
202 }263 }
203 new_mon264 new_mon
204 }265 }
205 Err(e) => {266 Err(e) => {
206 log_err(267 log_err(
207 &self.tx,268 &self.tx,
208- format!("driver reload recovery failed: {e:#} — keeping {mon}; deauth/PMKID may not work"),269+ format!(
270+ "driver reload recovery failed: {e:#} — keeping {mon}; deauth/PMKID may not work"
271+ ),
209 );272 );
210 mon273 mon
211 }274 }
212 }275 }
213 }276 }
214 Err(e) => {277 Err(e) => {
215- log(&self.tx, format!("injection canary inconclusive on {mon}: {e:#} — proceeding"));278+ log(
279+ &self.tx,
280+ format!("injection canary inconclusive on {mon}: {e:#} — proceeding"),
281+ );
216 mon282 mon
217 }283 }
218 }284 }
@@ -238,12 +304,12 @@ impl RadioService {
238 // fighting the new channel plan. When the monitor interface already304 // fighting the new channel plan. When the monitor interface already
239 // exists for the SAME ifname it is reused (no managed↔monitor305 // exists for the SAME ifname it is reused (no managed↔monitor
240 // churn); only the channel plan/workers change.306 // churn); only the channel plan/workers change.
241- let reuse_mon =307+ let reuse_mon = self.orig_ifname.as_deref() == Some(ifname) && self.mon_ifname.is_some();
242- self.orig_ifname.as_deref() == Some(ifname) && self.mon_ifname.is_some();
243 self.stop.store(true, Ordering::Release);308 self.stop.store(true, Ordering::Release);
244 let old = std::mem::take(&mut *self.handles.lock().expect("handles poisoned"));309 let old = std::mem::take(&mut *self.handles.lock().expect("handles poisoned"));
310+ let old_tx = self.tx.clone();
245 for h in old {311 for h in old {
246- let _ = h.join();312+ join_worker(h, &old_tx, "previous scan session");
247 }313 }
248 self.stop = Arc::new(AtomicBool::new(false));314 self.stop = Arc::new(AtomicBool::new(false));
249 self.orig_ifname = Some(ifname.to_string());315 self.orig_ifname = Some(ifname.to_string());
@@ -277,7 +343,10 @@ impl RadioService {
277 Some(w)343 Some(w)
278 }344 }
279 Err(e) => {345 Err(e) => {
280- log_err(&self.tx, format!("pcap spool at {} disabled: {e}", path.display()));346+ log_err(
347+ &self.tx,
348+ format!("pcap spool at {} disabled: {e}", path.display()),
349+ );
281 self.spool = None;350 self.spool = None;
282 None351 None
283 }352 }
@@ -315,10 +384,16 @@ impl RadioService {
315 if reuse_mon {384 if reuse_mon {
316 log(385 log(
317 &self.tx,386 &self.tx,
318- format!("scanner restarted on {mon_ifname} ({} channel(s))", channels.len().max(1)),387+ format!(
388+ "scanner restarted on {mon_ifname} ({} channel(s))",
389+ channels.len().max(1)
390+ ),
319 );391 );
320 } else {392 } else {
321- log(&self.tx, format!("monitor mode up on {mon_ifname} (was {ifname})"));393+ log(
394+ &self.tx,
395+ format!("monitor mode up on {mon_ifname} (was {ifname})"),
396+ );
322 }397 }
323 398
324 // Own MAC on the monitor vif: deauth frames we transmit never399 // Own MAC on the monitor vif: deauth frames we transmit never
@@ -346,10 +421,22 @@ impl RadioService {
346 let stop = self.stop.clone();421 let stop = self.stop.clone();
347 let tx = self.tx.clone();422 let tx = self.tx.clone();
348 match std::thread::Builder::new()423 match std::thread::Builder::new()
349- .name("wifilab-scanner".into())424+ .name("wifi_lab-scanner".into())
350 .spawn(move || {425 .spawn(move || {
351- if let Err(e) = scanner::run(cfg, tx.clone(), stop) {426+ let panic_tx = tx.clone();
352- log_err(&tx, format!("scanner stopped: {e:#}"));427+ let r = std::panic::catch_unwind(std::panic::AssertUnwindSafe(move || {
428+ if let Err(e) = scanner::run(cfg, tx.clone(), stop) {
429+ log_err(&tx, format!("scanner stopped: {e:#}"));
430+ }
431+ }));
432+ if let Err(payload) = r {
433+ log_err(
434+ &panic_tx,
435+ format!(
436+ "scanner: worker panicked: {} — scan ended",
437+ panic_message(&*payload)
438+ ),
439+ );
353 }440 }
354 }) {441 }) {
355 Ok(h) => self.handles.lock().expect("handles poisoned").push(h),442 Ok(h) => self.handles.lock().expect("handles poisoned").push(h),
@@ -357,10 +444,10 @@ impl RadioService {
357 log_err(&self.tx, format!("scanner: spawn failed: {e}"));444 log_err(&self.tx, format!("scanner: spawn failed: {e}"));
358 // Leave the UI consistent: nothing runs but the interface445 // Leave the UI consistent: nothing runs but the interface
359 // is in monitor mode — flip it back.446 // is in monitor mode — flip it back.
360- if self.mon_ifname.take().is_some() {447+ if self.mon_ifname.take().is_some()
361- if let Some(orig) = &self.orig_ifname {448+ && let Some(orig) = &self.orig_ifname
362- let _ = iface::teardown_monitor(orig);449+ {
363- }450+ let _ = iface::teardown_monitor(orig);
364 }451 }
365 }452 }
366 }453 }
@@ -371,26 +458,25 @@ impl RadioService {
371 fn stop_scan(&mut self) {458 fn stop_scan(&mut self) {
372 self.stop.store(true, Ordering::Release);459 self.stop.store(true, Ordering::Release);
373 let handles = std::mem::take(&mut *self.handles.lock().expect("handles poisoned"));460 let handles = std::mem::take(&mut *self.handles.lock().expect("handles poisoned"));
461+ let stop_tx = self.tx.clone();
374 for h in handles {462 for h in handles {
375- let _ = h.join();463+ join_worker(h, &stop_tx, "scan session");
376 }464 }
377 // Flush the pcap spool now that the scanner thread is joined: an465 // Flush the pcap spool now that the scanner thread is joined: an
378 // Export .pcap copies the file from disk and must see every frame.466 // Export .pcap copies the file from disk and must see every frame.
379 // The writer stays open for reuse by the next StartScan.467 // The writer stays open for reuse by the next StartScan.
380- if let Some((_, w)) = &self.spool {468+ if let Some((_, w)) = &self.spool
381- if let Ok(mut w) = w.lock() {469+ && let Ok(mut w) = w.lock()
382- if let Err(e) = w.finish() {470+ && let Err(e) = w.finish()
383- log_err(&self.tx, format!("pcap spool flush failed: {e:#}"));471+ {
384- }472+ log_err(&self.tx, format!("pcap spool flush failed: {e:#}"));
385- }
386 }473 }
387 let orig = self.orig_ifname.take();474 let orig = self.orig_ifname.take();
388- if let Some(orig) = &orig {475+ if let Some(orig) = &orig
389- if self.mon_ifname.take().is_some() {476+ && self.mon_ifname.take().is_some()
390- if let Err(e) = iface::teardown_monitor(orig) {477+ && let Err(e) = iface::teardown_monitor(orig)
391- eprintln!("wifilab-svc: teardown_monitor({orig}) failed: {e:#}");478+ {
392- }479+ eprintln!("wifi_lab-svc: teardown_monitor({orig}) failed: {e:#}");
393- }
394 }480 }
395 self.restore_check(orig.as_deref());481 self.restore_check(orig.as_deref());
396 }482 }
@@ -402,15 +488,13 @@ impl RadioService {
402 /// flag is consumed), so the shutdown tail can re-run it safely; the488 /// flag is consumed), so the shutdown tail can re-run it safely; the
403 /// monitor check is skipped when no scan session ever ran.489 /// monitor check is skipped when no scan session ever ran.
404 fn restore_check(&self, orig: Option<&str>) {490 fn restore_check(&self, orig: Option<&str>) {
405- if let Some(orig) = orig {491+ if let Some(orig) = orig
406- if !iface::monitor_gone(orig) {492+ && !iface::monitor_gone(orig)
407- log_err(493+ {
408- &self.tx,494+ log_err(
409- format!(495+ &self.tx,
410- "interface left in monitor mode; fix: sudo iw dev {orig}mon del"496+ format!("interface left in monitor mode; fix: sudo iw dev {orig}mon del"),
411- ),497+ );
412- );
413- }
414 }498 }
415 if self.stopped_nm.swap(false, Ordering::AcqRel) {499 if self.stopped_nm.swap(false, Ordering::AcqRel) {
416 match iface::start_networkmanager() {500 match iface::start_networkmanager() {
@@ -421,7 +505,10 @@ impl RadioService {
421 }505 }
422 506
423 /// Register a worker thread; on spawn failure the error is reported on507 /// Register a worker thread; on spawn failure the error is reported on
424- /// the event pipe.508+ /// the event pipe. A PANIC inside the worker is caught here and
509+ /// reported as [`Event::Error`] with the payload — a silently dead
510+ /// worker leaves the UI believing a job is still running (join() only
511+ /// ever sees Err AFTER the thread is already gone).
425 fn spawn(512 fn spawn(
426 &self,513 &self,
427 name: &str,514 name: &str,
@@ -429,10 +516,23 @@ impl RadioService {
429 f: impl FnOnce(Sender<Event>) + Send + 'static,516 f: impl FnOnce(Sender<Event>) + Send + 'static,
430 ) -> bool {517 ) -> bool {
431 let worker_tx = self.tx.clone();518 let worker_tx = self.tx.clone();
519+ let what_owned = what.to_string();
432 match std::thread::Builder::new()520 match std::thread::Builder::new()
433 .name(name.to_string())521 .name(name.to_string())
434- .spawn(move || f(worker_tx))522+ .spawn(move || {
435- {523+ let panic_tx = worker_tx.clone();
524+ let r =
525+ std::panic::catch_unwind(std::panic::AssertUnwindSafe(move || f(worker_tx)));
526+ if let Err(payload) = r {
527+ log_err(
528+ &panic_tx,
529+ format!(
530+ "{what_owned}: worker panicked: {} — job aborted",
531+ panic_message(&*payload)
532+ ),
533+ );
534+ }
535+ }) {
436 Ok(h) => {536 Ok(h) => {
437 self.handles.lock().expect("handles poisoned").push(h);537 self.handles.lock().expect("handles poisoned").push(h);
438 true538 true
@@ -472,7 +572,8 @@ impl RadioService {
472 }572 }
473 }573 }
474 let suppress = self.deauth_suppress.clone();574 let suppress = self.deauth_suppress.clone();
475- self.spawn("wifilab-deauth", "deauth", move |tx| {575+ let bssids: Vec<MacAddr> = aps.iter().map(|(b, _)| *b).collect();
576+ let spawned = self.spawn("wifi_lab-deauth", "deauth", move |tx| {
476 deauth_worker(&mon, &aps, target, count, &pin, &stop, &tx);577 deauth_worker(&mon, &aps, target, count, &pin, &stop, &tx);
477 // Whatever happened above (early error return included): hand578 // Whatever happened above (early error return included): hand
478 // the channel back to the capture hold, else free hop.579 // the channel back to the capture hold, else free hop.
@@ -483,6 +584,16 @@ impl RadioService {
483 }584 }
484 }585 }
485 });586 });
587+ if !spawned {
588+ // Worker never started — un-suppress or the foreign-deauth
589+ // storm detector would ignore real attacks on these BSSIDs
590+ // forever (same spawned-check as capture_hs).
591+ if let Ok(mut s) = self.deauth_suppress.lock() {
592+ for bssid in &bssids {
593+ s.remove(bssid);
594+ }
595+ }
596+ }
486 }597 }
487 598
488 /// Multi-client deauth: one worker pins `ap`'s channel and blasts599 /// Multi-client deauth: one worker pins `ap`'s channel and blasts
@@ -501,7 +612,7 @@ impl RadioService {
501 s.insert(ap);612 s.insert(ap);
502 }613 }
503 let suppress = self.deauth_suppress.clone();614 let suppress = self.deauth_suppress.clone();
504- self.spawn("wifilab-deauth-all", "deauth-all", move |tx| {615+ let spawned = self.spawn("wifi_lab-deauth-all", "deauth-all", move |tx| {
505 let sock = match RawSocket::open(&mon) {616 let sock = match RawSocket::open(&mon) {
506 Ok(s) => s,617 Ok(s) => s,
507 Err(e) => {618 Err(e) => {
@@ -519,7 +630,10 @@ impl RadioService {
519 pin.override_freq(mhz);630 pin.override_freq(mhz);
520 }631 }
521 if let Err(e) = iface::set_channel(&mon, channel) {632 if let Err(e) = iface::set_channel(&mon, channel) {
522- log(&tx, format!("deauth-all: set_channel {channel} failed: {e:#}"));633+ log(
634+ &tx,
635+ format!("deauth-all: set_channel {channel} failed: {e:#}"),
636+ );
523 }637 }
524 for target in &targets {638 for target in &targets {
525 if stop.load(Ordering::Relaxed) {639 if stop.load(Ordering::Relaxed) {
@@ -547,21 +661,36 @@ impl RadioService {
547 s.remove(&ap);661 s.remove(&ap);
548 }662 }
549 });663 });
664+ if !spawned {
665+ // Worker never started — un-suppress or the storm detector
666+ // would ignore real deauth attacks on this AP forever.
667+ if let Ok(mut s) = self.deauth_suppress.lock() {
668+ s.remove(&ap);
669+ }
670+ }
550 }671 }
551 672
552 /// PMKID grab worker: single client-less auth+assoc attempt against673 /// PMKID grab worker: single client-less auth+assoc attempt against
553 /// `ap`, impersonating the monitor interface's own MAC. Emits674 /// `ap`, impersonating the monitor interface's own MAC. Emits
554 /// PmkidCaptured or a "no PMKID" log line.675 /// PmkidCaptured or a "no PMKID" log line.
676+ ///
677+ /// Channel arbitration: without a [`override_freq`](iface::ChannelPin::override_freq)
678+ /// the scanner re-asserts its hop plan one dwell (100 ms) later and
679+ /// the 3 s grab window listens on the WRONG channel (flaky "no
680+ /// PMKID"); pin the band first, then tune immediately so TX starts
681+ /// now, and settle back afterwards (mirrors deauth_all).
555 fn pmkid(&self, ap: MacAddr, channel: u8, essid: String) {682 fn pmkid(&self, ap: MacAddr, channel: u8, essid: String) {
556 let Some(mon) = self.mon() else {683 let Some(mon) = self.mon() else {
557 log_err(&self.tx, "pmkid: no scan session — StartScan first");684 log_err(&self.tx, "pmkid: no scan session — StartScan first");
558 return;685 return;
559 };686 };
560- self.spawn("wifilab-pmkid", "pmkid", move |tx| {687+ let pin = self.pin.clone();
688+ self.spawn("wifi_lab-pmkid", "pmkid", move |tx| {
561 let sta = match iface::mac_of(&mon) {689 let sta = match iface::mac_of(&mon) {
562 Ok(m) => m,690 Ok(m) => m,
563 Err(e) => {691 Err(e) => {
564 log_err(&tx, format!("pmkid: own MAC of {mon}: {e:#}"));692 log_err(&tx, format!("pmkid: own MAC of {mon}: {e:#}"));
693+ pin.settle();
565 return;694 return;
566 }695 }
567 };696 };
@@ -569,9 +698,15 @@ impl RadioService {
569 Ok(s) => s,698 Ok(s) => s,
570 Err(e) => {699 Err(e) => {
571 log_err(&tx, format!("pmkid: raw socket on {mon} failed: {e}"));700 log_err(&tx, format!("pmkid: raw socket on {mon} failed: {e}"));
701+ pin.settle();
572 return;702 return;
573 }703 }
574 };704 };
705+ // Move the pin first (scanner re-asserts this band, not the
706+ // hop plan), then one immediate tune so TX starts this instant.
707+ if let Some(mhz) = crate::common::freq_of_channel(channel) {
708+ pin.override_freq(mhz);
709+ }
575 if let Err(e) = iface::set_channel(&mon, channel) {710 if let Err(e) = iface::set_channel(&mon, channel) {
576 log(&tx, format!("pmkid: set_channel {channel} failed: {e:#}"));711 log(&tx, format!("pmkid: set_channel {channel} failed: {e:#}"));
577 }712 }
@@ -580,6 +715,7 @@ impl RadioService {
580 Ok(None) => log(&tx, format!("pmkid: no PMKID volunteered by {ap}")),715 Ok(None) => log(&tx, format!("pmkid: no PMKID volunteered by {ap}")),
581 Err(e) => log_err(&tx, format!("pmkid: {e:#}")),716 Err(e) => log_err(&tx, format!("pmkid: {e:#}")),
582 }717 }
718+ pin.settle();
583 });719 });
584 }720 }
585 721
@@ -611,7 +747,7 @@ impl RadioService {
611 }747 }
612 let pin = self.pin.clone();748 let pin = self.pin.clone();
613 let stop = self.stop.clone();749 let stop = self.stop.clone();
614- let spawned = self.spawn("wifilab-capture", "handshake", move |tx| {750+ let spawned = self.spawn("wifi_lab-capture", "handshake", move |tx| {
615 let _guard = hold.map(|mhz| PinGuard { pin, mhz });751 let _guard = hold.map(|mhz| PinGuard { pin, mhz });
616 let bssids: Vec<MacAddr> = targets.iter().map(|(b, _)| *b).collect();752 let bssids: Vec<MacAddr> = targets.iter().map(|(b, _)| *b).collect();
617 let mut channels: Vec<u8> = targets.iter().map(|(_, c)| *c).collect();753 let mut channels: Vec<u8> = targets.iter().map(|(_, c)| *c).collect();
@@ -621,7 +757,10 @@ impl RadioService {
621 // Apply immediately; the scanner re-asserts the same held757 // Apply immediately; the scanner re-asserts the same held
622 // frequency from now on.758 // frequency from now on.
623 if let Err(e) = iface::set_channel(&mon, channels[0]) {759 if let Err(e) = iface::set_channel(&mon, channels[0]) {
624- log_err(&tx, format!("handshake: set_channel {} on {mon}: {e:#}", channels[0]));760+ log_err(
761+ &tx,
762+ format!("handshake: set_channel {} on {mon}: {e:#}", channels[0]),
763+ );
625 return;764 return;
626 }765 }
627 }766 }
@@ -633,11 +772,26 @@ impl RadioService {
633 }772 }
634 };773 };
635 match handshake::capture_loop(&sock, &bssids, &essid, &tx, &stop) {774 match handshake::capture_loop(&sock, &bssids, &essid, &tx, &stop) {
636- Ok(true) => {}775+ Ok((complete, partials)) => {
637- Ok(false) => log(776+ if !complete {
638- &tx,777+ log(
639- format!("handshake: capture ended without a pair ({essid}, {} bssid(s))", bssids.len()),778+ &tx,
640- ),779+ format!(
780+ "handshake: capture ended without a pair ({essid}, {} bssid(s))",
781+ bssids.len()
782+ ),
783+ );
784+ }
785+ // Session teardown: the tracker's M2+M3 material that
786+ // never completed an M1+M2 pair is still crackable —
787+ // hand each to the UI as a partial capture. The
788+ // tracker only ever ingests frames for THIS session's
789+ // target BSSIDs, so every partial here belongs to a
790+ // targeted AP/client.
791+ for cap in partials {
792+ send(&tx, Event::HandshakePartial(Box::new(cap)));
793+ }
794+ }
641 Err(e) => log_err(&tx, format!("handshake: {e:#}")),795 Err(e) => log_err(&tx, format!("handshake: {e:#}")),
642 }796 }
643 });797 });
@@ -729,7 +883,7 @@ fn service_main() -> i32 {
729 // forwarder thread, so lines never interleave.883 // forwarder thread, so lines never interleave.
730 let (tx, rx) = crossbeam_channel::unbounded::<Event>();884 let (tx, rx) = crossbeam_channel::unbounded::<Event>();
731 let forwarder = std::thread::Builder::new()885 let forwarder = std::thread::Builder::new()
732- .name("wifilab-svc-fwd".into())886+ .name("wifi_lab-svc-fwd".into())
733 .spawn(move || {887 .spawn(move || {
734 let stdout = std::io::stdout();888 let stdout = std::io::stdout();
735 let mut out = std::io::BufWriter::new(stdout.lock());889 let mut out = std::io::BufWriter::new(stdout.lock());
@@ -745,7 +899,7 @@ fn service_main() -> i32 {
745 return; // parent gone899 return; // parent gone
746 }900 }
747 }901 }
748- Err(e) => eprintln!("wifilab-svc: event serialization failed: {e}"),902+ Err(e) => eprintln!("wifi_lab-svc: event serialization failed: {e}"),
749 }903 }
750 }904 }
751 })905 })
@@ -758,7 +912,7 @@ fn service_main() -> i32 {
758 let line = match lines.next() {912 let line = match lines.next() {
759 Some(Ok(l)) => l,913 Some(Ok(l)) => l,
760 Some(Err(e)) => {914 Some(Err(e)) => {
761- eprintln!("wifilab-svc: stdin read failed: {e}");915+ eprintln!("wifi_lab-svc: stdin read failed: {e}");
762 break; // treat as EOF916 break; // treat as EOF
763 }917 }
764 None => break, // EOF: parent closed the pipe918 None => break, // EOF: parent closed the pipe
@@ -769,7 +923,13 @@ fn service_main() -> i32 {
769 let cmd: Cmd = match serde_json::from_str(&line) {923 let cmd: Cmd = match serde_json::from_str(&line) {
770 Ok(c) => c,924 Ok(c) => c,
771 Err(e) => {925 Err(e) => {
772- log_err(&tx, format!("service: bad command line ({}): {e}", &line[..line.len().min(80)]));926+ log_err(
927+ &tx,
928+ format!(
929+ "service: bad command line ({}): {e}",
930+ truncate_utf8(&line, 80)
931+ ),
932+ );
773 continue;933 continue;
774 }934 }
775 };935 };
@@ -779,7 +939,12 @@ fn service_main() -> i32 {
779 channels,939 channels,
780 spool,940 spool,
781 fresh_spool,941 fresh_spool,
782- } => radio.start_scan(&ifname, channels.as_deref().unwrap_or(&[]), spool, fresh_spool),942+ } => radio.start_scan(
943+ &ifname,
944+ channels.as_deref().unwrap_or(&[]),
945+ spool,
946+ fresh_spool,
947+ ),
783 Cmd::StopScan => radio.stop_scan(),948 Cmd::StopScan => radio.stop_scan(),
784 Cmd::Deauth { aps, target, count } => radio.deauth(aps, target, count),949 Cmd::Deauth { aps, target, count } => radio.deauth(aps, target, count),
785 Cmd::DeauthAll {950 Cmd::DeauthAll {
@@ -866,7 +1031,7 @@ impl ServiceClient {
866 1031
867 let (ready_tx, ready_rx) = crossbeam_channel::bounded::<Result<()>>(1);1032 let (ready_tx, ready_rx) = crossbeam_channel::bounded::<Result<()>>(1);
868 let reader = std::thread::Builder::new()1033 let reader = std::thread::Builder::new()
869- .name("wifilab-svc-reader".into())1034+ .name("wifi_lab-svc-reader".into())
870 .spawn(move || {1035 .spawn(move || {
871 let mut lines = BufReader::new(stdout).lines();1036 let mut lines = BufReader::new(stdout).lines();
872 let mut ready = false;1037 let mut ready = false;
@@ -885,9 +1050,8 @@ impl ServiceClient {
885 }1050 }
886 Some(Ok(_)) => break,1051 Some(Ok(_)) => break,
887 Some(Err(e)) => {1052 Some(Err(e)) => {
888- let _ = ready_tx.try_send(Err(anyhow::anyhow!(1053+ let _ = ready_tx
889- "service stdout read failed: {e}"1054+ .try_send(Err(anyhow::anyhow!("service stdout read failed: {e}")));
890- )));
891 return;1055 return;
892 }1056 }
893 None => {1057 None => {
@@ -910,7 +1074,10 @@ impl ServiceClient {
910 let line = match line {1074 let line = match line {
911 Ok(l) => l,1075 Ok(l) => l,
912 Err(e) => {1076 Err(e) => {
913- send(&tx, Event::Error(format!("service stdout read failed: {e}")));1077+ send(
1078+ &tx,
1079+ Event::Error(format!("service stdout read failed: {e}")),
1080+ );
914 break;1081 break;
915 }1082 }
916 };1083 };
@@ -923,7 +1090,7 @@ impl ServiceClient {
923 &tx,1090 &tx,
924 Event::Error(format!(1091 Event::Error(format!(
925 "service: bad event line ({}): {e}",1092 "service: bad event line ({}): {e}",
926- &line[..line.len().min(80)]1093+ truncate_utf8(&line, 80)
927 )),1094 )),
928 ),1095 ),
929 }1096 }
@@ -1036,3 +1203,112 @@ impl Drop for ServiceClient {
1036 }1203 }
1037 }1204 }
1038 }1205 }
1206+
1207+#[cfg(test)]
1208+mod tests {
1209+ use super::*;
1210+
1211+ #[test]
1212+ fn truncate_utf8_short_string_unchanged() {
1213+ assert_eq!(truncate_utf8("hello", 80), "hello");
1214+ assert_eq!(truncate_utf8("", 80), "");
1215+ }
1216+
1217+ #[test]
1218+ fn truncate_utf8_ascii_cuts_at_limit() {
1219+ let s: String = "a".repeat(200);
1220+ assert_eq!(truncate_utf8(&s, 80).len(), 80);
1221+ }
1222+
1223+ #[test]
1224+ fn truncate_utf8_never_splits_multibyte_char() {
1225+ // Old code `&s[..s.len().min(80)]` panicked when byte 80 landed
1226+ // inside a multi-byte char; the service command loop (monitor
1227+ // mode left up) and the UI reader thread died on UTF-8 lines.
1228+ // 79 ASCII bytes + '€' (3 bytes): byte 80 is inside the char.
1229+ let mut s: String = "a".repeat(79);
1230+ s.push('€'); // bytes 79..82
1231+ s.push('€');
1232+ let t = truncate_utf8(&s, 80);
1233+ assert_eq!(t.len(), 79, "must back off to the char boundary");
1234+ assert!(t.chars().all(|c| c == 'a'));
1235+ // Boundary exactly at the char start: keep the char.
1236+ let t = truncate_utf8(&s, 82);
1237+ assert_eq!(t.chars().count(), 80, "79 'a' + one '€'");
1238+ // A string of nothing but multi-byte chars at an odd cutoff.
1239+ let s: String = "€".repeat(50); // 150 bytes
1240+ let t = truncate_utf8(&s, 80);
1241+ assert_eq!(t.len(), 78); // 26 chars × 3 bytes
1242+ }
1243+
1244+ #[test]
1245+ fn truncate_utf8_exact_limit_keeps_string() {
1246+ let s: String = "é".repeat(40); // 80 bytes, exactly at limit
1247+ assert_eq!(truncate_utf8(&s, 80), s.as_str());
1248+ }
1249+
1250+ #[test]
1251+ fn panic_message_extracts_str_and_string() {
1252+ let r = std::panic::catch_unwind(|| panic!("explicit &str payload"));
1253+ let payload = r.expect_err("must panic");
1254+ assert_eq!(panic_message(&*payload), "explicit &str payload");
1255+
1256+ let r = std::panic::catch_unwind(|| panic!("{}", "owned String"));
1257+ let payload = r.expect_err("must panic");
1258+ assert_eq!(panic_message(&*payload), "owned String");
1259+ }
1260+
1261+ #[test]
1262+ fn join_worker_reports_panics_via_event() {
1263+ let (tx, rx) = crossbeam_channel::unbounded();
1264+ let h = std::thread::spawn(|| panic!("scanner boom"));
1265+ join_worker(h, &tx, "scanner");
1266+ match rx.try_recv() {
1267+ Ok(Event::Error(msg)) => {
1268+ assert!(msg.contains("scanner"), "message names the worker: {msg}");
1269+ assert!(
1270+ msg.contains("scanner boom"),
1271+ "message carries the payload: {msg}"
1272+ );
1273+ }
1274+ other => panic!("expected Event::Error with panic payload, got {other:?}"),
1275+ }
1276+ }
1277+
1278+ #[test]
1279+ fn join_worker_quiet_on_clean_exit() {
1280+ let (tx, rx) = crossbeam_channel::unbounded();
1281+ let h = std::thread::spawn(|| {});
1282+ join_worker(h, &tx, "scanner");
1283+ assert!(rx.try_recv().is_err(), "no event for a clean exit");
1284+ }
1285+
1286+ #[test]
1287+ fn wrapped_worker_panic_becomes_error_event() {
1288+ // The spawn() catch_unwind discipline, exercised standalone: a
1289+ // panicking worker converts to ONE Event::Error and the handle
1290+ // joins Ok — never a silently dead thread.
1291+ let (tx, rx) = crossbeam_channel::unbounded::<Event>();
1292+ let panic_tx = tx.clone();
1293+ let h = std::thread::spawn(move || {
1294+ let r = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| -> bool {
1295+ panic!("deauth exploded")
1296+ }));
1297+ if let Err(payload) = r {
1298+ log_err(
1299+ &panic_tx,
1300+ format!(
1301+ "deauth: worker panicked: {} — job aborted",
1302+ panic_message(&*payload)
1303+ ),
1304+ );
1305+ }
1306+ });
1307+ h.join().expect("caught panic ⇒ clean join");
1308+ match rx.try_recv() {
1309+ Ok(Event::Error(msg)) => assert!(msg.contains("deauth exploded"), "{msg}"),
1310+ other => panic!("expected Event::Error, got {other:?}"),
1311+ }
1312+ assert!(rx.try_recv().is_err(), "exactly one error event");
1313+ }
1314+}
src/store.rsmodified+280 -50
@@ -1,4 +1,4 @@
1-//! Persistent UI-side data under `~/wifilab`:1+//! Persistent UI-side data under `~/wifi_lab`:
2 //! - `labels.json` — user-assigned names by MAC (APs and clients share one2 //! - `labels.json` — user-assigned names by MAC (APs and clients share one
3 //! namespace; a MAC is unique).3 //! namespace; a MAC is unique).
4 //! - `captures.jsonl` — every complete handshake / PMKID capture, one JSON4 //! - `captures.jsonl` — every complete handshake / PMKID capture, one JSON
@@ -15,12 +15,109 @@ use serde::{Deserialize, Serialize};
15 15
16 use crate::common::{HandshakeCapture, MacAddr, PmkidCapture};16 use crate::common::{HandshakeCapture, MacAddr, PmkidCapture};
17 17
18-/// `~/wifilab` — falls back to `./wifilab` when HOME is unset.18+/// `~/wifi_lab`. When HOME is unset the store lives under the system temp
19+/// dir (stable absolute path, independent of the caller's cwd) and a
20+/// warning is logged.
19 pub fn data_dir() -> PathBuf {21 pub fn data_dir() -> PathBuf {
20- std::env::var_os("HOME")22+ data_dir_impl(std::env::var_os("HOME").as_deref(), &std::env::temp_dir())
21- .map(PathBuf::from)23+}
22- .unwrap_or_else(|| PathBuf::from("."))24+
23- .join("wifilab")25+/// Split out of [`data_dir`] for tests: `home` is the raw HOME value,
26+/// `tmp` the fallback base when HOME is unset/empty.
27+fn data_dir_impl(home: Option<&std::ffi::OsStr>, tmp: &Path) -> PathBuf {
28+ let base = match home {
29+ Some(h) if !h.is_empty() => PathBuf::from(h),
30+ _ => {
31+ eprintln!(
32+ "wifi_lab: HOME is unset — data dir is {} (stable path, but outside any home)",
33+ tmp.join("wifi_lab").display()
34+ );
35+ return tmp.join("wifi_lab");
36+ }
37+ };
38+ let new = base.join("wifi_lab");
39+ let old = base.join("wifilab");
40+ // One-time move from the pre-rename location. Racing instances (or a
41+ // partial earlier migration) can make the target appear between the
42+ // check and the rename: rename unconditionally and treat "target
43+ // exists" as a finished migration, not an error.
44+ if old.exists() {
45+ match std::fs::rename(&old, &new) {
46+ Ok(()) => {}
47+ Err(e) if new.exists() => {
48+ let _ = e; // lost the race — the target is the live store
49+ }
50+ Err(e) => eprintln!(
51+ "wifi_lab: could not migrate {} → {} ({e}); starting fresh at the new path",
52+ old.display(),
53+ new.display()
54+ ),
55+ }
56+ }
57+ new
58+}
59+
60+/// Atomically replace `path` with `body`: write to a unique sibling tmp
61+/// file (`<name>.tmp.<pid>-<nanos>`), fsync the file, rename over the
62+/// target, then fsync the containing directory so the rename itself is
63+/// durable. A crash between the steps can leave the tmp file behind —
64+/// [`cleanup_stale_tmp`] removes it on the next load.
65+fn write_atomic(path: &Path, body: &str) -> Result<()> {
66+ use std::io::Write as _;
67+
68+ let dir = path.parent().expect("store path has a parent");
69+ std::fs::create_dir_all(dir).with_context(|| format!("creating {}", dir.display()))?;
70+ let nanos = std::time::SystemTime::now()
71+ .duration_since(std::time::UNIX_EPOCH)
72+ .map(|d| d.as_nanos())
73+ .unwrap_or(0);
74+ let name = path
75+ .file_name()
76+ .and_then(|n| n.to_str())
77+ .expect("store path has a file name");
78+ let tmp = path.with_file_name(format!("{name}.tmp.{}-{nanos}", std::process::id()));
79+ let write_result = (|| -> Result<()> {
80+ let mut f =
81+ std::fs::File::create(&tmp).with_context(|| format!("creating {}", tmp.display()))?;
82+ f.write_all(body.as_bytes())
83+ .with_context(|| format!("writing {}", tmp.display()))?;
84+ f.sync_all()
85+ .with_context(|| format!("fsyncing {}", tmp.display()))?;
86+ Ok(())
87+ })();
88+ if let Err(e) = write_result {
89+ let _ = std::fs::remove_file(&tmp);
90+ return Err(e);
91+ }
92+ std::fs::rename(&tmp, path)
93+ .with_context(|| format!("renaming {} → {}", tmp.display(), path.display()))?;
94+ std::fs::File::open(dir)
95+ .and_then(|d| d.sync_all())
96+ .with_context(|| format!("fsyncing {}", dir.display()))?;
97+ Ok(())
98+}
99+
100+/// Remove stale `<name>.tmp.*` siblings of `path` left over from a crashed
101+/// atomic write. Called on every load; failures are ignored (a read-only
102+/// dir must not break loading).
103+fn cleanup_stale_tmp(path: &Path) {
104+ let Some(dir) = path.parent() else { return };
105+ let Some(name) = path.file_name().and_then(|n| n.to_str()) else {
106+ return;
107+ };
108+ let prefix = format!("{name}.tmp.");
109+ let Ok(entries) = std::fs::read_dir(dir) else {
110+ return;
111+ };
112+ for entry in entries.flatten() {
113+ let stale = entry
114+ .file_name()
115+ .to_str()
116+ .is_some_and(|n| n.starts_with(&prefix));
117+ if stale {
118+ let _ = std::fs::remove_file(entry.path());
119+ }
120+ }
24 }121 }
25 122
26 fn labels_path() -> PathBuf {123 fn labels_path() -> PathBuf {
@@ -54,6 +151,7 @@ impl StoredCapture {
54 }151 }
55 152
56 fn load_labels_from(path: &Path) -> Result<BTreeMap<MacAddr, String>> {153 fn load_labels_from(path: &Path) -> Result<BTreeMap<MacAddr, String>> {
154+ cleanup_stale_tmp(path);
57 let raw = match std::fs::read_to_string(path) {155 let raw = match std::fs::read_to_string(path) {
58 Ok(s) => s,156 Ok(s) => s,
59 Err(e) if e.kind() == std::io::ErrorKind::NotFound => {157 Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
@@ -65,7 +163,9 @@ fn load_labels_from(path: &Path) -> Result<BTreeMap<MacAddr, String>> {
65 serde_json::from_str(&raw).context("parsing labels.json")?;163 serde_json::from_str(&raw).context("parsing labels.json")?;
66 let mut out = BTreeMap::new();164 let mut out = BTreeMap::new();
67 for (mac, label) in by_str {165 for (mac, label) in by_str {
68- let mac: MacAddr = mac.parse().with_context(|| format!("bad MAC key {mac:?}"))?;166+ let mac: MacAddr = mac
167+ .parse()
168+ .with_context(|| format!("bad MAC key {mac:?}"))?;
69 if !label.is_empty() {169 if !label.is_empty() {
70 out.insert(mac, label);170 out.insert(mac, label);
71 }171 }
@@ -80,19 +180,14 @@ pub fn load() -> Result<BTreeMap<MacAddr, String>> {
80 }180 }
81 181
82 fn save_labels_to(path: &Path, labels: &BTreeMap<MacAddr, String>) -> Result<()> {182 fn save_labels_to(path: &Path, labels: &BTreeMap<MacAddr, String>) -> Result<()> {
83- let dir = path.parent().expect("labels path has a parent");
84- std::fs::create_dir_all(dir).with_context(|| format!("creating {}", dir.display()))?;
85 let by_str: BTreeMap<String, &String> =183 let by_str: BTreeMap<String, &String> =
86 labels.iter().map(|(mac, l)| (mac.to_string(), l)).collect();184 labels.iter().map(|(mac, l)| (mac.to_string(), l)).collect();
87 let body = serde_json::to_string_pretty(&by_str).expect("string map serialization");185 let body = serde_json::to_string_pretty(&by_str).expect("string map serialization");
88- let tmp = path.with_extension("json.tmp");186+ write_atomic(path, &body)
89- std::fs::write(&tmp, body).with_context(|| format!("writing {}", tmp.display()))?;
90- std::fs::rename(&tmp, path)
91- .with_context(|| format!("renaming {} → {}", tmp.display(), path.display()))
92 }187 }
93 188
94-/// Persist the whole label map (labels are few; rewriting is cheap and189+/// Persist the whole label map (labels are few; rewriting is cheap, made
95-/// atomic enough via write-to-tmp + rename).190+/// crash-safe by [`write_atomic`]).
96 pub fn save(labels: &BTreeMap<MacAddr, String>) -> Result<()> {191 pub fn save(labels: &BTreeMap<MacAddr, String>) -> Result<()> {
97 save_labels_to(&labels_path(), labels)192 save_labels_to(&labels_path(), labels)
98 }193 }
@@ -136,7 +231,10 @@ fn load_captures_from(path: &Path) -> Result<Vec<StoredCapture>> {
136 }231 }
137 }232 }
138 // One corrupt line must not kill the whole archive.233 // One corrupt line must not kill the whole archive.
139- Err(e) => eprintln!("wifilab: skipping corrupt captures.jsonl line {}: {e}", n + 1),234+ Err(e) => eprintln!(
235+ "wifi_lab: skipping corrupt captures.jsonl line {}: {e}",
236+ n + 1
237+ ),
140 }238 }
141 }239 }
142 Ok(out)240 Ok(out)
@@ -153,36 +251,70 @@ pub fn load_captures() -> Result<Vec<StoredCapture>> {
153 // — in this or a future session — continues instead of restarting.251 // — in this or a future session — continues instead of restarting.
154 // ---------------------------------------------------------------------------252 // ---------------------------------------------------------------------------
155 253
254+/// Current on-disk session format. v2: `done` is an exact RAW stream
255+/// position — resume seeks/skips past exactly the already-verified
256+/// candidates for every attack mode (see `attack.rs` position plumbing).
257+pub const SESSION_VERSION: u32 = 2;
258+
259+/// Older files carry no `version` field: they are v1.
260+fn default_version() -> u32 {
261+ 1
262+}
263+
156 /// A stopped (not finished) crack run: which capture, which attack, how264 /// A stopped (not finished) crack run: which capture, which attack, how
157 /// far it had gotten. Written throttle-throttled on progress and once on265 /// far it had gotten. Written throttle-throttled on progress and once on
158 /// stop; deleted when the run finds the password or exhausts the space.266 /// stop; deleted when the run finds the password or exhausts the space.
267+///
268+/// Version semantics: v1 (no `version` field) counted YIELDED candidates
269+/// in `done`, which drifted from the raw stream once the PMK cache skipped
270+/// entries or rules/hybrid filtered candidates — resuming best-effort may
271+/// REDO some work but never skips untried candidates. v2 counts exact raw
272+/// positions; resume is exact (`never redo, never skip`) for wordlist /
273+/// rules / hybrid / bruteforce / rainbow.
159 #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]274 #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
160 pub struct CrackSession {275 pub struct CrackSession {
276+ /// File format version; [`SESSION_VERSION`] for newly written files.
277+ #[serde(default = "default_version")]
278+ pub version: u32,
161 pub capture: StoredCapture,279 pub capture: StoredCapture,
162 pub attack: crate::attack::Attack,280 pub attack: crate::attack::Attack,
163- /// Candidates checked so far (resume skips/seeks past these).281+ /// Candidates verified so far (resume seeks/skips past these); a raw
282+ /// stream position in v2 files (see above).
164 pub done: u64,283 pub done: u64,
165 /// Worst-case total of the run (see the ETA plumbing), when countable.284 /// Worst-case total of the run (see the ETA plumbing), when countable.
166 pub total: Option<u64>,285 pub total: Option<u64>,
167 }286 }
168 287
169-fn save_session_to(path: &Path, session: &CrackSession) -> Result<()> {288+impl CrackSession {
170- if let Some(dir) = path.parent() {289+ /// A v2 session for the interrupted run.
171- std::fs::create_dir_all(dir).context("creating ~/wifilab")?;290+ pub fn new(
291+ capture: StoredCapture,
292+ attack: crate::attack::Attack,
293+ done: u64,
294+ total: Option<u64>,
295+ ) -> Self {
296+ CrackSession {
297+ version: SESSION_VERSION,
298+ capture,
299+ attack,
300+ done,
301+ total,
302+ }
172 }303 }
304+}
305+
306+fn save_session_to(path: &Path, session: &CrackSession) -> Result<()> {
173 let json = serde_json::to_string_pretty(session).context("serializing crack session")?;307 let json = serde_json::to_string_pretty(session).context("serializing crack session")?;
174- let tmp = path.with_extension("json.tmp");308+ write_atomic(path, &json)
175- std::fs::write(&tmp, json).with_context(|| format!("writing {}", tmp.display()))?;
176- std::fs::rename(&tmp, path).with_context(|| format!("renaming {}", path.display()))?;
177- Ok(())
178 }309 }
179 310
180-/// Persist the session (atomic-ish: write tmp + rename, like labels).311+/// Persist the session (crash-safe via [`write_atomic`]).
181 pub fn save_session(session: &CrackSession) -> Result<()> {312 pub fn save_session(session: &CrackSession) -> Result<()> {
182 save_session_to(&session_path(), session)313 save_session_to(&session_path(), session)
183 }314 }
184 315
185 fn load_session_from(path: &Path) -> Result<Option<CrackSession>> {316 fn load_session_from(path: &Path) -> Result<Option<CrackSession>> {
317+ cleanup_stale_tmp(path);
186 match std::fs::read_to_string(path) {318 match std::fs::read_to_string(path) {
187 Ok(s) => Ok(Some(319 Ok(s) => Ok(Some(
188 serde_json::from_str(&s).context("parsing crack-session.json")?,320 serde_json::from_str(&s).context("parsing crack-session.json")?,
@@ -210,12 +342,12 @@ pub fn clear_session() -> Result<()> {
210 }342 }
211 343
212 // ---------------------------------------------------------------------------344 // ---------------------------------------------------------------------------
213-// Per-SSID PMK cache: `~/wifilab/cache/<ssid-hex>.pmk` in rainbow text345+// Per-SSID PMK cache: `~/wifi_lab/cache/<ssid-hex>.pmk` in rainbow text
214 // format — PMKs computed on earlier CPU runs are reusable for ANY capture346 // format — PMKs computed on earlier CPU runs are reusable for ANY capture
215 // of the same SSID without re-running PBKDF2.347 // of the same SSID without re-running PBKDF2.
216 // ---------------------------------------------------------------------------348 // ---------------------------------------------------------------------------
217 349
218-/// `~/wifilab/cache` — created on use by the cache readers/writers.350+/// `~/wifi_lab/cache` — created on use by the cache readers/writers.
219 pub fn cache_dir() -> PathBuf {351 pub fn cache_dir() -> PathBuf {
220 data_dir().join("cache")352 data_dir().join("cache")
221 }353 }
@@ -228,7 +360,7 @@ pub fn cache_file(ssid: &str) -> PathBuf {
228 }360 }
229 361
230 // ---------------------------------------------------------------------------362 // ---------------------------------------------------------------------------
231-// Crack profiles + recent wordlists (`~/wifilab/profiles.json`): user-saved363+// Crack profiles + recent wordlists (`~/wifi_lab/profiles.json`): user-saved
232 // attack setups for one-click reuse on the cracker page.364 // attack setups for one-click reuse on the cracker page.
233 // ---------------------------------------------------------------------------365 // ---------------------------------------------------------------------------
234 366
@@ -253,11 +385,12 @@ fn profiles_path() -> PathBuf {
253 }385 }
254 386
255 fn load_profiles_from(path: &Path) -> Result<Profiles> {387 fn load_profiles_from(path: &Path) -> Result<Profiles> {
388+ cleanup_stale_tmp(path);
256 match std::fs::read_to_string(path) {389 match std::fs::read_to_string(path) {
257 Ok(s) => match serde_json::from_str::<Profiles>(&s) {390 Ok(s) => match serde_json::from_str::<Profiles>(&s) {
258 Ok(p) => Ok(p),391 Ok(p) => Ok(p),
259 Err(e) => {392 Err(e) => {
260- eprintln!("wifilab: profiles.json unreadable ({e}), starting fresh");393+ eprintln!("wifi_lab: profiles.json unreadable ({e}), starting fresh");
261 Ok(Profiles::default())394 Ok(Profiles::default())
262 }395 }
263 },396 },
@@ -272,16 +405,11 @@ pub fn load_profiles() -> Result<Profiles> {
272 }405 }
273 406
274 fn save_profiles_to(path: &Path, p: &Profiles) -> Result<()> {407 fn save_profiles_to(path: &Path, p: &Profiles) -> Result<()> {
275- let dir = path.parent().expect("profiles path has a parent");
276- std::fs::create_dir_all(dir).with_context(|| format!("creating {}", dir.display()))?;
277 let body = serde_json::to_string_pretty(p).context("serializing profiles")?;408 let body = serde_json::to_string_pretty(p).context("serializing profiles")?;
278- let tmp = path.with_extension("json.tmp");409+ write_atomic(path, &body)
279- std::fs::write(&tmp, body).with_context(|| format!("writing {}", tmp.display()))?;
280- std::fs::rename(&tmp, path)
281- .with_context(|| format!("renaming {} → {}", tmp.display(), path.display()))
282 }410 }
283 411
284-/// Persist profiles (atomic-ish: write tmp + rename, like labels).412+/// Persist profiles (crash-safe via [`write_atomic`]).
285 pub fn save_profiles(p: &Profiles) -> Result<()> {413 pub fn save_profiles(p: &Profiles) -> Result<()> {
286 save_profiles_to(&profiles_path(), p)414 save_profiles_to(&profiles_path(), p)
287 }415 }
@@ -299,7 +427,7 @@ mod tests {
299 use super::*;427 use super::*;
300 428
301 fn tmp(name: &str) -> PathBuf {429 fn tmp(name: &str) -> PathBuf {
302- std::env::temp_dir().join(format!("wifilab-store-test-{}-{name}", std::process::id()))430+ std::env::temp_dir().join(format!("wifi_lab-store-test-{}-{name}", std::process::id()))
303 }431 }
304 432
305 #[test]433 #[test]
@@ -326,28 +454,128 @@ mod tests {
326 let dir = tmp("session");454 let dir = tmp("session");
327 let path = dir.join("crack-session.json");455 let path = dir.join("crack-session.json");
328 assert!(load_session_from(&path).unwrap().is_none());456 assert!(load_session_from(&path).unwrap().is_none());
329- let session = CrackSession {457+ let session = CrackSession::new(
330- capture: StoredCapture::Pmkid(PmkidCapture {458+ StoredCapture::Pmkid(PmkidCapture {
331 ap: "aa:bb:cc:dd:ee:ff".parse().unwrap(),459 ap: "aa:bb:cc:dd:ee:ff".parse().unwrap(),
332 client: "11:22:33:44:55:66".parse().unwrap(),460 client: "11:22:33:44:55:66".parse().unwrap(),
333- essid: "parafin".into(),461+ essid: "testnet".into(),
334 pmkid: [7u8; 16],462 pmkid: [7u8; 16],
335 }),463 }),
336- attack: crate::attack::Attack::Bruteforce {464+ crate::attack::Attack::Bruteforce {
337 charset: b"01".to_vec(),465 charset: b"01".to_vec(),
338 min: 8,466 min: 8,
339 max: 10,467 max: 10,
340 freq_order: true,468 freq_order: true,
341 },469 },
342- done: 12_345,470+ 12_345,
343- total: Some(1_114_100),471+ Some(1_114_100),
344- };472+ );
473+ assert_eq!(session.version, SESSION_VERSION);
345 save_session_to(&path, &session).unwrap();474 save_session_to(&path, &session).unwrap();
346 let back = load_session_from(&path).unwrap().expect("saved");475 let back = load_session_from(&path).unwrap().expect("saved");
347 assert_eq!(back, session);476 assert_eq!(back, session);
348 let _ = std::fs::remove_dir_all(&dir);477 let _ = std::fs::remove_dir_all(&dir);
349 }478 }
350 479
480+ #[test]
481+ fn session_v1_file_loads_with_version_1() {
482+ // Files written before the version field existed (no "version"
483+ // key) must still parse: best-effort resume (may redo some work,
484+ // never skips untried candidates).
485+ let dir = tmp("session-v1");
486+ let path = dir.join("crack-session.json");
487+ std::fs::create_dir_all(&dir).unwrap();
488+ // Field shapes are what the current serializers emit (v1 and v2
489+ // differ ONLY in the added `version` key): MACs serialize as
490+ // 6-byte arrays, Attack as an externally-tagged enum.
491+ let v1 = serde_json::json!({
492+ "capture": {
493+ "kind": "pmkid",
494+ "ap": [170, 187, 204, 221, 238, 255],
495+ "client": [17, 34, 51, 68, 85, 102],
496+ "essid": "testnet",
497+ "pmkid": [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
498+ },
499+ "attack": { "Bruteforce": { "charset": [48, 49], "min": 8, "max": 10, "freq_order": false } },
500+ "done": 4242u64,
501+ "total": null,
502+ });
503+ std::fs::write(&path, serde_json::to_string(&v1).unwrap()).unwrap();
504+ let back = load_session_from(&path).unwrap().expect("v1 parses");
505+ assert_eq!(back.version, 1);
506+ assert_eq!(back.done, 4242);
507+ assert_eq!(back.total, None);
508+ let _ = std::fs::remove_dir_all(&dir);
509+ }
510+
511+ #[test]
512+ fn stale_tmp_files_cleaned_on_load() {
513+ let dir = tmp("tmpc");
514+ let path = dir.join("labels.json");
515+ let mac: MacAddr = "aa:bb:cc:dd:ee:ff".parse().unwrap();
516+ let mut labels = BTreeMap::new();
517+ labels.insert(mac, "x".to_string());
518+ save_labels_to(&path, &labels).unwrap();
519+ // No tmp file survives a successful save.
520+ let left: Vec<_> = std::fs::read_dir(&dir)
521+ .unwrap()
522+ .flatten()
523+ .map(|e| e.file_name().to_string_lossy().into_owned())
524+ .collect();
525+ assert_eq!(left, vec!["labels.json"], "save leaves no tmp: {left:?}");
526+ // Crashed-write leftovers are removed by the next load, labels
527+ // still load fine, and unrelated files are untouched.
528+ std::fs::write(dir.join("labels.json.tmp.1-2"), "partial junk").unwrap();
529+ std::fs::write(dir.join("other.tmp.1-2"), "not ours").unwrap();
530+ let back = load_labels_from(&path).unwrap();
531+ assert_eq!(back.get(&mac).map(String::as_str), Some("x"));
532+ let left: Vec<_> = std::fs::read_dir(&dir)
533+ .unwrap()
534+ .flatten()
535+ .map(|e| e.file_name().to_string_lossy().into_owned())
536+ .collect();
537+ assert!(left.contains(&"labels.json".to_string()));
538+ assert!(
539+ left.contains(&"other.tmp.1-2".to_string()),
540+ "unrelated kept"
541+ );
542+ assert!(
543+ !left.iter().any(|n| n.starts_with("labels.json.tmp.")),
544+ "stale gone: {left:?}"
545+ );
546+ let _ = std::fs::remove_dir_all(&dir);
547+ }
548+
549+ #[test]
550+ fn data_dir_home_unset_uses_tmp_base() {
551+ let got = data_dir_impl(None, Path::new("/tmpbase"));
552+ assert_eq!(got, PathBuf::from("/tmpbase/wifi_lab"));
553+ let got = data_dir_impl(Some(std::ffi::OsStr::new("")), Path::new("/tmpbase"));
554+ assert_eq!(got, PathBuf::from("/tmpbase/wifi_lab"));
555+ }
556+
557+ #[test]
558+ fn data_dir_migration_and_race() {
559+ let dir = tmp("datadir");
560+ let home = dir.join("home");
561+ // Migration: old `wifilab` moves to `wifi_lab`.
562+ std::fs::create_dir_all(home.join("wifilab/sub")).unwrap();
563+ std::fs::write(home.join("wifilab/sub/f.json"), "{}").unwrap();
564+ let got = data_dir_impl(Some(home.as_os_str()), Path::new("/tmpbase"));
565+ assert_eq!(got, home.join("wifi_lab"));
566+ assert!(home.join("wifi_lab/sub/f.json").is_file());
567+ assert!(!home.join("wifilab").exists());
568+ // Race: both exist (a second instance already created the target).
569+ // The rename fails; the target wins, no error, old dir left alone.
570+ std::fs::create_dir_all(home.join("wifilab")).unwrap();
571+ std::fs::write(home.join("wifilab/stale.marker"), "x").unwrap();
572+ let got = data_dir_impl(Some(home.as_os_str()), Path::new("/tmpbase"));
573+ assert_eq!(got, home.join("wifi_lab"));
574+ assert!(home.join("wifi_lab").is_dir());
575+ // Neither outcome is an error; the function must not panic.
576+ let _ = std::fs::remove_dir_all(&dir);
577+ }
578+
351 #[test]579 #[test]
352 fn captures_append_and_load_dedups() {580 fn captures_append_and_load_dedups() {
353 let dir = tmp("caps");581 let dir = tmp("caps");
@@ -355,13 +583,13 @@ mod tests {
355 let pm = PmkidCapture {583 let pm = PmkidCapture {
356 ap: "aa:bb:cc:dd:ee:ff".parse().unwrap(),584 ap: "aa:bb:cc:dd:ee:ff".parse().unwrap(),
357 client: "11:22:33:44:55:66".parse().unwrap(),585 client: "11:22:33:44:55:66".parse().unwrap(),
358- essid: "parafin".into(),586+ essid: "testnet".into(),
359 pmkid: [7u8; 16],587 pmkid: [7u8; 16],
360 };588 };
361 let hs = HandshakeCapture::new(589 let hs = HandshakeCapture::new(
362 "aa:bb:cc:dd:ee:ff".parse().unwrap(),590 "aa:bb:cc:dd:ee:ff".parse().unwrap(),
363 "11:22:33:44:55:66".parse().unwrap(),591 "11:22:33:44:55:66".parse().unwrap(),
364- "parafin".into(),592+ "testnet".into(),
365 [1u8; 32],593 [1u8; 32],
366 [2u8; 32],594 [2u8; 32],
367 [3u8; 16],595 [3u8; 16],
@@ -418,7 +646,10 @@ mod tests {
418 let back = load_profiles_from(&path).unwrap();646 let back = load_profiles_from(&path).unwrap();
419 assert_eq!(back.profiles.len(), 2);647 assert_eq!(back.profiles.len(), 2);
420 assert_eq!(back.profiles[0].name, "wl:rockyou");648 assert_eq!(back.profiles[0].name, "wl:rockyou");
421- assert_eq!(back.profiles[1].rules.as_deref(), Some("/home/x/best64.rule"));649+ assert_eq!(
650+ back.profiles[1].rules.as_deref(),
651+ Some("/home/x/best64.rule")
652+ );
422 assert_eq!(back.recent_wordlists, p.recent_wordlists);653 assert_eq!(back.recent_wordlists, p.recent_wordlists);
423 // Unparseable file = empty store, no error (never clobbered).654 // Unparseable file = empty store, no error (never clobbered).
424 std::fs::write(&path, "{{not json").unwrap();655 std::fs::write(&path, "{{not json").unwrap();
@@ -442,10 +673,10 @@ mod tests {
442 673
443 #[test]674 #[test]
444 fn cache_file_hex_naming() {675 fn cache_file_hex_naming() {
445- let p = cache_file("parafin");676+ let p = cache_file("testnet");
446 assert_eq!(677 assert_eq!(
447 p.file_name().unwrap().to_str().unwrap(),678 p.file_name().unwrap().to_str().unwrap(),
448- "7061726166696e.pmk"679+ "746573746e6574.pmk"
449 );680 );
450 // Hex is lowercase and 2 chars per byte; non-ASCII bytes safe.681 // Hex is lowercase and 2 chars per byte; non-ASCII bytes safe.
451 let p2 = cache_file("aé");682 let p2 = cache_file("aé");
@@ -453,4 +684,3 @@ mod tests {
453 assert_eq!(p.parent().unwrap(), cache_dir());684 assert_eq!(p.parent().unwrap(), cache_dir());
454 }685 }
455 }686 }
456-
src/ui/app.rsmodified+307 -112
@@ -1,7 +1,42 @@
1-//! Root view: nav rail, header bar (interface picker, privilege badge,1+//!//! Root view: nav rail, header bar (interface picker, privilege badge,
2 //! monitor/capture toggle), page content, status line, and the background2 //! monitor/capture toggle), page content, status line, and the background
3 //! task that polls the service event channel.3 //! task that polls the service event channel.
4 4
5+/// Word-wrap toast text. gpuikit toasts render their message on one line,
6+/// so a long message (the deauth-storm alert carries two MACs) stretches
7+/// the 360 px toast box past the window edge. 36 chars ≈ the usable width
8+/// at text_sm once icon, padding and the close button are subtracted.
9+fn wrap_toast_text(msg: &str) -> String {
10+ const LIMIT: usize = 36;
11+ let mut out = String::with_capacity(msg.len() + 4);
12+ let mut col = 0usize;
13+ for word in msg.split(' ') {
14+ if col > 0 && col + 1 + word.len() > LIMIT {
15+ out.push('\n');
16+ col = 0;
17+ } else if col > 0 {
18+ out.push(' ');
19+ col += 1;
20+ }
21+ out.push_str(word);
22+ col += word.len();
23+ // Unbreakable token longer than one line (e.g. a file path in an
24+ // error): hard-split it so it can never stretch the box.
25+ while col > LIMIT {
26+ let start = out.len() - col;
27+ let cut = start
28+ + out[start..]
29+ .char_indices()
30+ .nth(LIMIT)
31+ .map(|(i, _)| i)
32+ .unwrap_or(col);
33+ out.insert(cut, '\n');
34+ col -= LIMIT;
35+ }
36+ }
37+ out
38+}
39+
5 use std::collections::BTreeMap;40 use std::collections::BTreeMap;
6 use std::sync::Arc;41 use std::sync::Arc;
7 use std::sync::atomic::{AtomicBool, Ordering};42 use std::sync::atomic::{AtomicBool, Ordering};
@@ -10,8 +45,8 @@ use std::time::{Duration, Instant};
10 use crossbeam_channel::{Receiver, Sender};45 use crossbeam_channel::{Receiver, Sender};
11 use gpui::{46 use gpui::{
12 App, AppContext, Context, Entity, FocusHandle, FontWeight, InteractiveElement, IntoElement,47 App, AppContext, Context, Entity, FocusHandle, FontWeight, InteractiveElement, IntoElement,
13- ParentElement, Render, SharedString, StatefulInteractiveElement, Styled, Window, div,48+ KeyBinding, ParentElement, Render, SharedString, StatefulInteractiveElement, Styled, Window,
14- prelude::FluentBuilder, px,49+ actions, div, prelude::FluentBuilder, px,
15 };50 };
16 use gpuikit::elements::badge::badge;51 use gpuikit::elements::badge::badge;
17 use gpuikit::elements::button::button;52 use gpuikit::elements::button::button;
@@ -30,6 +65,38 @@ use crate::ui::{attacks, cracker, log as log_view, networks, state::AppState};
30 /// How often the UI drains the service event channel.65 /// How often the UI drains the service event channel.
31 const EVENT_POLL: Duration = Duration::from_millis(100);66 const EVENT_POLL: Duration = Duration::from_millis(100);
32 67
68+actions!(
69+ wifi_lab,
70+ [
71+ /// ctrl-q: quit the app (the release hook stops UI-process jobs
72+ /// and shuts the service down).
73+ QuitApp,
74+ /// ctrl-1: switch to the Networks page.
75+ ShowNetworksPage,
76+ /// ctrl-2: switch to the Attacks page.
77+ ShowAttacksPage,
78+ /// ctrl-3: switch to the Cracker page.
79+ ShowCrackerPage,
80+ /// ctrl-4: switch to the Log page.
81+ ShowLogPage,
82+ ]
83+);
84+
85+/// Global (window-level) keybindings: quit + page switches. Registered
86+/// once at app start (see [`crate::ui::run_app`]); the matching
87+/// `.on_action` handlers live on the root view so the bindings fire
88+/// regardless of which page or control is focused. No per-page bindings
89+/// here — pages register their own (e.g. the cracker page's Enter).
90+pub fn bind_app_keys(cx: &mut App) {
91+ cx.bind_keys([
92+ KeyBinding::new("ctrl-q", QuitApp, None),
93+ KeyBinding::new("ctrl-1", ShowNetworksPage, None),
94+ KeyBinding::new("ctrl-2", ShowAttacksPage, None),
95+ KeyBinding::new("ctrl-3", ShowCrackerPage, None),
96+ KeyBinding::new("ctrl-4", ShowLogPage, None),
97+ ]);
98+}
99+
33 /// Left nav destinations.100 /// Left nav destinations.
34 #[derive(Clone, Copy, PartialEq, Eq)]101 #[derive(Clone, Copy, PartialEq, Eq)]
35 pub enum Page {102 pub enum Page {
@@ -51,7 +118,7 @@ impl Page {
51 }118 }
52 }119 }
53 120
54- /// Startup page override (`WIFILAB_PAGE=attacks`) — dev/visual-verification121+ /// Startup page override (`WIFI_LAB_PAGE=attacks`) — dev/visual-verification
55 /// hook; unknown values fall through to Networks.122 /// hook; unknown values fall through to Networks.
56 fn from_name(name: &str) -> Option<Page> {123 fn from_name(name: &str) -> Option<Page> {
57 Page::ALL124 Page::ALL
@@ -78,7 +145,7 @@ pub struct AppRoot {
78 /// stop/start cycles. NOT involved in cracking — crack jobs are145 /// stop/start cycles. NOT involved in cracking — crack jobs are
79 /// UI-process threads tracked via [`AppRoot::crack_stop`].146 /// UI-process threads tracked via [`AppRoot::crack_stop`].
80 pub service: Option<ServiceClient>,147 pub service: Option<ServiceClient>,
81- /// Mock data mode (`--mock` / `WIFILAB_MOCK=1`): never touches devices.148+ /// Mock data mode (`--mock` / `WIFI_LAB_MOCK=1`): never touches devices.
82 pub is_mock: bool,149 pub is_mock: bool,
83 /// Target BSSID picked on the Networks page (AP row or client row).150 /// Target BSSID picked on the Networks page (AP row or client row).
84 pub selected: Option<MacAddr>,151 pub selected: Option<MacAddr>,
@@ -102,8 +169,6 @@ pub struct AppRoot {
102 /// list. Blanket spectrum-wide hopping makes capture/PMKID/deauth169 /// list. Blanket spectrum-wide hopping makes capture/PMKID/deauth
103 /// mostly deaf and blind to one band.170 /// mostly deaf and blind to one band.
104 pub parked_channels: Option<Vec<u8>>,171 pub parked_channels: Option<Vec<u8>>,
105- /// Crack run in flight; cleared when CrackStopped arrives.
106- pub crack_inflight: bool,
107 /// Stop flag of the running crack job (UI-process thread, see172 /// Stop flag of the running crack job (UI-process thread, see
108 /// [`crate::attack`]); flipped by Stop and on window close.173 /// [`crate::attack`]); flipped by Stop and on window close.
109 pub crack_stop: Option<Arc<AtomicBool>>,174 pub crack_stop: Option<Arc<AtomicBool>>,
@@ -123,7 +188,10 @@ pub struct AppRoot {
123 pub client_sort: Option<SortDescriptor>,188 pub client_sort: Option<SortDescriptor>,
124 pub focus_handle: FocusHandle,189 pub focus_handle: FocusHandle,
125 pub iface_select: Entity<SelectState<String>>,190 pub iface_select: Entity<SelectState<String>>,
126- pub target_select: Entity<SelectState<String>>,191+ /// Cracker target picker; the VALUE is the stable index into
192+ /// `state.capture_descs()` (mirrors [`state::CrackerState::target`]),
193+ /// the LABEL is the display description.
194+ pub target_select: Entity<SelectState<usize>>,
127 pub wordlist_input: Entity<InputState>,195 pub wordlist_input: Entity<InputState>,
128 /// Cracker attack-mode picker ([`crate::attack::Attack`]: wordlist /196 /// Cracker attack-mode picker ([`crate::attack::Attack`]: wordlist /
129 /// bruteforce / rainbow).197 /// bruteforce / rainbow).
@@ -166,7 +234,7 @@ pub struct AppRoot {
166 /// Target count behind the "Deauth all clients (N)" button label234 /// Target count behind the "Deauth all clients (N)" button label
167 /// (0 = hidden); computed during attack-page render prep.235 /// (0 = hidden); computed during attack-page render prep.
168 pub deauth_all_targets: usize,236 pub deauth_all_targets: usize,
169- /// Saved cracking presets + recent wordlists (~/wifilab/profiles.json).237+ /// Saved cracking presets + recent wordlists (~/wifi_lab/profiles.json).
170 pub profiles: crate::store::Profiles,238 pub profiles: crate::store::Profiles,
171 }239 }
172 240
@@ -260,11 +328,17 @@ impl AppRoot {
260 let hyb_max_input = cx.new(InputState::new_singleline);328 let hyb_max_input = cx.new(InputState::new_singleline);
261 hyb_max_input.update(cx, |input, cx| input.set_content("2", cx));329 hyb_max_input.update(cx, |input, cx| input.set_content("2", cx));
262 330
331+ // Focus the root view at startup so the window-level keybindings
332+ // (ctrl-q, ctrl-1..4) dispatch through it before any control
333+ // grabs focus. Rendered with `.track_focus` on the root div.
334+ let root_focus = cx.focus_handle();
335+ window.focus(&root_focus, cx);
336+
263 let mut this = AppRoot {337 let mut this = AppRoot {
264 state: AppState::new(&selected_iface),338 state: AppState::new(&selected_iface),
265 rx,339 rx,
266 tx,340 tx,
267- page: std::env::var("WIFILAB_PAGE")341+ page: std::env::var("WIFI_LAB_PAGE")
268 .ok()342 .ok()
269 .and_then(|p| Page::from_name(&p))343 .and_then(|p| Page::from_name(&p))
270 .unwrap_or(Page::Networks),344 .unwrap_or(Page::Networks),
@@ -278,7 +352,6 @@ impl AppRoot {
278 attacking_handshake: false,352 attacking_handshake: false,
279 attacking_pmkid: false,353 attacking_pmkid: false,
280 parked_channels: None,354 parked_channels: None,
281- crack_inflight: false,
282 crack_stop: None,355 crack_stop: None,
283 rainbow_stop: None,356 rainbow_stop: None,
284 last_session_save: Instant::now(),357 last_session_save: Instant::now(),
@@ -287,10 +360,10 @@ impl AppRoot {
287 crack_epoch: 0,360 crack_epoch: 0,
288 ap_sort: None,361 ap_sort: None,
289 client_sort: None,362 client_sort: None,
290- focus_handle: cx.focus_handle(),363+ focus_handle: root_focus,
291 iface_select,364 iface_select,
292 target_select: cx.new(|_cx| {365 target_select: cx.new(|_cx| {
293- let empty: Vec<(String, String)> = Vec::new();366+ let empty: Vec<(usize, String)> = Vec::new();
294 SelectState::new(select("cracker-target", "Crack target", empty))367 SelectState::new(select("cracker-target", "Crack target", empty))
295 }),368 }),
296 wordlist_input,369 wordlist_input,
@@ -315,58 +388,80 @@ impl AppRoot {
315 bench_running: false,388 bench_running: false,
316 import_busy: false,389 import_busy: false,
317 deauth_all_targets: 0,390 deauth_all_targets: 0,
318- profiles: match crate::store::load_profiles() {391+ // Mock mode is hermetic: it must never read the user's real
319- Ok(p) => p,392+ // on-disk state (labels, captures, profiles) — it exists for
320- Err(e) => {393+ // development and screenshots, and showing real network names
321- eprintln!("profiles: load failed, starting empty: {e:#}");394+ // there defeats the point.
322- crate::store::Profiles::default()395+ profiles: if is_mock {
396+ crate::store::Profiles::default()
397+ } else {
398+ match crate::store::load_profiles() {
399+ Ok(p) => p,
400+ Err(e) => {
401+ eprintln!("profiles: load failed, starting empty: {e:#}");
402+ crate::store::Profiles::default()
403+ }
323 }404 }
324 },405 },
325 };406 };
326- match crate::store::load() {407+ if !is_mock {
327- Ok(labels) => {408+ match crate::store::load() {
328- let n = labels.len();409+ Ok(labels) => {
329- this.state.labels = labels;410+ let n = labels.len();
330- this.state411+ this.state.labels = labels;
331- .push_log(format!("labels: {n} loaded from ~/wifilab/labels.json"));412+ this.state
413+ .push_log(format!("labels: {n} loaded from ~/wifi_lab/labels.json"));
414+ }
415+ Err(e) => this
416+ .state
417+ .push_log(format!("labels: load failed, starting empty: {e:#}")),
332 }418 }
333- Err(e) => this
334- .state
335- .push_log(format!("labels: load failed, starting empty: {e:#}")),
336 }419 }
337 // Restore previous captures so the cracker can keep working across420 // Restore previous captures so the cracker can keep working across
338 // restarts without re-running attacks.421 // restarts without re-running attacks.
339- match crate::store::load_captures() {422+ if !is_mock {
340- Ok(caps) => {423+ match crate::store::load_captures() {
341- let n = caps.len();424+ Ok(caps) => {
342- for cap in caps {425+ let n = caps.len();
343- match cap {426+ for cap in caps {
344- crate::store::StoredCapture::Handshake(h) => {427+ match cap {
345- this.state.apply(Event::HandshakeComplete(Box::new(h)));428+ crate::store::StoredCapture::Handshake(h) => {
346- }429+ // Route restored partials through the
347- crate::store::StoredCapture::Pmkid(p) => {430+ // partial path so they land in
348- this.state.apply(Event::PmkidCaptured(p));431+ // `state.partials` with the [partial]
432+ // picker marker (append-only restore keeps
433+ // stored index order).
434+ if h.partial {
435+ this.state.apply(Event::HandshakePartial(Box::new(h)));
436+ } else {
437+ this.state.apply(Event::HandshakeComplete(Box::new(h)));
438+ }
439+ }
440+ crate::store::StoredCapture::Pmkid(p) => {
441+ this.state.apply(Event::PmkidCaptured(p));
442+ }
349 }443 }
350 }444 }
445+ if n > 0 {
446+ this.state.push_log(format!(
447+ "captures: {n} restored from ~/wifi_lab/captures.jsonl"
448+ ));
449+ }
351 }450 }
352- if n > 0 {451+ Err(e) => this
353- this.state452+ .state
354- .push_log(format!("captures: {n} restored from ~/wifilab/captures.jsonl"));453+ .push_log(format!("captures: restore failed: {e:#}")),
355- }
356 }454 }
357- Err(e) => this
358- .state
359- .push_log(format!("captures: restore failed: {e:#}")),
360 }455 }
361 this.rebuild_target_select(cx);456 this.rebuild_target_select(cx);
362 if !is_mock {457 if !is_mock {
363 this.restore_crack_session();458 this.restore_crack_session();
364 }459 }
365 this.state.push_log(if is_mock {460 this.state.push_log(if is_mock {
366- "wifilab UI started (mock backend)".to_string()461+ "wifi_lab UI started (mock backend)".to_string()
367 } else {462 } else {
368 format!(463 format!(
369- "wifilab UI started (REAL backend, iface {selected_iface}) — Start capture spawns the privileged service (polkit) and brings up monitor mode"464+ "wifi_lab UI started (REAL backend, iface {selected_iface}) — Start capture spawns the privileged service (polkit) and brings up monitor mode"
370 )465 )
371 });466 });
372 467
@@ -445,7 +540,7 @@ impl AppRoot {
445 cx.notify();540 cx.notify();
446 } else {541 } else {
447 // NetworkManager fight: pin-to-connected-channel makes ONLY the542 // NetworkManager fight: pin-to-connected-channel makes ONLY the
448- // associated network (e.g. parafin) visible during the hop.543+ // associated network (e.g. testnet) visible during the hop.
449 if crate::iface::networkmanager_active() {544 if crate::iface::networkmanager_active() {
450 self.nm_active = true;545 self.nm_active = true;
451 self.state.push_log(546 self.state.push_log(
@@ -515,7 +610,8 @@ impl AppRoot {
515 if self.pending_toast.len() == 3 {610 if self.pending_toast.len() == 3 {
516 self.pending_toast.pop_front();611 self.pending_toast.pop_front();
517 }612 }
518- self.pending_toast.push_back(msg.into());613+ self.pending_toast
614+ .push_back(wrap_toast_text(&msg.into()).into());
519 }615 }
520 616
521 /// Drain every queued event, track handshake progress, refresh widgets617 /// Drain every queued event, track handshake progress, refresh widgets
@@ -532,17 +628,37 @@ impl AppRoot {
532 Event::HandshakeComplete(cap) => {628 Event::HandshakeComplete(cap) => {
533 self.hs_progress.remove(&(cap.ap, cap.client));629 self.hs_progress.remove(&(cap.ap, cap.client));
534 self.attacking_handshake = false;630 self.attacking_handshake = false;
535- if let Err(e) = crate::store::append_capture(631+ // Mock captures are fabrications — never write them into
536- &crate::store::StoredCapture::Handshake(cap.as_ref().clone()),632+ // the real capture store.
537- ) {633+ if !self.is_mock
634+ && let Err(e) = crate::store::append_capture(
635+ &crate::store::StoredCapture::Handshake(cap.as_ref().clone()),
636+ )
637+ {
638+ self.state.push_log(format!("capture save FAILED: {e:#}"));
639+ }
640+ }
641+ Event::HandshakePartial(cap) => {
642+ self.hs_progress.remove(&(cap.ap, cap.client));
643+ self.attacking_handshake = false;
644+ // Partial M2+M3 material is hashcat-exportable crack
645+ // material — persist it exactly like a complete
646+ // capture (the `partial` flag rides serde).
647+ if !self.is_mock
648+ && let Err(e) = crate::store::append_capture(
649+ &crate::store::StoredCapture::Handshake(cap.as_ref().clone()),
650+ )
651+ {
538 self.state.push_log(format!("capture save FAILED: {e:#}"));652 self.state.push_log(format!("capture save FAILED: {e:#}"));
539 }653 }
540 }654 }
541 Event::PmkidCaptured(cap) => {655 Event::PmkidCaptured(cap) => {
542 self.attacking_pmkid = false;656 self.attacking_pmkid = false;
543- if let Err(e) = crate::store::append_capture(657+ if !self.is_mock
544- &crate::store::StoredCapture::Pmkid(cap.clone()),658+ && let Err(e) = crate::store::append_capture(
545- ) {659+ &crate::store::StoredCapture::Pmkid(cap.clone()),
660+ )
661+ {
546 self.state.push_log(format!("capture save FAILED: {e:#}"));662 self.state.push_log(format!("capture save FAILED: {e:#}"));
547 }663 }
548 }664 }
@@ -553,7 +669,8 @@ impl AppRoot {
553 self.attacking_handshake = false;669 self.attacking_handshake = false;
554 self.attacking_pmkid = false;670 self.attacking_pmkid = false;
555 self.state.iface_running = false;671 self.state.iface_running = false;
556- self.crack_inflight = false;672+ // Crack jobs are independent UI-process threads —
673+ // `state.cracker.running` stays as the worker left it.
557 if let Some(svc) = self.service.take() {674 if let Some(svc) = self.service.take() {
558 svc.shutdown(); // reaps the corpse, restores iface675 svc.shutdown(); // reaps the corpse, restores iface
559 }676 }
@@ -590,10 +707,21 @@ impl AppRoot {
590 self.maybe_save_crack_session();707 self.maybe_save_crack_session();
591 }708 }
592 Event::CrackStopped { found } => {709 Event::CrackStopped { found } => {
593- self.crack_inflight = false;
594 self.crack_stop = None;710 self.crack_stop = None;
595 self.finalize_crack_session(*found);711 self.finalize_crack_session(*found);
596 }712 }
713+ // Backend failure (GPU lost, dispatch timeout, worker
714+ // panic): settle like a user-stop with room left — save
715+ // the resume position and arm the banner — but NEVER
716+ // clear the saved session; the run is resumable. The
717+ // AppState side (log line, running=false, activity
718+ // mirror) happens in `apply` below.
719+ Event::CrackError { .. } => {
720+ self.crack_stop = None;
721+ self.last_session_save = Instant::now();
722+ self.save_crack_session();
723+ self.state.cracker.active_attack = None;
724+ }
597 Event::RainbowBuilt { .. } => {725 Event::RainbowBuilt { .. } => {
598 self.rainbow_stop = None;726 self.rainbow_stop = None;
599 }727 }
@@ -602,11 +730,11 @@ impl AppRoot {
602 // Best-effort desktop notification; headless/no-D-Bus730 // Best-effort desktop notification; headless/no-D-Bus
603 // just drops the error.731 // just drops the error.
604 let _ = notify_rust::Notification::new()732 let _ = notify_rust::Notification::new()
605- .summary("wifilab: password found")733+ .summary("wifi_lab: password found")
606 .body(&format!("password recovered: {password}"))734 .body(&format!("password recovered: {password}"))
607 .show();735 .show();
608 }736 }
609- Event::CaptureImported(cap) => {737+ Event::CaptureImported(cap) if !self.is_mock => {
610 let stored = match cap {738 let stored = match cap {
611 crate::common::ImportedCapture::Handshake(h) => {739 crate::common::ImportedCapture::Handshake(h) => {
612 crate::store::StoredCapture::Handshake(h.as_ref().clone())740 crate::store::StoredCapture::Handshake(h.as_ref().clone())
@@ -636,24 +764,28 @@ impl AppRoot {
636 self.queue_toast(m);764 self.queue_toast(m);
637 }765 }
638 }766 }
767+ // Stale-client backstop sweep, ONCE per drain tick (not per
768+ // event — the per-event form allocated a full `clients` snapshot
769+ // at 10 Hz+ probe volumes). 100 ms cadence is far tighter than
770+ // the 60 s expiry, so ClientLost-equivalent removal stays
771+ // observably identical.
772+ self.state.sweep_stale_clients();
639 // Keep the target snapshot in lockstep with the live AP row (a773 // Keep the target snapshot in lockstep with the live AP row (a
640 // click-time-only snapshot goes stale: channel jumps, beacon774 // click-time-only snapshot goes stale: channel jumps, beacon
641 // counts, security updates). Also self-heals after service775 // counts, security updates). Also self-heals after service
642 // restarts, when only the live row exists.776 // restarts, when only the live row exists.
643- if let Some(live) = self777+ if let Some(live) = self.selected.and_then(|b| self.state.aps.get(&b).cloned()) {
644- .selected
645- .and_then(|b| self.state.aps.get(&b).cloned())
646- {
647 self.selected_ap = Some(live);778 self.selected_ap = Some(live);
648 }779 }
649 // Mock-only convenience: pre-select the first heard AP so the780 // Mock-only convenience: pre-select the first heard AP so the
650 // Attacks page shows its target card without a manual click —781 // Attacks page shows its target card without a manual click —
651 // invaluable for headless UI verification. Never in real mode.782 // invaluable for headless UI verification. Never in real mode.
652- if self.is_mock && self.selected.is_none() {783+ if self.is_mock
653- if let Some((&b, _)) = self.state.aps.first_key_value() {784+ && self.selected.is_none()
654- self.selected = Some(b);785+ && let Some((&b, _)) = self.state.aps.first_key_value()
655- self.selected_ap = self.state.aps.get(&b).cloned();786+ {
656- }787+ self.selected = Some(b);
788+ self.selected_ap = self.state.aps.get(&b).cloned();
657 }789 }
658 if captures_changed {790 if captures_changed {
659 self.rebuild_target_select(cx);791 self.rebuild_target_select(cx);
@@ -674,12 +806,12 @@ impl AppRoot {
674 self.save_crack_session();806 self.save_crack_session();
675 }807 }
676 808
677- /// Write the current run to ~/wifilab/crack-session.json. No-op when809+ /// Write the current run to ~/wifi_lab/crack-session.json. No-op when
678 /// nothing resumable is in flight (mock runs never persist).810 /// nothing resumable is in flight (mock runs never persist).
679 fn save_crack_session(&mut self) {811 fn save_crack_session(&mut self) {
680- let (Some(attack), Some(desc)) = (812+ let (Some(attack), Some(idx)) = (
681 self.state.cracker.active_attack.clone(),813 self.state.cracker.active_attack.clone(),
682- self.state.cracker.target.clone(),814+ self.state.cracker.target,
683 ) else {815 ) else {
684 return;816 return;
685 };817 };
@@ -687,27 +819,29 @@ impl AppRoot {
687 if done == 0 {819 if done == 0 {
688 return;820 return;
689 }821 }
690- let Some(idx) = self822+ // The target is already the capture index — no description-string
691- .state823+ // round trip (a rebuilt index space would never mis-key the run).
692- .capture_descs()
693- .iter()
694- .position(|d| *d == desc)
695- else {
696- return;
697- };
698 let Some(capture) = self.state.stored_capture_at(idx) else {824 let Some(capture) = self.state.stored_capture_at(idx) else {
699 return;825 return;
700 };826 };
701 let total = self.state.cracker.total;827 let total = self.state.cracker.total;
702- let session = crate::store::CrackSession { capture, attack, done, total };828+ let session = crate::store::CrackSession::new(capture, attack, done, total);
703 if let Err(e) = crate::store::save_session(&session) {829 if let Err(e) = crate::store::save_session(&session) {
704- self.state.push_log(format!("cracker: session save failed: {e:#}"));830+ self.state
831+ .push_log(format!("cracker: session save failed: {e:#}"));
705 return;832 return;
706 }833 }
707 // The just-saved run is resumable right now (same session or the834 // The just-saved run is resumable right now (same session or the
708 // next start): keep the banner in sync.835 // next start): keep the banner in sync.
836+ let target_desc = self
837+ .state
838+ .capture_descs()
839+ .into_iter()
840+ .nth(idx)
841+ .unwrap_or_default();
709 self.state.cracker.resume = Some(crate::ui::state::ResumeInfo {842 self.state.cracker.resume = Some(crate::ui::state::ResumeInfo {
710- target_desc: desc,843+ target_idx: idx,
844+ target_desc,
711 attack: session.attack,845 attack: session.attack,
712 done,846 done,
713 total,847 total,
@@ -722,7 +856,8 @@ impl AppRoot {
722 let exhausted = !found && total.is_some_and(|t| done >= t);856 let exhausted = !found && total.is_some_and(|t| done >= t);
723 if found || exhausted {857 if found || exhausted {
724 if let Err(e) = crate::store::clear_session() {858 if let Err(e) = crate::store::clear_session() {
725- self.state.push_log(format!("cracker: session clear failed: {e:#}"));859+ self.state
860+ .push_log(format!("cracker: session clear failed: {e:#}"));
726 }861 }
727 self.state.cracker.resume = None;862 self.state.cracker.resume = None;
728 } else if self.state.cracker.active_attack.is_some() {863 } else if self.state.cracker.active_attack.is_some() {
@@ -747,20 +882,23 @@ impl AppRoot {
747 }882 }
748 };883 };
749 let descs = self.state.capture_descs();884 let descs = self.state.capture_descs();
750- let hit = descs.iter().enumerate().find(|(i, _)| {885+ let hit = descs
751- self.state.stored_capture_at(*i).as_ref() == Some(&session.capture)886+ .iter()
752- });887+ .enumerate()
753- match hit.map(|(_, d)| d) {888+ .find(|(i, _)| self.state.stored_capture_at(*i).as_ref() == Some(&session.capture));
754- Some(d) => {889+ match hit {
890+ Some((idx, d)) => {
755 let done = session.done;891 let done = session.done;
756 self.state.cracker.resume = Some(crate::ui::state::ResumeInfo {892 self.state.cracker.resume = Some(crate::ui::state::ResumeInfo {
893+ target_idx: idx,
757 target_desc: d.clone(),894 target_desc: d.clone(),
758 attack: session.attack,895 attack: session.attack,
759 done,896 done,
760 total: session.total,897 total: session.total,
761 });898 });
762- self.state899+ self.state.push_log(format!(
763- .push_log(format!("cracker: resumable saved run restored ({d}, {done} tried)"));900+ "cracker: resumable saved run restored ({d}, {done} tried)"
901+ ));
764 }902 }
765 None => self903 None => self
766 .state904 .state
@@ -768,49 +906,51 @@ impl AppRoot {
768 }906 }
769 }907 }
770 908
771- /// The cracker target dropdown mirrors `state.capture_descs()`; rebuild909+ /// The cracker target dropdown mirrors `state.capture_descs()`; the
772- /// it whenever a handshake/PMKID arrives, keeping the current choice if910+ /// option VALUES are the stable capture indices (the description
773- /// it still exists. With no captures the select is disabled so its911+ /// strings are labels only, so selection never keys on regenerated
912+ /// display text). Indices are append-only (`capture_descs` is
913+ /// arrival-ordered), so a live selection survives new captures
914+ /// arriving mid-run. With no captures the select is disabled so its
774 /// (empty) popup cannot open.915 /// (empty) popup cannot open.
775 pub fn rebuild_target_select(&mut self, cx: &mut Context<Self>) {916 pub fn rebuild_target_select(&mut self, cx: &mut Context<Self>) {
776 let descs = self.state.capture_descs();917 let descs = self.state.capture_descs();
777- let keep = self918+ let n = descs.len();
778- .state919+ // Keep the current choice while its index is still in range.
779- .cracker920+ let keep = self.state.cracker.target.take().filter(|&i| i < n);
780- .target
781- .take()
782- .filter(|cur| descs.contains(cur));
783 let view = cx.entity();921 let view = cx.entity();
784 let mut builder = select(922 let mut builder = select(
785 "cracker-target",923 "cracker-target",
786 "Crack target",924 "Crack target",
787- descs.iter().map(|d| (d.clone(), d.clone())).collect::<Vec<_>>(),925+ descs.into_iter().enumerate().collect::<Vec<_>>(),
788 )926 )
789- .placeholder(if descs.is_empty() {927+ .placeholder(if n == 0 {
790 "no captures yet — capture a handshake or PMKID first"928 "no captures yet — capture a handshake or PMKID first"
791 } else {929 } else {
792 "Select a capture…"930 "Select a capture…"
793 })931 })
794- .disabled(descs.is_empty())932+ .disabled(n == 0)
795- .on_change(move |value, _window, cx| {933+ .on_change(move |idx, _window, cx| {
796 view.update(cx, |app, cx| {934 view.update(cx, |app, cx| {
797- app.state.cracker.target = Some(value);935+ app.state.cracker.target = Some(idx);
798 cx.notify();936 cx.notify();
799 });937 });
800 });938 });
801 if let Some(cur) = keep {939 if let Some(cur) = keep {
802- builder = builder.selected(cur.clone());940+ builder = builder.selected(cur);
803 self.state.cracker.target = Some(cur);941 self.state.cracker.target = Some(cur);
804 }942 }
805 self.target_select = cx.new(|_cx| SelectState::new(builder));943 self.target_select = cx.new(|_cx| SelectState::new(builder));
806 }944 }
807 945
808- fn nav_item(946+ /// Keyboard page switch (ctrl-1..4) — the same destination set the
809- &self,947+ /// nav-rail clicks use.
810- page: Page,948+ fn show_page(&mut self, page: Page, cx: &mut Context<Self>) {
811- view: &Entity<AppRoot>,949+ self.page = page;
812- cx: &App,950+ cx.notify();
813- ) -> gpui::Stateful<gpui::Div> {951+ }
952+
953+ fn nav_item(&self, page: Page, view: &Entity<AppRoot>, cx: &App) -> gpui::Stateful<gpui::Div> {
814 let theme = cx.theme().clone();954 let theme = cx.theme().clone();
815 let active = self.page == page;955 let active = self.page == page;
816 let view = view.clone();956 let view = view.clone();
@@ -864,7 +1004,7 @@ impl AppRoot {
864 )1004 )
865 // Stopping capture (or starting a new one) while a crack streams1005 // Stopping capture (or starting a new one) while a crack streams
866 // would kill the crack job: radio access is exclusive.1006 // would kill the crack job: radio access is exclusive.
867- .disabled(!self.is_mock && self.crack_inflight)1007+ .disabled(!self.is_mock && self.state.cracker.running)
868 .on_click({1008 .on_click({
869 let view = view.clone();1009 let view = view.clone();
870 move |_, _window, cx| {1010 move |_, _window, cx| {
@@ -892,7 +1032,12 @@ impl AppRoot {
892 .border_b_1()1032 .border_b_1()
893 .border_color(theme.border())1033 .border_color(theme.border())
894 .bg(theme.surface())1034 .bg(theme.surface())
895- .child(div().text_lg().font_weight(FontWeight::BOLD).child("wifilab"))1035+ .child(
1036+ div()
1037+ .text_lg()
1038+ .font_weight(FontWeight::BOLD)
1039+ .child("wifi_lab"),
1040+ )
896 .child(privilege)1041 .child(privilege)
897 .child(div().w(px(220.)).child(self.iface_select.clone()))1042 .child(div().w(px(220.)).child(self.iface_select.clone()))
898 .children(nm_badge)1043 .children(nm_badge)
@@ -982,9 +1127,26 @@ impl Render for AppRoot {
982 Page::Log => log_view::render(self, &view, _window, cx),1127 Page::Log => log_view::render(self, &view, _window, cx),
983 };1128 };
984 1129
1130+ // Window-level shortcuts (see [`bind_app_keys`]): handlers on the
1131+ // root div catch the actions wherever focus sits inside the
1132+ // window; `.track_focus` keeps the startup focus on the root.
985 div()1133 div()
986 .flex()1134 .flex()
987 .size_full()1135 .size_full()
1136+ .track_focus(&self.focus_handle)
1137+ .on_action(cx.listener(|_this, _: &QuitApp, _window, cx| cx.quit()))
1138+ .on_action(cx.listener(|this, _: &ShowNetworksPage, _window, cx| {
1139+ this.show_page(Page::Networks, cx);
1140+ }))
1141+ .on_action(cx.listener(|this, _: &ShowAttacksPage, _window, cx| {
1142+ this.show_page(Page::Attacks, cx);
1143+ }))
1144+ .on_action(cx.listener(|this, _: &ShowCrackerPage, _window, cx| {
1145+ this.show_page(Page::Cracker, cx);
1146+ }))
1147+ .on_action(cx.listener(|this, _: &ShowLogPage, _window, cx| {
1148+ this.show_page(Page::Log, cx);
1149+ }))
988 .bg(theme.bg())1150 .bg(theme.bg())
989 .text_color(theme.fg())1151 .text_color(theme.fg())
990 .child(nav)1152 .child(nav)
@@ -1001,3 +1163,36 @@ impl Render for AppRoot {
1001 .child(cx.toast_manager().clone())1163 .child(cx.toast_manager().clone())
1002 }1164 }
1003 }1165 }
1166+#[cfg(test)]
1167+mod tests {
1168+ use super::wrap_toast_text;
1169+
1170+ #[test]
1171+ fn toast_wrap_keeps_lines_within_box() {
1172+ let msg = "DEAUTH STORM: aa:bb:cc:dd:ee:ff → ff:ff:ff:ff:ff:ff x64";
1173+ let wrapped = wrap_toast_text(msg);
1174+ assert!(
1175+ wrapped.lines().all(|l| l.chars().count() <= 36),
1176+ "line over toast width:\n{wrapped}"
1177+ );
1178+ // Same words, same order — wrapping only inserts breaks.
1179+ assert_eq!(
1180+ wrapped.split_whitespace().collect::<Vec<_>>(),
1181+ msg.split_whitespace().collect::<Vec<_>>()
1182+ );
1183+ }
1184+
1185+ #[test]
1186+ fn toast_wrap_splits_unbreakable_tokens() {
1187+ let long = format!("error: couldn't open {}", "/very/long/path/".repeat(4));
1188+ for line in wrap_toast_text(&long).lines() {
1189+ assert!(line.chars().count() <= 36, "overlong line: {line:?}");
1190+ }
1191+ }
1192+
1193+ #[test]
1194+ fn toast_wrap_leaves_short_messages_alone() {
1195+ let msg = "captures: 3 restored";
1196+ assert_eq!(wrap_toast_text(msg), msg);
1197+ }
1198+}
src/ui/attacks.rsmodified+228 -115
@@ -39,18 +39,30 @@ fn hex(bytes: &[u8]) -> String {
39 /// fallback path under ./captures. Uses the crate's hc22000 formatting39 /// fallback path under ./captures. Uses the crate's hc22000 formatting
40 /// (single source of truth in [`crate::handshake`]).40 /// (single source of truth in [`crate::handshake`]).
41 fn export_hc22000(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {41 fn export_hc22000(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
42- let (lines, lossless_note) = {42+ let (lines, total) = {
43 let app = view.read(cx);43 let app = view.read(cx);
44 let mut lines: Vec<String> = app44 let mut lines: Vec<String> = app
45 .state45 .state
46 .handshakes46 .handshakes
47 .iter()47 .iter()
48 .map(crate::handshake::handshake_hc22000)48 .map(crate::handshake::handshake_hc22000)
49+ // Partial M2+M3 captures export too (hashcat m22000 accepts
50+ // them via the trailing 02 message-pair field). Partials
51+ // also join the normal capture list, so the sort/dedup
52+ // below keeps doubles out of the file.
53+ .chain(
54+ app.state
55+ .partials
56+ .iter()
57+ .map(crate::handshake::handshake_hc22000),
58+ )
49 .chain(app.state.pmkids.iter().map(crate::handshake::pmkid_hc22000))59 .chain(app.state.pmkids.iter().map(crate::handshake::pmkid_hc22000))
50 .collect();60 .collect();
51 lines.sort_unstable();61 lines.sort_unstable();
52 lines.dedup();62 lines.dedup();
53- (lines, app.state.handshakes.len() + app.state.pmkids.len())63+ // Log line counts what actually lands in the file (deduped).
64+ let total = lines.len();
65+ (lines, total)
54 };66 };
55 if lines.is_empty() {67 if lines.is_empty() {
56 view.update(cx, |app, cx| {68 view.update(cx, |app, cx| {
@@ -60,7 +72,7 @@ fn export_hc22000(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::A
60 return;72 return;
61 }73 }
62 74
63- let suggested = format!("wifilab-{}.hc22000", unix_secs());75+ let suggested = format!("wifi_lab-{}.hc22000", unix_secs());
64 let prompt = cx.prompt_for_new_path(Path::new("./captures"), Some(&suggested));76 let prompt = cx.prompt_for_new_path(Path::new("./captures"), Some(&suggested));
65 let body = lines.join("\n") + "\n";77 let body = lines.join("\n") + "\n";
66 let weak = view.downgrade();78 let weak = view.downgrade();
@@ -79,9 +91,11 @@ fn export_hc22000(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::A
79 let _ = std::fs::create_dir_all(parent);91 let _ = std::fs::create_dir_all(parent);
80 }92 }
81 match std::fs::write(&path, &body) {93 match std::fs::write(&path, &body) {
82- Ok(()) => app94+ Ok(()) => app.state.push_log(format!(
83- .state95+ "export: {} captures → {}",
84- .push_log(format!("export: {} captures → {}", lossless_note, path.display())),96+ total,
97+ path.display()
98+ )),
85 Err(e) => app99 Err(e) => app
86 .state100 .state
87 .push_log(format!("export FAILED: {e} ({})", path.display())),101 .push_log(format!("export FAILED: {e} ({})", path.display())),
@@ -108,7 +122,7 @@ fn export_pcap(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App)
108 return;122 return;
109 }123 }
110 124
111- let suggested = format!("wifilab-{}.pcap", unix_secs());125+ let suggested = format!("wifi_lab-{}.pcap", unix_secs());
112 let prompt = cx.prompt_for_new_path(Path::new("./captures"), Some(&suggested));126 let prompt = cx.prompt_for_new_path(Path::new("./captures"), Some(&suggested));
113 let weak = view.downgrade();127 let weak = view.downgrade();
114 cx.spawn(async move |cx| {128 cx.spawn(async move |cx| {
@@ -211,7 +225,10 @@ fn advisor(app: &AppRoot, ap: &crate::common::AccessPoint) -> (&'static str, boo
211 _ => {}225 _ => {}
212 }226 }
213 if !akms.is_empty() && akms.contains(&Akm::Owe) && !akms.contains(&Akm::Psk) {227 if !akms.is_empty() && akms.contains(&Akm::Owe) && !akms.contains(&Akm::Psk) {
214- return ("advice: OWE (enhanced open) — no password to recover", false);228+ return (
229+ "advice: OWE (enhanced open) — no password to recover",
230+ false,
231+ );
215 }232 }
216 let (hs, pm) = material_for(app, ap);233 let (hs, pm) = material_for(app, ap);
217 if hs + pm > 0 {234 if hs + pm > 0 {
@@ -377,8 +394,7 @@ fn pmkid_attack(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App
377 394
378 if !app.is_mock {395 if !app.is_mock {
379 let Some((ap, channel, essid)) = target_info(app) else {396 let Some((ap, channel, essid)) = target_info(app) else {
380- app.state397+ app.state.push_log("pmkid: target AP not in scan table yet");
381- .push_log("pmkid: target AP not in scan table yet");
382 app.attacking_pmkid = false;398 app.attacking_pmkid = false;
383 cx.notify();399 cx.notify();
384 return;400 return;
@@ -474,11 +490,34 @@ fn park_channels(app: &mut AppRoot, channels: &[u8]) {
474 fresh_spool: false,490 fresh_spool: false,
475 });491 });
476 app.parked_channels = Some(want.clone());492 app.parked_channels = Some(want.clone());
477- app.state493+ app.state.push_log(format!(
478- .push_log(format!("scanner parked on ch [{}] (attack mode)", want.iter().map(u8::to_string).collect::<Vec<_>>().join(", ")));494+ "scanner parked on ch [{}] (attack mode)",
495+ want.iter()
496+ .map(u8::to_string)
497+ .collect::<Vec<_>>()
498+ .join(", ")
499+ ));
479 }500 }
480 }501 }
481 502
503+/// Parse the trimmed deauth round-count field. Rejects unparseable or
504+/// zero input with a ready-to-log message (the blast must NOT fire on
505+/// it): the pre-fix code silently fired 64 rounds at a live target via
506+/// `parse().unwrap_or(64)` — no validation error on a destructive
507+/// button. Mirrors the cracker page's length-field rejection. Valid
508+/// numbers pass through unclamped; callers clamp to `u32::MAX` as
509+/// before (64 rounds ≈ 2 s of airtime per direction — short bursts
510+/// slip entirely under a power-save client's doze window).
511+fn parse_deauth_count(raw: &str) -> Result<u64, String> {
512+ let count: u64 = raw
513+ .parse()
514+ .map_err(|_| format!("deauth: bad round count '{raw}' — nothing sent"))?;
515+ if count == 0 {
516+ return Err("deauth: round count must be at least 1 — nothing sent".to_string());
517+ }
518+ Ok(count)
519+}
520+
482 /// Deauth `target` (a station, or [`MacAddr::BROADCAST`] for the whole521 /// Deauth `target` (a station, or [`MacAddr::BROADCAST`] for the whole
483 /// net) against the selected AP, `count` rounds from the count field.522 /// net) against the selected AP, `count` rounds from the count field.
484 /// Real mode blasts from the service's own socket; mock mode fabricates523 /// Real mode blasts from the service's own socket; mock mode fabricates
@@ -489,16 +528,14 @@ fn do_deauth(app: &mut AppRoot, cx: &mut Context<AppRoot>, target: MacAddr) {
489 cx.notify();528 cx.notify();
490 return;529 return;
491 };530 };
492- let count64: u64 = app531+ let count64: u64 = match parse_deauth_count(app.deauth_input.read(cx).content().trim()) {
493- .deauth_input532+ Ok(count) => count,
494- .read(cx)533+ Err(msg) => {
495- .content()534+ app.state.push_log(msg);
496- .trim()535+ cx.notify();
497- .parse()536+ return;
498- // 64 rounds ≈ 2 s of airtime per direction — short bursts537+ }
499- // (16 × 15 ms ≈ 0.25 s) slip entirely under a power-save client's538+ };
500- // doze window and land nothing (verified on lab mt7922).
501- .unwrap_or(64);
502 539
503 if !app.is_mock {540 if !app.is_mock {
504 if !app.state.iface_running {541 if !app.state.iface_running {
@@ -539,13 +576,20 @@ fn do_deauth(app: &mut AppRoot, cx: &mut Context<AppRoot>, target: MacAddr) {
539 app.state.push_log(format!(576 app.state.push_log(format!(
540 "deauth: no capture running — auto-armed handshake capture on {essid}"577 "deauth: no capture running — auto-armed handshake capture on {essid}"
541 ));578 ));
542- app.service579+ // Presence was checked at the top of this branch, but keep
543- .as_ref()580+ // the dependency local: a reordered closure must degrade to
544- .expect("service presence checked above")581+ // a log line, never a panic abort.
545- .cmd(&Cmd::CaptureHs {582+ let Some(svc) = app.service.as_ref() else {
546- targets: aps.clone(),583+ app.attacking_handshake = false;
547- essid: essid.clone(),584+ app.state
548- });585+ .push_log("deauth: service disconnected — capture not armed");
586+ cx.notify();
587+ return;
588+ };
589+ svc.cmd(&Cmd::CaptureHs {
590+ targets: aps.clone(),
591+ essid: essid.clone(),
592+ });
549 }593 }
550 let count = count64.min(u32::MAX as u64) as u32;594 let count = count64.min(u32::MAX as u64) as u32;
551 let kind = if target.is_broadcast() {595 let kind = if target.is_broadcast() {
@@ -556,12 +600,23 @@ fn do_deauth(app: &mut AppRoot, cx: &mut Context<AppRoot>, target: MacAddr) {
556 app.state.push_log(format!(600 app.state.push_log(format!(
557 "deauth: {count} rounds → {kind} ({} bssid(s), ch [{}])",601 "deauth: {count} rounds → {kind} ({} bssid(s), ch [{}])",
558 aps.len(),602 aps.len(),
559- channels.iter().map(u8::to_string).collect::<Vec<_>>().join(", ")603+ channels
604+ .iter()
605+ .map(u8::to_string)
606+ .collect::<Vec<_>>()
607+ .join(", ")
560 ));608 ));
561- app.service609+ let Some(svc) = app.service.as_ref() else {
562- .as_ref()610+ app.state
563- .expect("service presence checked above")611+ .push_log("deauth: service disconnected — blast not sent");
564- .cmd(&Cmd::Deauth { aps: aps.clone(), target, count });612+ cx.notify();
613+ return;
614+ };
615+ svc.cmd(&Cmd::Deauth {
616+ aps: aps.clone(),
617+ target,
618+ count,
619+ });
565 // Optimistic DOWN marking: monitor-mode TX never loops back to620 // Optimistic DOWN marking: monitor-mode TX never loops back to
566 // the scanner socket (verified: PACKET_OUTGOING never surfaces on621 // the scanner socket (verified: PACKET_OUTGOING never surfaces on
567 // mt7921e injection), so the scanner can't observe our own blast622 // mt7921e injection), so the scanner can't observe our own blast
@@ -664,13 +719,14 @@ fn deauth_all(view: &Entity<AppRoot>, cx: &mut gpui::App) {
664 cx.notify();719 cx.notify();
665 return;720 return;
666 }721 }
667- let count64: u64 = app722+ let count64: u64 = match parse_deauth_count(app.deauth_input.read(cx).content().trim()) {
668- .deauth_input723+ Ok(count) => count,
669- .read(cx)724+ Err(msg) => {
670- .content()725+ app.state.push_log(msg);
671- .trim()726+ cx.notify();
672- .parse()727+ return;
673- .unwrap_or(64);728+ }
729+ };
674 730
675 if !app.is_mock {731 if !app.is_mock {
676 if !app.state.iface_running || app.service.is_none() {732 if !app.state.iface_running || app.service.is_none() {
@@ -694,28 +750,35 @@ fn deauth_all(view: &Entity<AppRoot>, cx: &mut gpui::App) {
694 "deauth-all: no capture running — auto-armed handshake capture on {essid}"750 "deauth-all: no capture running — auto-armed handshake capture on {essid}"
695 ));751 ));
696 let aps = sibling_targets(app, &essid);752 let aps = sibling_targets(app, &essid);
697- app.service753+ let Some(svc) = app.service.as_ref() else {
698- .as_ref()754+ app.attacking_handshake = false;
699- .expect("service presence checked above")755+ app.state
700- .cmd(&Cmd::CaptureHs {756+ .push_log("deauth-all: service disconnected — capture not armed");
701- targets: aps,757+ cx.notify();
702- essid,758+ return;
703- });759+ };
760+ svc.cmd(&Cmd::CaptureHs {
761+ targets: aps,
762+ essid,
763+ });
704 }764 }
705 let count = count64.min(u32::MAX as u64) as u32;765 let count = count64.min(u32::MAX as u64) as u32;
706 app.state.push_log(format!(766 app.state.push_log(format!(
707 "deauth-all: {count} rounds → {} clients of {ap} (ch {channel})",767 "deauth-all: {count} rounds → {} clients of {ap} (ch {channel})",
708 targets.len()768 targets.len()
709 ));769 ));
710- app.service770+ let Some(svc) = app.service.as_ref() else {
711- .as_ref()771+ app.state
712- .expect("service presence checked above")772+ .push_log("deauth-all: service disconnected — blast not sent");
713- .cmd(&Cmd::DeauthAll {773+ cx.notify();
714- ap,774+ return;
715- channel,775+ };
716- targets: targets.clone(),776+ svc.cmd(&Cmd::DeauthAll {
717- count,777+ ap,
718- });778+ channel,
779+ targets: targets.clone(),
780+ count,
781+ });
719 // Optimistic DOWN marking (see do_deauth).782 // Optimistic DOWN marking (see do_deauth).
720 for cl in app.state.clients.values_mut() {783 for cl in app.state.clients.values_mut() {
721 if targets.contains(&cl.mac) {784 if targets.contains(&cl.mac) {
@@ -759,13 +822,11 @@ fn handshake_card(hs: &HandshakeCapture, crackable: bool) -> gpuikit::elements::
759 .gap_1()822 .gap_1()
760 .child(kv("key version", format!("{}", hs.key_ver)))823 .child(kv("key version", format!("{}", hs.key_ver)))
761 .child(kv("anonce", hex(&hs.anonce[..8])))824 .child(kv("anonce", hex(&hs.anonce[..8])))
762- .child(825+ .child(h_stack().gap_2().child(if crackable {
763- h_stack().gap_2().child(if crackable {826+ badge("crackable").secondary()
764- badge("crackable").secondary()827+ } else {
765- } else {828+ badge("partial")
766- badge("partial")829+ }))
767- }),
768- )
769 .into_any_element(),830 .into_any_element(),
770 )831 )
771 }832 }
@@ -825,7 +886,10 @@ pub fn render(
825 .get(&c)886 .get(&c)
826 .map(|l| format!(" “{l}”"))887 .map(|l| format!(" “{l}”"))
827 .unwrap_or_default();888 .unwrap_or_default();
828- text(format!("client: {c}{lbl}")).code().small().into_any_element()889+ text(format!("client: {c}{lbl}"))
890+ .code()
891+ .small()
892+ .into_any_element()
829 });893 });
830 v_stack()894 v_stack()
831 .gap_2()895 .gap_2()
@@ -858,8 +922,11 @@ pub fn render(
858 ap.security,922 ap.security,
859 ))923 ))
860 .children((!akm_join.is_empty()).then(|| small(akm_join)))924 .children((!akm_join.is_empty()).then(|| small(akm_join)))
861- .children((siblings > 1)925+ .children(
862- .then(|| badge(format!("dual-band x{siblings}")).secondary())),926+ (siblings > 1).then(|| {
927+ badge(format!("dual-band x{siblings}")).secondary()
928+ }),
929+ ),
863 )930 )
864 .child(931 .child(
865 h_stack()932 h_stack()
@@ -880,6 +947,18 @@ pub fn render(
880 "material for this AP family: {hs_n} handshake(s) · {pm_n} PMKID(s)"947 "material for this AP family: {hs_n} handshake(s) · {pm_n} PMKID(s)"
881 )))948 )))
882 .children(client_line)949 .children(client_line)
950+ // Every risk tag, unabridged — the Networks
951+ // page's FLAGS column collapses overflow into
952+ // `+N`, this is where the full list is read.
953+ .children({
954+ let tags = crate::ui::networks::risk_tags(ap, &app.state.rogue_ssids);
955+ (!tags.is_empty()).then(|| {
956+ div().text_xs().text_color(theme.warning()).child(format!(
957+ "risk: {}",
958+ tags.iter().map(|t| t.label).collect::<Vec<_>>().join(", ")
959+ ))
960+ })
961+ })
883 .child(962 .child(
884 div()963 div()
885 .text_xs()964 .text_xs()
@@ -972,7 +1051,8 @@ pub fn render(
972 .child(text_field(&app.deauth_input, cx).placeholder("count")),1051 .child(text_field(&app.deauth_input, cx).placeholder("count")),
973 )1052 )
974 .when(hs_running || pm_running, |el| {1053 .when(hs_running || pm_running, |el| {
975- el.child(loading_indicator().small()).child(small("working…"))1054+ el.child(loading_indicator().small())
1055+ .child(small("working…"))
976 })1056 })
977 .when(not_running, |el| {1057 .when(not_running, |el| {
978 el.child(small("start capture first to enable attacks"))1058 el.child(small("start capture first to enable attacks"))
@@ -1041,18 +1121,9 @@ pub fn render(
1041 .child(crate::ui::networks::vendor_of(&mac)),1121 .child(crate::ui::networks::vendor_of(&mac)),
1042 ),1122 ),
1043 )1123 )
1044- .children(1124+ .children(app.state.labels.get(&mac).map(|l| small(format!("“{l}”"))))
1045- app.state1125+ .children(ident.map(|(gid, conf)| {
1046- .labels1126+ let n = app.state.ident_groups.get(&gid).map_or(1, |ms| ms.len());
1047- .get(&mac)
1048- .map(|l| small(format!("“{l}”"))),
1049- )
1050- .children(ident.and_then(|(gid, conf)| {
1051- let n = app
1052- .state
1053- .ident_groups
1054- .get(&gid)
1055- .map_or(1, |ms| ms.len());
1056 let mut el = div()1127 let mut el = div()
1057 .w(px(90.))1128 .w(px(90.))
1058 .text_xs()1129 .text_xs()
@@ -1062,7 +1133,7 @@ pub fn render(
1062 } else {1133 } else {
1063 el = el.text_color(theme.fg_muted());1134 el = el.text_color(theme.fg_muted());
1064 }1135 }
1065- Some(el)1136+ el
1066 }))1137 }))
1067 .child(1138 .child(
1068 div()1139 div()
@@ -1070,18 +1141,22 @@ pub fn render(
1070 .text_xs()1141 .text_xs()
1071 .child(format!("{} dBm", cl.rssi_dbm)),1142 .child(format!("{} dBm", cl.rssi_dbm)),
1072 )1143 )
1073- .child(div().w(px(60.)).text_xs().child(format!(1144+ .child(
1074- "{} fr",1145+ div()
1075- cl.frames1146+ .w(px(60.))
1076- )))1147+ .text_xs()
1148+ .child(format!("{} fr", cl.frames)),
1149+ )
1077 .child(1150 .child(
1078 div()1151 div()
1079 .w(px(50.))1152 .w(px(50.))
1080 .text_xs()1153 .text_xs()
1081 .child(crate::ui::networks::age(cl.last_seen_ms)),1154 .child(crate::ui::networks::age(cl.last_seen_ms)),
1082 )1155 )
1083- .children((ap_of.is_none())1156+ .children(
1084- .then(|| small("AP unmapped — treating as target's station")))1157+ (ap_of.is_none())
1158+ .then(|| small("AP unmapped — treating as target's station")),
1159+ )
1085 .child(div().flex_1())1160 .child(div().flex_1())
1086 .child(1161 .child(
1087 button(1162 button(
@@ -1097,11 +1172,12 @@ pub fn render(
1097 .collect();1172 .collect();
1098 1173
1099 let body = if rows.is_empty() {1174 let body = if rows.is_empty() {
1100- div().child(small(1175+ div()
1101- "no stations seen on this AP yet — click any client row on the Networks page \1176+ .child(small(
1177+ "no stations seen on this AP yet — click any client row on the Networks page \
1102 to target it here anyway",1178 to target it here anyway",
1103- ))1179+ ))
1104- .into_any_element()1180+ .into_any_element()
1105 } else {1181 } else {
1106 v_stack().gap_1().children(rows).into_any_element()1182 v_stack().gap_1().children(rows).into_any_element()
1107 };1183 };
@@ -1131,8 +1207,15 @@ pub fn render(
1131 .iter()1207 .iter()
1132 .filter(|line| {1208 .filter(|line| {
1133 [1209 [
1134- "deauth", "handshake", "pmkid", "4-way", "scanner parked", "ERROR", "PASSWORD",1210+ "deauth",
1135- "target selected", "client selected",1211+ "handshake",
1212+ "pmkid",
1213+ "4-way",
1214+ "scanner parked",
1215+ "ERROR",
1216+ "PASSWORD",
1217+ "target selected",
1218+ "client selected",
1136 ]1219 ]
1137 .iter()1220 .iter()
1138 .any(|p| line.starts_with(p))1221 .any(|p| line.starts_with(p))
@@ -1151,15 +1234,10 @@ pub fn render(
1151 .p_4()1234 .p_4()
1152 .child(target_block)1235 .child(target_block)
1153 .when(sae, |el| {1236 .when(sae, |el| {
1154- el.child(1237+ el.child(div().text_xs().text_color(theme.warning()).child(
1155- div()1238+ "SAE-only AP — no offline-crackable handshake or PMKID \
1156- .text_xs()
1157- .text_color(theme.warning())
1158- .child(
1159- "SAE-only AP — no offline-crackable handshake or PMKID \
1160 (WPA3 transition APs with PSK AKM are fine)",1239 (WPA3 transition APs with PSK AKM are fine)",
1161- ),1240+ ))
1162- )
1163 })1241 })
1164 .child(actions)1242 .child(actions)
1165 .children(progress_cards)1243 .children(progress_cards)
@@ -1176,18 +1254,14 @@ pub fn render(
1176 app.state.pmkids.len()1254 app.state.pmkids.len()
1177 )))1255 )))
1178 .child(div().flex_1())1256 .child(div().flex_1())
1179- .child(1257+ .child(button("btn-export-pcap", "Export .pcap").on_click({
1180- button("btn-export-pcap", "Export .pcap").on_click({1258+ let view = view.clone();
1181- let view = view.clone();1259+ move |_, window, cx| export_pcap(&view, window, cx)
1182- move |_, window, cx| export_pcap(&view, window, cx)1260+ }))
1183- }),1261+ .child(button("btn-export", "Export .hc22000").on_click({
1184- )1262+ let view = view.clone();
1185- .child(1263+ move |_, window, cx| export_hc22000(&view, window, cx)
1186- button("btn-export", "Export .hc22000").on_click({1264+ })),
1187- let view = view.clone();
1188- move |_, window, cx| export_hc22000(&view, window, cx)
1189- }),
1190- ),
1191 );1265 );
1192 1266
1193 let cards: Vec<gpui::AnyElement> = app1267 let cards: Vec<gpui::AnyElement> = app
@@ -1195,7 +1269,12 @@ pub fn render(
1195 .handshakes1269 .handshakes
1196 .iter()1270 .iter()
1197 .map(|hs| handshake_card(hs, true).into_any_element())1271 .map(|hs| handshake_card(hs, true).into_any_element())
1198- .chain(app.state.pmkids.iter().map(|pm| pmkid_card(pm).into_any_element()))1272+ .chain(
1273+ app.state
1274+ .pmkids
1275+ .iter()
1276+ .map(|pm| pmkid_card(pm).into_any_element()),
1277+ )
1199 .collect();1278 .collect();
1200 if cards.is_empty() {1279 if cards.is_empty() {
1201 page = page.child(small("nothing captured yet — run an attack"));1280 page = page.child(small("nothing captured yet — run an attack"));
@@ -1205,7 +1284,8 @@ pub fn render(
1205 1284
1206 page = page1285 page = page
1207 .child(gpuikit::elements::separator::separator())1286 .child(gpuikit::elements::separator::separator())
1208- .child(h3("Activity")).child(if activity.is_empty() {1287+ .child(h3("Activity"))
1288+ .child(if activity.is_empty() {
1209 small("nothing yet — attack output appears here (full history on the Log page)")1289 small("nothing yet — attack output appears here (full history on the Log page)")
1210 .into_any_element()1290 .into_any_element()
1211 } else {1291 } else {
@@ -1226,3 +1306,36 @@ pub fn render(
1226 1306
1227 page.text_color(theme.fg())1307 page.text_color(theme.fg())
1228 }1308 }
1309+
1310+#[cfg(test)]
1311+mod tests {
1312+ use super::parse_deauth_count;
1313+
1314+ #[test]
1315+ fn deauth_count_valid_numbers_pass_through() {
1316+ assert_eq!(parse_deauth_count("16"), Ok(16));
1317+ assert_eq!(parse_deauth_count("1"), Ok(1));
1318+ // Overlong values parse fine; callers clamp to u32::MAX.
1319+ assert_eq!(parse_deauth_count("42949672960"), Ok(42949672960));
1320+ }
1321+
1322+ #[test]
1323+ fn deauth_count_garbage_is_rejected_not_defaulted() {
1324+ // Regression: unparseable input used to fall through
1325+ // `.parse().unwrap_or(64)` and fire 64 rounds at a live target
1326+ // with no validation error.
1327+ assert!(parse_deauth_count("abc").is_err());
1328+ assert!(parse_deauth_count("").is_err());
1329+ assert!(parse_deauth_count("6.4").is_err());
1330+ assert!(parse_deauth_count("-4").is_err());
1331+ assert!(parse_deauth_count("abc").unwrap_err().contains("'abc'"));
1332+ }
1333+
1334+ #[test]
1335+ fn deauth_count_zero_is_rejected_as_noop() {
1336+ // 0 rounds is a silent no-op on a destructive button — reject
1337+ // with a message instead of "sending" nothing.
1338+ let err = parse_deauth_count("0").unwrap_err();
1339+ assert!(err.contains("at least 1"));
1340+ }
1341+}
src/ui/cracker.rsmodified+505 -221
@@ -11,7 +11,7 @@
11 //! ignored there).11 //! ignored there).
12 12
13 use std::path::PathBuf;13 use std::path::PathBuf;
14-use std::sync::atomic::Ordering;14+use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
15 use std::time::Duration;15 use std::time::Duration;
16 16
17 use gpui::{17 use gpui::{
@@ -34,7 +34,7 @@ use crate::ui::app::AppRoot;
34 const WORDLIST_TOTAL: u64 = 1_000_000;34 const WORDLIST_TOTAL: u64 = 1_000_000;
35 /// Mock GPU throughput (guesses/second).35 /// Mock GPU throughput (guesses/second).
36 const MOCK_HPS: f64 = 1_250_000.0;36 const MOCK_HPS: f64 = 1_250_000.0;
37-const MOCK_PASSWORD: &str = "parafin2024!";37+const MOCK_PASSWORD: &str = "testnet2024!";
38 /// Label for the backend column: real runs detect GPU-vs-CPU inside the38 /// Label for the backend column: real runs detect GPU-vs-CPU inside the
39 /// worker and log it ("cracker: GPU backend: … / CPU fallback").39 /// worker and log it ("cracker: GPU backend: … / CPU fallback").
40 const fn backend_label(is_mock: bool) -> &'static str {40 const fn backend_label(is_mock: bool) -> &'static str {
@@ -80,7 +80,10 @@ fn fmt_worst_case(done: u64, hps: f64, total: Option<u64>) -> Option<String> {
80 if hps <= 0.0 || done >= t {80 if hps <= 0.0 || done >= t {
81 return None;81 return None;
82 }82 }
83- Some(format!("worst case left: ~{}", fmt_dur((t - done) as f64 / hps)))83+ Some(format!(
84+ "worst case left: ~{}",
85+ fmt_dur((t - done) as f64 / hps)
86+ ))
84 }87 }
85 88
86 /// Build the [`Attack`] selected by `app.attack_mode` from the page's89 /// Build the [`Attack`] selected by `app.attack_mode` from the page's
@@ -105,9 +108,8 @@ fn selected_attack(app: &mut AppRoot, cx: &mut gpui::App) -> Option<Attack> {
105 &custom,108 &custom,
106 );109 );
107 if charset.is_empty() {110 if charset.is_empty() {
108- app.state.push_log(111+ app.state
109- "cracker: empty charset — pick a preset chip or type custom chars",112+ .push_log("cracker: empty charset — pick a preset chip or type custom chars");
110- );
111 return None;113 return None;
112 }114 }
113 let min_s = app.len_min_input.read(cx).content().trim().to_string();115 let min_s = app.len_min_input.read(cx).content().trim().to_string();
@@ -115,18 +117,25 @@ fn selected_attack(app: &mut AppRoot, cx: &mut gpui::App) -> Option<Attack> {
115 let min = match min_s.parse::<usize>() {117 let min = match min_s.parse::<usize>() {
116 Ok(v) => v,118 Ok(v) => v,
117 Err(_) => {119 Err(_) => {
118- app.state.push_log(format!("cracker: bad min length '{min_s}'"));120+ app.state
121+ .push_log(format!("cracker: bad min length '{min_s}'"));
119 return None;122 return None;
120 }123 }
121 };124 };
122 let max = match max_s.parse::<usize>() {125 let max = match max_s.parse::<usize>() {
123 Ok(v) => v,126 Ok(v) => v,
124 Err(_) => {127 Err(_) => {
125- app.state.push_log(format!("cracker: bad max length '{max_s}'"));128+ app.state
129+ .push_log(format!("cracker: bad max length '{max_s}'"));
126 return None;130 return None;
127 }131 }
128 };132 };
129- Some(Attack::Bruteforce { charset, min, max, freq_order: app.freq_order })133+ Some(Attack::Bruteforce {
134+ charset,
135+ min,
136+ max,
137+ freq_order: app.freq_order,
138+ })
130 }139 }
131 "rules" => {140 "rules" => {
132 let wl = app.wordlist_input.read(cx).content().trim().to_string();141 let wl = app.wordlist_input.read(cx).content().trim().to_string();
@@ -165,9 +174,8 @@ fn selected_attack(app: &mut AppRoot, cx: &mut gpui::App) -> Option<Attack> {
165 &custom,174 &custom,
166 );175 );
167 if charset.is_empty() {176 if charset.is_empty() {
168- app.state.push_log(177+ app.state
169- "cracker: empty charset — pick a preset chip or type custom chars",178+ .push_log("cracker: empty charset — pick a preset chip or type custom chars");
170- );
171 return None;179 return None;
172 }180 }
173 let min_s = app.hyb_min_input.read(cx).content().trim().to_string();181 let min_s = app.hyb_min_input.read(cx).content().trim().to_string();
@@ -175,14 +183,16 @@ fn selected_attack(app: &mut AppRoot, cx: &mut gpui::App) -> Option<Attack> {
175 let min = match min_s.parse::<usize>() {183 let min = match min_s.parse::<usize>() {
176 Ok(v) => v.clamp(1, 4),184 Ok(v) => v.clamp(1, 4),
177 Err(_) => {185 Err(_) => {
178- app.state.push_log(format!("cracker: bad hybrid min '{min_s}'"));186+ app.state
187+ .push_log(format!("cracker: bad hybrid min '{min_s}'"));
179 return None;188 return None;
180 }189 }
181 };190 };
182 let max = match max_s.parse::<usize>() {191 let max = match max_s.parse::<usize>() {
183 Ok(v) => v.clamp(1, 4),192 Ok(v) => v.clamp(1, 4),
184 Err(_) => {193 Err(_) => {
185- app.state.push_log(format!("cracker: bad hybrid max '{max_s}'"));194+ app.state
195+ .push_log(format!("cracker: bad hybrid max '{max_s}'"));
186 return None;196 return None;
187 }197 }
188 };198 };
@@ -228,14 +238,23 @@ fn selected_attack(app: &mut AppRoot, cx: &mut gpui::App) -> Option<Attack> {
228 /// Mock mode: a deterministic generator drives the SAME event sequence.238 /// Mock mode: a deterministic generator drives the SAME event sequence.
229 fn start(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {239 fn start(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
230 view.update(cx, |app, cx| {240 view.update(cx, |app, cx| {
231- if app.crack_inflight || app.state.cracker.running || app.bench_running {241+ if app.state.cracker.running || app.bench_running {
232 return;242 return;
233 }243 }
234- let Some(desc) = app.state.cracker.target.clone() else {244+ let Some(idx) = app.state.cracker.target else {
235 app.state.push_log("cracker: no target selected");245 app.state.push_log("cracker: no target selected");
236 cx.notify();246 cx.notify();
237 return;247 return;
238 };248 };
249+ // The index addresses `capture_descs()`/`crack_target_at()`: no
250+ // string re-resolution. A stale index (capture removed since the
251+ // dropdown rebuilt) is the "capture no longer exists" guard.
252+ let Some(desc) = app.state.capture_descs().get(idx).cloned() else {
253+ app.state
254+ .push_log("ERROR: cracker: capture no longer exists");
255+ cx.notify();
256+ return;
257+ };
239 258
240 // Validate everything that can fail BEFORE marking the run active,259 // Validate everything that can fail BEFORE marking the run active,
241 // so a refused start never leaves stale flags behind.260 // so a refused start never leaves stale flags behind.
@@ -249,15 +268,11 @@ fn start(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
249 cx.notify();268 cx.notify();
250 return;269 return;
251 }270 }
252- let Some(idx) = app.state.capture_descs().iter().position(|d| *d == desc) else {
253- app.state.push_log("ERROR: cracker: capture no longer exists");
254- cx.notify();
255- return;
256- };
257 match app.state.crack_target_at(idx) {271 match app.state.crack_target_at(idx) {
258 Some(t) => Some((t, attack)),272 Some(t) => Some((t, attack)),
259 None => {273 None => {
260- app.state.push_log("ERROR: cracker: capture no longer exists");274+ app.state
275+ .push_log("ERROR: cracker: capture no longer exists");
261 cx.notify();276 cx.notify();
262 return;277 return;
263 }278 }
@@ -276,8 +291,10 @@ fn start(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
276 cr.total = None;291 cr.total = None;
277 // A fresh foreground start supersedes any saved resume position.292 // A fresh foreground start supersedes any saved resume position.
278 cr.resume = None;293 cr.resume = None;
294+ // `running` is the single source of truth for "run in flight"
295+ // (the old `crack_inflight` double is gone): set here, settled by
296+ // CrackStopped/CrackError alike.
279 cr.running = true;297 cr.running = true;
280- app.crack_inflight = true;
281 // Fresh run: the throughput curve belongs to it, not the last run.298 // Fresh run: the throughput curve belongs to it, not the last run.
282 app.state.hps_hist.clear();299 app.state.hps_hist.clear();
283 cx.notify();300 cx.notify();
@@ -319,9 +336,8 @@ fn start(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
319 }336 }
320 337
321 // ---- mock path: same events, fabricated numbers ----338 // ---- mock path: same events, fabricated numbers ----
322- app.state.push_log(format!(339+ app.state
323- "cracker: {desc} via {wordlist} [mock run]"340+ .push_log(format!("cracker: {desc} via {wordlist} [mock run]"));
324- ));
325 cx.notify();341 cx.notify();
326 let tx = app.tx.clone();342 let tx = app.tx.clone();
327 let epoch = app.crack_epoch;343 let epoch = app.crack_epoch;
@@ -363,22 +379,28 @@ fn start(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
363 ///379 ///
364 /// Real mode flips the crack job's stop flag (the worker breaks at the380 /// Real mode flips the crack job's stop flag (the worker breaks at the
365 /// next batch and emits CrackStopped{found:false}, which settles the UI381 /// next batch and emits CrackStopped{found:false}, which settles the UI
366-/// and clears `app.crack_stop`). Mock mode just invalidates the382+/// and clears `app.crack_stop`). Mock mode invalidates the generator
367-/// generator epoch — no terminator event will arrive, so the running383+/// epoch AND emits the same CrackStopped{found:false} terminator through
368-/// flags are cleared here.384+/// the mock event channel — the drain then finalizes the session exactly
385+/// like a real stop (running=false, active_attack cleared,
386+/// finalize_crack_session runs), instead of leaving `active_attack`
387+/// state behind.
369 fn stop(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {388 fn stop(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
370 view.update(cx, |app, cx| {389 view.update(cx, |app, cx| {
371- let active = app.crack_inflight || app.state.cracker.running;390+ if !app.state.cracker.running {
372- if !active {
373 return;391 return;
374 }392 }
375 app.crack_epoch += 1;393 app.crack_epoch += 1;
376 if app.is_mock {394 if app.is_mock {
395+ // Settle the visible run state right away (Stop button greys
396+ // out immediately; apply() re-setting these on the event is
397+ // idempotent), then let the normal drain path do the
398+ // real-mode-identical finalization.
377 app.state.cracker.running = false;399 app.state.cracker.running = false;
378- app.crack_inflight = false;
379 app.state.cracker.hps = 0.0;400 app.state.cracker.hps = 0.0;
380 app.state.push_log("cracker: stopped by user");401 app.state.push_log("cracker: stopped by user");
381 cx.notify();402 cx.notify();
403+ let _ = app.tx.send(Event::CrackStopped { found: false });
382 return;404 return;
383 }405 }
384 if let Some(flag) = &app.crack_stop {406 if let Some(flag) = &app.crack_stop {
@@ -397,25 +419,17 @@ fn stop(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
397 /// `rainbow_building` and `app.rainbow_stop`.419 /// `rainbow_building` and `app.rainbow_stop`.
398 fn build(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {420 fn build(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
399 view.update(cx, |app, cx| {421 view.update(cx, |app, cx| {
400- if app.state.cracker.rainbow_building422+ if app.state.cracker.rainbow_building || app.state.cracker.running || app.bench_running {
401- || app.crack_inflight
402- || app.state.cracker.running
403- || app.bench_running
404- {
405 return;423 return;
406 }424 }
407- let Some(desc) = app.state.cracker.target.clone() else {425+ let Some(idx) = app.state.cracker.target else {
408 app.state.push_log("rainbow: no target selected");426 app.state.push_log("rainbow: no target selected");
409 cx.notify();427 cx.notify();
410 return;428 return;
411 };429 };
412- let Some(idx) = app.state.capture_descs().iter().position(|d| *d == desc) else {
413- app.state.push_log("ERROR: rainbow: capture no longer exists");
414- cx.notify();
415- return;
416- };
417 let Some(target) = app.state.crack_target_at(idx) else {430 let Some(target) = app.state.crack_target_at(idx) else {
418- app.state.push_log("ERROR: rainbow: capture no longer exists");431+ app.state
432+ .push_log("ERROR: rainbow: capture no longer exists");
419 cx.notify();433 cx.notify();
420 return;434 return;
421 };435 };
@@ -473,11 +487,7 @@ fn build_stop(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App)
473 /// continuing at the saved candidate offset.487 /// continuing at the saved candidate offset.
474 fn resume_saved(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {488 fn resume_saved(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
475 view.update(cx, |app, cx| {489 view.update(cx, |app, cx| {
476- if app.crack_inflight490+ if app.state.cracker.running || app.state.cracker.rainbow_building || app.bench_running {
477- || app.state.cracker.running
478- || app.state.cracker.rainbow_building
479- || app.bench_running
480- {
481 return;491 return;
482 }492 }
483 let Some(r) = app.state.cracker.resume.clone() else {493 let Some(r) = app.state.cracker.resume.clone() else {
@@ -491,18 +501,10 @@ fn resume_saved(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App
491 cx.notify();501 cx.notify();
492 return;502 return;
493 }503 }
494- let Some(idx) = app504+ // ResumeInfo already carries the capture INDEX (resolved against
495- .state505+ // the loaded captures when the session was armed): no string
496- .capture_descs()506+ // re-matching. The bounds check is the "no longer exists" guard.
497- .iter()507+ let Some(target) = app.state.crack_target_at(r.target_idx) else {
498- .position(|d| *d == r.target_desc)
499- else {
500- app.state
501- .push_log("ERROR: cracker: saved run's capture no longer exists");
502- cx.notify();
503- return;
504- };
505- let Some(target) = app.state.crack_target_at(idx) else {
506 app.state508 app.state
507 .push_log("ERROR: cracker: saved run's capture no longer exists");509 .push_log("ERROR: cracker: saved run's capture no longer exists");
508 cx.notify();510 cx.notify();
@@ -517,9 +519,15 @@ fn resume_saved(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App
517 cr.total = r.total;519 cr.total = r.total;
518 cr.active_attack = Some(r.attack.clone());520 cr.active_attack = Some(r.attack.clone());
519 cr.resume = None;521 cr.resume = None;
522+ // The dropdown selection follows the resumed capture (throttle-
523+ // saves for THIS run key off `target`).
524+ cr.target = Some(r.target_idx);
520 cr.running = true;525 cr.running = true;
521- app.crack_inflight = true;
522 app.state.hps_hist.clear();526 app.state.hps_hist.clear();
527+ // The select ENTITY bakes its `.selected()` in at construction,
528+ // so a programmatic target change must rebuild it (keeps the just-
529+ // set index pre-marked).
530+ app.rebuild_target_select(cx);
523 // The new run's throttle-saves supersede the old session file;531 // The new run's throttle-saves supersede the old session file;
524 // clear eagerly so a crash cannot doubly arm the banner.532 // clear eagerly so a crash cannot doubly arm the banner.
525 if let Err(e) = crate::store::clear_session() {533 if let Err(e) = crate::store::clear_session() {
@@ -564,13 +572,15 @@ fn save_preset(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App)
564 view.update(cx, |app, cx| {572 view.update(cx, |app, cx| {
565 let mode = app.attack_mode.clone();573 let mode = app.attack_mode.clone();
566 if mode == "rainbow" {574 if mode == "rainbow" {
567- app.state.push_log("profiles: rainbow presets are not saved");575+ app.state
576+ .push_log("profiles: rainbow presets are not saved");
568 cx.notify();577 cx.notify();
569 return;578 return;
570 }579 }
571 let wordlist = app.wordlist_input.read(cx).content().trim().to_string();580 let wordlist = app.wordlist_input.read(cx).content().trim().to_string();
572 if wordlist.is_empty() {581 if wordlist.is_empty() {
573- app.state.push_log("profiles: wordlist path is empty — nothing to save");582+ app.state
583+ .push_log("profiles: wordlist path is empty — nothing to save");
574 cx.notify();584 cx.notify();
575 return;585 return;
576 }586 }
@@ -578,7 +588,8 @@ fn save_preset(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App)
578 "rules" => {588 "rules" => {
579 let r = app.rules_input.read(cx).content().trim().to_string();589 let r = app.rules_input.read(cx).content().trim().to_string();
580 if r.is_empty() {590 if r.is_empty() {
581- app.state.push_log("profiles: rules path is empty — nothing to save");591+ app.state
592+ .push_log("profiles: rules path is empty — nothing to save");
582 cx.notify();593 cx.notify();
583 return;594 return;
584 }595 }
@@ -674,7 +685,7 @@ fn import_captures(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::
674 // (a bare std thread cannot touch gpui state).685 // (a bare std thread cannot touch gpui state).
675 let (done_tx, done_rx) = crossbeam_channel::bounded::<()>(1);686 let (done_tx, done_rx) = crossbeam_channel::bounded::<()>(1);
676 std::thread::Builder::new()687 std::thread::Builder::new()
677- .name("wifilab-import".into())688+ .name("wifi_lab-import".into())
678 .spawn(move || {689 .spawn(move || {
679 for path in paths {690 for path in paths {
680 let disp = path.display().to_string();691 let disp = path.display().to_string();
@@ -763,11 +774,7 @@ fn import_captures(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::
763 /// app drain side. Mock mode fabricates a fixed result after ~1.5 s.774 /// app drain side. Mock mode fabricates a fixed result after ~1.5 s.
764 fn benchmark(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {775 fn benchmark(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
765 view.update(cx, |app, cx| {776 view.update(cx, |app, cx| {
766- if app.bench_running777+ if app.bench_running || app.state.cracker.running || app.state.cracker.rainbow_building {
767- || app.crack_inflight
768- || app.state.cracker.running
769- || app.state.cracker.rainbow_building
770- {
771 return;778 return;
772 }779 }
773 app.bench_running = true;780 app.bench_running = true;
@@ -788,7 +795,9 @@ fn benchmark(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
788 cx.background_executor()795 cx.background_executor()
789 .timer(Duration::from_millis(1500))796 .timer(Duration::from_millis(1500))
790 .await;797 .await;
791- let live = this.update(cx, |app, _cx| app.bench_running).unwrap_or(false);798+ let live = this
799+ .update(cx, |app, _cx| app.bench_running)
800+ .unwrap_or(false);
792 if live {801 if live {
793 let _ = tx.send(Event::BenchmarkDone {802 let _ = tx.send(Event::BenchmarkDone {
794 gpu_hps: Some(MOCK_HPS),803 gpu_hps: Some(MOCK_HPS),
@@ -800,12 +809,107 @@ fn benchmark(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
800 });809 });
801 }810 }
802 811
812+/// Single-flight guard for the async estimate count: true while a
813+/// wordlist line_count runs on the background executor (the Estimate
814+/// button greys out; clicks are deduped).
815+static ESTIMATE_INFLIGHT: AtomicBool = AtomicBool::new(false);
816+/// Generation of the newest claimed count. A completion whose generation
817+/// has been superseded is a stale result and must be dropped.
818+static ESTIMATE_GEN: AtomicU64 = AtomicU64::new(0);
819+
820+/// Claim the estimator slot for one background count. Returns the
821+/// generation stamped onto that count's result, or `None` when a count
822+/// is already running (button-disabled is the normal gate; this is the
823+/// race-proof backstop).
824+fn estimate_claim() -> Option<u64> {
825+ if ESTIMATE_INFLIGHT.swap(true, Ordering::AcqRel) {
826+ None
827+ } else {
828+ Some(ESTIMATE_GEN.fetch_add(1, Ordering::AcqRel) + 1)
829+ }
830+}
831+
832+/// Release the estimator slot; reports whether `est_gen` is still the newest
833+/// claim (`false` → a newer count started, drop the stale result). A stale
834+/// completion must NOT free the slot — the newer count still owns it.
835+fn estimate_release(est_gen: u64) -> bool {
836+ if est_gen != ESTIMATE_GEN.load(Ordering::Acquire) {
837+ return false;
838+ }
839+ ESTIMATE_INFLIGHT.store(false, Ordering::Release);
840+ true
841+}
842+
843+/// True while an estimate count runs (render greys the Estimate button).
844+fn estimate_busy() -> bool {
845+ ESTIMATE_INFLIGHT.load(Ordering::Acquire)
846+}
847+
848+/// (a) wordlist-family estimate lines: pure worker math over the
849+/// click-time snapshot. Empty wordlist path means the mock-size count;
850+/// `rules_path` applies only in rules mode. This is the part that walks
851+/// multi-GB files, so it runs on the background executor — never on the
852+/// UI thread.
853+fn estimate_wordlist_lines(wl: &str, rules_path: Option<&str>, hps: f64) -> Vec<String> {
854+ let wl_space: Option<u128> = if wl.is_empty() {
855+ Some(WORDLIST_TOTAL as u128)
856+ } else {
857+ match crate::wordlist::line_count(std::path::Path::new(wl)) {
858+ Ok(n) => Some(n as u128),
859+ Err(e) => return vec![format!("estimate: wordlist unreadable: {e:#}")],
860+ }
861+ };
862+ let mut lines = Vec::new();
863+ if let Some(mut space) = wl_space {
864+ let mut what = format!(
865+ "wordlist {}",
866+ if wl.is_empty() { "(mock-size)" } else { wl }
867+ );
868+ // `Some(path)` ⇔ rules mode at click time (path may still be
869+ // empty — same "rules unreadable" outcome as the old sync code).
870+ if let Some(rp) = rules_path {
871+ match crate::attack::rule_count(std::path::Path::new(rp)) {
872+ Ok(r) if r > 0 => {
873+ space = space.saturating_mul(r as u128);
874+ what = format!("{what} × {r} rules");
875+ }
876+ Ok(_) => {}
877+ Err(e) => {
878+ lines.push(format!("estimate: rules unreadable: {e:#}"));
879+ space = 0;
880+ }
881+ }
882+ }
883+ if space > 0 {
884+ lines.push(format!(
885+ "estimate: {what}: {space} candidates, worst case ~{} @ {}",
886+ fmt_dur(space as f64 / hps),
887+ fmt_hps(hps)
888+ ));
889+ }
890+ }
891+ lines
892+}
893+
803 /// Estimate worst-case crack durations from the measured benchmark rate894 /// Estimate worst-case crack durations from the measured benchmark rate
804 /// and the current input fields; results go to the activity log as895 /// and the current input fields; results go to the activity log as
805 /// "estimate:" lines (candidate-space math always, times only when a896 /// "estimate:" lines (candidate-space math always, times only when a
806 /// benchmark has run).897 /// benchmark has run).
898+///
899+/// The (a) wordlist line count can walk many GB, so it runs on gpui's
900+/// background executor (same `cx.spawn`/`background_executor` pattern as
901+/// the Import button) and lands back via `view.update`; bruteforce space
902+/// and candidate entropy are trivial arithmetic and are still computed
903+/// from the click-time input snapshot. One click claims the estimator
904+/// slot (button greyed meanwhile); a completion older than the newest
905+/// claim is dropped.
807 fn estimate(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {906 fn estimate(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
808- view.update(cx, |app, cx| {907+ let Some(est_gen) = estimate_claim() else {
908+ return; // a count is already in flight
909+ };
910+ // Snapshot the input fields NOW (they may change while the count
911+ // runs); (b)/(c) lines are cheap enough to build on the spot.
912+ let (snap_wl, snap_rules, hps, tail_lines) = view.update(cx, |app, cx| {
809 let hps = match (app.state.bench_gpu, app.state.bench_cpu) {913 let hps = match (app.state.bench_gpu, app.state.bench_cpu) {
810 (Some(g), Some(c)) => Some(g.max(c)),914 (Some(g), Some(c)) => Some(g.max(c)),
811 (Some(g), None) => Some(g),915 (Some(g), None) => Some(g),
@@ -816,48 +920,17 @@ fn estimate(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
816 app.state920 app.state
817 .push_log("estimate: run Benchmark for times; candidate-space math only");921 .push_log("estimate: run Benchmark for times; candidate-space math only");
818 cx.notify();922 cx.notify();
819- return;923+ return (String::new(), None, 0.0, Vec::new());
820 };924 };
821 925
822- // (a) wordlist family: lines × rules (rules mode) at best rate.
823 let wl = app.wordlist_input.read(cx).content().trim().to_string();926 let wl = app.wordlist_input.read(cx).content().trim().to_string();
824- let wl_space: Option<u128> = if wl.is_empty() {927+ // Rule count applies to the wordlist only in rules mode; capture
825- Some(WORDLIST_TOTAL as u128)928+ // the path (Some ⇔ rules mode at click time) rather than a flag.
929+ let rules: Option<String> = if app.attack_mode == "rules" {
930+ Some(app.rules_input.read(cx).content().trim().to_string())
826 } else {931 } else {
827- match crate::wordlist::line_count(std::path::Path::new(&wl)) {932+ None
828- Ok(n) => Some(n as u128),
829- Err(e) => {
830- app.state
831- .push_log(format!("estimate: wordlist unreadable: {e:#}"));
832- None
833- }
834- }
835 };933 };
836- if let Some(mut space) = wl_space {
837- let mut what = format!("wordlist {}", if wl.is_empty() { "(mock-size)" } else { &wl });
838- if app.attack_mode == "rules" {
839- let rp = app.rules_input.read(cx).content().trim().to_string();
840- match crate::attack::rule_count(std::path::Path::new(&rp)) {
841- Ok(r) if r > 0 => {
842- space = space.saturating_mul(r as u128);
843- what = format!("{what} × {r} rules");
844- }
845- Ok(_) => {}
846- Err(e) => {
847- app.state
848- .push_log(format!("estimate: rules unreadable: {e:#}"));
849- space = 0;
850- }
851- }
852- }
853- if space > 0 {
854- app.state.push_log(format!(
855- "estimate: {what}: {space} candidates, worst case ~{} @ {}",
856- fmt_dur(space as f64 / hps),
857- fmt_hps(hps)
858- ));
859- }
860- }
861 934
862 // (b) bruteforce space at best rate.935 // (b) bruteforce space at best rate.
863 let custom = app936 let custom = app
@@ -874,8 +947,9 @@ fn estimate(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
874 app.cs_special,947 app.cs_special,
875 &custom,948 &custom,
876 );949 );
950+ let mut tail: Vec<String> = Vec::new();
877 if charset.is_empty() {951 if charset.is_empty() {
878- app.state.push_log("estimate: empty charset — bruteforce space n/a");952+ tail.push("estimate: empty charset — bruteforce space n/a".to_string());
879 } else {953 } else {
880 let min = app954 let min = app
881 .len_min_input955 .len_min_input
@@ -894,15 +968,13 @@ fn estimate(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
894 match crate::attack::BruteForce::new(charset.clone(), min, max, false) {968 match crate::attack::BruteForce::new(charset.clone(), min, max, false) {
895 Ok(bf) => {969 Ok(bf) => {
896 let space = bf.space();970 let space = bf.space();
897- app.state.push_log(format!(971+ tail.push(format!(
898 "estimate: bruteforce {min}..={max}: {space} candidates, worst case ~{} @ {}",972 "estimate: bruteforce {min}..={max}: {space} candidates, worst case ~{} @ {}",
899 fmt_dur(space as f64 / hps),973 fmt_dur(space as f64 / hps),
900 fmt_hps(hps)974 fmt_hps(hps)
901 ));975 ));
902 }976 }
903- Err(e) => app977+ Err(e) => tail.push(format!("estimate: bruteforce range invalid: {e:#}")),
904- .state
905- .push_log(format!("estimate: bruteforce range invalid: {e:#}")),
906 }978 }
907 }979 }
908 980
@@ -913,7 +985,7 @@ fn estimate(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
913 let csize = charset.len() as f64;985 let csize = charset.len() as f64;
914 let bits = candidate.len() as f64 * csize.log2();986 let bits = candidate.len() as f64 * csize.log2();
915 let guess_s = 2f64.powf(bits - 1.0) / hps;987 let guess_s = 2f64.powf(bits - 1.0) / hps;
916- app.state.push_log(format!(988+ tail.push(format!(
917 "estimate: {} chars × log2({}) ≈ {bits:.0} bits — avg crack ~{} @ {}",989 "estimate: {} chars × log2({}) ≈ {bits:.0} bits — avg crack ~{} @ {}",
918 candidate.len(),990 candidate.len(),
919 charset.len(),991 charset.len(),
@@ -921,10 +993,44 @@ fn estimate(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
921 fmt_hps(hps)993 fmt_hps(hps)
922 ));994 ));
923 } else if candidate.is_empty() {995 } else if candidate.is_empty() {
924- app.state.push_log("estimate: type a candidate for its entropy line");996+ tail.push("estimate: type a candidate for its entropy line".to_string());
925 }997 }
926 cx.notify();998 cx.notify();
999+ (wl, rules, hps, tail)
927 });1000 });
1001+ if hps <= 0.0 {
1002+ // No benchmark yet: the early-return log above already landed.
1003+ estimate_release(est_gen);
1004+ return;
1005+ }
1006+
1007+ // Heavy part off-thread: count the wordlist (+ rules) like the Import
1008+ // button's executor hop, then deliver the lines through view.update.
1009+ let weak = view.downgrade();
1010+ cx.spawn(async move |cx| {
1011+ let wl = snap_wl.clone();
1012+ let rules = snap_rules.clone();
1013+ let mut lines = cx
1014+ .background_executor()
1015+ .spawn(async move { estimate_wordlist_lines(&wl, rules.as_deref(), hps) })
1016+ .await;
1017+ lines.extend(tail_lines);
1018+ let applied = weak.update(cx, |app, cx| {
1019+ let fresh = estimate_release(est_gen);
1020+ if fresh {
1021+ for line in lines {
1022+ app.state.push_log(line);
1023+ }
1024+ }
1025+ cx.notify();
1026+ fresh
1027+ });
1028+ if applied.is_err() {
1029+ // The view is gone — still free the slot behind the button.
1030+ estimate_release(est_gen);
1031+ }
1032+ })
1033+ .detach();
928 }1034 }
929 1035
930 /// One bruteforce charset preset chip. Toggling flips the app flag;1036 /// One bruteforce charset preset chip. Toggling flips the app flag;
@@ -987,7 +1093,13 @@ fn hps_curve(
987 let hpx = (2.0 + MAX_H * (*h as f32 / max as f32)).min(MAX_H + 2.0);1093 let hpx = (2.0 + MAX_H * (*h as f32 / max as f32)).min(MAX_H + 2.0);
988 cols.push(div().w(px(6.)).h(px(hpx)).bg(accent));1094 cols.push(div().w(px(6.)).h(px(hpx)).bg(accent));
989 }1095 }
990- Some(h_stack().gap_1().items_end().children(cols).into_any_element())1096+ Some(
1097+ h_stack()
1098+ .gap_1()
1099+ .items_end()
1100+ .children(cols)
1101+ .into_any_element(),
1102+ )
991 }1103 }
992 1104
993 pub fn render(1105 pub fn render(
@@ -998,7 +1110,9 @@ pub fn render(
998 ) -> gpui::Div {1110 ) -> gpui::Div {
999 let theme = cx.theme().clone();1111 let theme = cx.theme().clone();
1000 let cracker = &app.state.cracker;1112 let cracker = &app.state.cracker;
1001- let running = cracker.running || app.crack_inflight;1113+ // `running` is set at Start and settled by CrackStopped/CrackError;
1114+ // it is now the single source of truth (no separate in-flight flag).
1115+ let running = cracker.running;
1002 let rainbow_building = cracker.rainbow_building;1116 let rainbow_building = cracker.rainbow_building;
1003 // Coverage fraction: mock is bounded by construction; real runs get1117 // Coverage fraction: mock is bounded by construction; real runs get
1004 // their worst-case total from the worker (wordlist lines, brute1118 // their worst-case total from the worker (wordlist lines, brute
@@ -1027,13 +1141,46 @@ pub fn render(
1027 "bruteforce" => h_stack()1141 "bruteforce" => h_stack()
1028 .gap_2()1142 .gap_2()
1029 .items_center()1143 .items_center()
1030- .child(charset_chip("cs-lower", "a-z", app.cs_lower, view, cx, |a| &mut a.cs_lower))1144+ .child(charset_chip(
1031- .child(charset_chip("cs-upper", "A-Z", app.cs_upper, view, cx, |a| &mut a.cs_upper))1145+ "cs-lower",
1032- .child(charset_chip("cs-digits", "0-9", app.cs_digits, view, cx, |a| &mut a.cs_digits))1146+ "a-z",
1033- .child(charset_chip("cs-special", "!@#…", app.cs_special, view, cx, |a| &mut a.cs_special))1147+ app.cs_lower,
1034- .child(charset_chip("cs-freq-order", "freq-order", app.freq_order, view, cx, |a| {1148+ view,
1035- &mut a.freq_order1149+ cx,
1036- }))1150+ |a| &mut a.cs_lower,
1151+ ))
1152+ .child(charset_chip(
1153+ "cs-upper",
1154+ "A-Z",
1155+ app.cs_upper,
1156+ view,
1157+ cx,
1158+ |a| &mut a.cs_upper,
1159+ ))
1160+ .child(charset_chip(
1161+ "cs-digits",
1162+ "0-9",
1163+ app.cs_digits,
1164+ view,
1165+ cx,
1166+ |a| &mut a.cs_digits,
1167+ ))
1168+ .child(charset_chip(
1169+ "cs-special",
1170+ "!@#…",
1171+ app.cs_special,
1172+ view,
1173+ cx,
1174+ |a| &mut a.cs_special,
1175+ ))
1176+ .child(charset_chip(
1177+ "cs-freq-order",
1178+ "freq-order",
1179+ app.freq_order,
1180+ view,
1181+ cx,
1182+ |a| &mut a.freq_order,
1183+ ))
1037 .child(1184 .child(
1038 div().w(px(160.)).child(1185 div().w(px(160.)).child(
1039 text_field(&app.charset_input, cx)1186 text_field(&app.charset_input, cx)
@@ -1055,7 +1202,10 @@ pub fn render(
1055 .full_width(true),1202 .full_width(true),
1056 ),1203 ),
1057 )1204 )
1058- .child(small("chips + custom · min..max len · freq-order: common characters first").muted())1205+ .child(
1206+ small("chips + custom · min..max len · freq-order: common characters first")
1207+ .muted(),
1208+ )
1059 .into_any_element(),1209 .into_any_element(),
1060 "rules" => h_stack()1210 "rules" => h_stack()
1061 .gap_2()1211 .gap_2()
@@ -1086,10 +1236,38 @@ pub fn render(
1086 .full_width(true),1236 .full_width(true),
1087 ),1237 ),
1088 )1238 )
1089- .child(charset_chip("cs-lower", "a-z", app.cs_lower, view, cx, |a| &mut a.cs_lower))1239+ .child(charset_chip(
1090- .child(charset_chip("cs-upper", "A-Z", app.cs_upper, view, cx, |a| &mut a.cs_upper))1240+ "cs-lower",
1091- .child(charset_chip("cs-digits", "0-9", app.cs_digits, view, cx, |a| &mut a.cs_digits))1241+ "a-z",
1092- .child(charset_chip("cs-special", "!@#…", app.cs_special, view, cx, |a| &mut a.cs_special))1242+ app.cs_lower,
1243+ view,
1244+ cx,
1245+ |a| &mut a.cs_lower,
1246+ ))
1247+ .child(charset_chip(
1248+ "cs-upper",
1249+ "A-Z",
1250+ app.cs_upper,
1251+ view,
1252+ cx,
1253+ |a| &mut a.cs_upper,
1254+ ))
1255+ .child(charset_chip(
1256+ "cs-digits",
1257+ "0-9",
1258+ app.cs_digits,
1259+ view,
1260+ cx,
1261+ |a| &mut a.cs_digits,
1262+ ))
1263+ .child(charset_chip(
1264+ "cs-special",
1265+ "!@#…",
1266+ app.cs_special,
1267+ view,
1268+ cx,
1269+ |a| &mut a.cs_special,
1270+ ))
1093 .child(1271 .child(
1094 div().w(px(120.)).child(1272 div().w(px(120.)).child(
1095 text_field(&app.charset_input, cx)1273 text_field(&app.charset_input, cx)
@@ -1158,6 +1336,7 @@ pub fn render(
1158 .iter()1336 .iter()
1159 .filter(|line| {1337 .filter(|line| {
1160 line.starts_with("cracker:")1338 line.starts_with("cracker:")
1339+ || line.starts_with("crack FAILED") // backend-failure reason, set by apply()
1161 || line.starts_with("rainbow:")1340 || line.starts_with("rainbow:")
1162 || line.starts_with("estimate:")1341 || line.starts_with("estimate:")
1163 || line.starts_with("benchmark:")1342 || line.starts_with("benchmark:")
@@ -1178,7 +1357,8 @@ pub fn render(
1178 // wordlist/rules fields and (for presets) the attack-mode select.1357 // wordlist/rules fields and (for presets) the attack-mode select.
1179 let hover_bg = theme.accent_bg();1358 let hover_bg = theme.accent_bg();
1180 let mut preset_row = h_stack().gap_2().items_center();1359 let mut preset_row = h_stack().gap_2().items_center();
1181- let has_presets = !app.profiles.profiles.is_empty() || !app.profiles.recent_wordlists.is_empty();1360+ let has_presets =
1361+ !app.profiles.profiles.is_empty() || !app.profiles.recent_wordlists.is_empty();
1182 for p in &app.profiles.profiles {1362 for p in &app.profiles.profiles {
1183 let profile = p.clone();1363 let profile = p.clone();
1184 preset_row = preset_row.child(1364 preset_row = preset_row.child(
@@ -1200,13 +1380,10 @@ pub fn render(
1200 );1380 );
1201 }1381 }
1202 if !app.profiles.profiles.is_empty() {1382 if !app.profiles.profiles.is_empty() {
1203- preset_row = preset_row.child(1383+ preset_row = preset_row.child(button("btn-preset-save", "Save preset").on_click({
1204- button("btn-preset-save", "Save preset")1384+ let view = view.clone();
1205- .on_click({1385+ move |_, window, cx| save_preset(&view, window, cx)
1206- let view = view.clone();1386+ }));
1207- move |_, window, cx| save_preset(&view, window, cx)
1208- }),
1209- );
1210 }1387 }
1211 let mut recent_row = h_stack().gap_2().items_center();1388 let mut recent_row = h_stack().gap_2().items_center();
1212 for wl in &app.profiles.recent_wordlists {1389 for wl in &app.profiles.recent_wordlists {
@@ -1258,8 +1435,7 @@ pub fn render(
1258 .bench_cpu1435 .bench_cpu
1259 .map(|c| format!("CPU: {}", fmt_hps(c)))1436 .map(|c| format!("CPU: {}", fmt_hps(c)))
1260 .unwrap_or_default();1437 .unwrap_or_default();
1261- let bench_disabled =1438+ let bench_disabled = app.bench_running || cracker.running || cracker.rainbow_building;
1262- app.bench_running || app.crack_inflight || cracker.running || cracker.rainbow_building;
1263 1439
1264 let mut page = v_stack()1440 let mut page = v_stack()
1265 .size_full()1441 .size_full()
@@ -1282,24 +1458,20 @@ pub fn render(
1282 ),1458 ),
1283 )1459 )
1284 .when(has_presets, |el| {1460 .when(has_presets, |el| {
1285- el.child(preset_row)1461+ el.child(preset_row).when(
1286- .when(1462+ !app.profiles.recent_wordlists.is_empty() || !app.profiles.profiles.is_empty(),
1287- !app.profiles.recent_wordlists.is_empty() || !app.profiles.profiles.is_empty(),1463+ |el2| el2.child(recent_row),
1288- |el2| el2.child(recent_row),1464+ )
1289- )
1290 })1465 })
1291 .when(!has_presets, |el| {1466 .when(!has_presets, |el| {
1292 // No saved state yet — still offer one-click saving of the1467 // No saved state yet — still offer one-click saving of the
1293 // current setup.1468 // current setup.
1294- el.child(1469+ el.child(h_stack().gap_2().items_center().child(
1295- h_stack().gap_2().items_center().child(1470+ button("btn-preset-save", "Save preset").on_click({
1296- button("btn-preset-save", "Save preset")1471+ let view = view.clone();
1297- .on_click({1472+ move |_, window, cx| save_preset(&view, window, cx)
1298- let view = view.clone();1473+ }),
1299- move |_, window, cx| save_preset(&view, window, cx)1474+ ))
1300- }),
1301- ),
1302- )
1303 })1475 })
1304 .child(1476 .child(
1305 h_stack()1477 h_stack()
@@ -1337,31 +1509,30 @@ pub fn render(
1337 .child(1509 .child(
1338 h_stack()1510 h_stack()
1339 .gap_4()1511 .gap_4()
1340- .child(small(format!("rate: {}", fmt_hps(if running { cracker.hps } else { 0.0 }))))1512+ .child(small(format!(
1513+ "rate: {}",
1514+ fmt_hps(if running { cracker.hps } else { 0.0 })
1515+ )))
1341 .child(small(candidates))1516 .child(small(candidates))
1342- .child(1517+ .child(small({
1343- small({1518+ // Coverage % whenever a total exists; ETA needs a
1344- // Coverage % whenever a total exists; ETA needs a1519+ // live run too.
1345- // live run too.1520+ let pct = effective_total.map(|_| format!("{:.1}%", frac * 100.0));
1346- let pct = effective_total.map(|_| format!("{:.1}%", frac * 100.0));1521+ match (pct, &eta) {
1347- match (pct, &eta) {1522+ (Some(p), Some(e)) => format!("{p} · {e}"),
1348- (Some(p), Some(e)) => format!("{p} · {e}"),1523+ (Some(p), None) => p,
1349- (Some(p), None) => p,1524+ (None, Some(e)) => e.clone(),
1350- (None, Some(e)) => e.clone(),1525+ (None, None) => String::new(),
1351- (None, None) => String::new(),1526+ }
1352- }1527+ })),
1353- }),
1354- ),
1355 )1528 )
1356 .child(progress(frac as f32).width(px(520.)))1529 .child(progress(frac as f32).width(px(520.)))
1357- .children(1530+ .children(hps_curve(&app.state.hps_hist, theme.accent()).map(|curve| {
1358- hps_curve(&app.state.hps_hist, theme.accent()).map(|curve| {1531+ v_stack()
1359- v_stack()1532+ .gap_1()
1360- .gap_1()1533+ .child(small("rate over time (one bar per progress sample)").muted())
1361- .child(small("rate over time (one bar per progress sample)").muted())1534+ .child(curve)
1362- .child(curve)1535+ }))
1363- }),
1364- )
1365 .child(1536 .child(
1366 // Benchmark card: measured crack speed on this machine.1537 // Benchmark card: measured crack speed on this machine.
1367 h_stack()1538 h_stack()
@@ -1380,7 +1551,9 @@ pub fn render(
1380 move |_, window, cx| benchmark(&view, window, cx)1551 move |_, window, cx| benchmark(&view, window, cx)
1381 }),1552 }),
1382 )1553 )
1383- .when(app.bench_running, |el| el.child(loading_indicator().small()))1554+ .when(app.bench_running, |el| {
1555+ el.child(loading_indicator().small())
1556+ })
1384 .child(small(bench_gpu_line).muted())1557 .child(small(bench_gpu_line).muted())
1385 .child(small(bench_cpu_line).muted()),1558 .child(small(bench_cpu_line).muted()),
1386 )1559 )
@@ -1403,12 +1576,15 @@ pub fn render(
1403 )1576 )
1404 .child(1577 .child(
1405 button("btn-estimate", "Estimate")1578 button("btn-estimate", "Estimate")
1406- .disabled(app.bench_running)1579+ // Greyed while the background wordlist count runs
1580+ // (double-click dedupe) and during a benchmark.
1581+ .disabled(app.bench_running || estimate_busy())
1407 .on_click({1582 .on_click({
1408 let view = view.clone();1583 let view = view.clone();
1409 move |_, window, cx| estimate(&view, window, cx)1584 move |_, window, cx| estimate(&view, window, cx)
1410 }),1585 }),
1411 )1586 )
1587+ .when(estimate_busy(), |el| el.child(loading_indicator().small()))
1412 .child(small("results land in recent activity below").muted()),1588 .child(small("results land in recent activity below").muted()),
1413 );1589 );
1414 1590
@@ -1427,9 +1603,11 @@ pub fn render(
1427 v_stack()1603 v_stack()
1428 .gap_1()1604 .gap_1()
1429 .child(small("recent captures (all of them are in the target dropdown)").muted())1605 .child(small("recent captures (all of them are in the target dropdown)").muted())
1430- .children(recent_caps.into_iter().map(|d| {1606+ .children(
1431- text(d).code().small().into_any_element()1607+ recent_caps
1432- }))1608+ .into_iter()
1609+ .map(|d| text(d).code().small().into_any_element()),
1610+ )
1433 .into_any_element(),1611 .into_any_element(),
1434 );1612 );
1435 }1613 }
@@ -1451,43 +1629,42 @@ pub fn render(
1451 1629
1452 // Interrupted-run resume banner (saved session file matched to a1630 // Interrupted-run resume banner (saved session file matched to a
1453 // loaded capture; hidden while anything runs).1631 // loaded capture; hidden while anything runs).
1454- if !running && !rainbow_building && !app.is_mock {1632+ if !running
1455- if let Some(r) = &cracker.resume {1633+ && !rainbow_building
1456- let status = match r.total {1634+ && !app.is_mock
1457- Some(t) => format!("{} / {t} tried", r.done),1635+ && let Some(r) = &cracker.resume
1458- None => format!("{} tried", r.done),1636+ {
1459- };1637+ let status = match r.total {
1460- page = page.child(1638+ Some(t) => format!("{} / {t} tried", r.done),
1461- h_stack()1639+ None => format!("{} tried", r.done),
1462- .gap_3()1640+ };
1463- .items_center()1641+ page = page.child(
1464- .p_3()1642+ h_stack()
1465- .rounded_md()1643+ .gap_3()
1466- .border_1()1644+ .items_center()
1467- .border_color(theme.border())1645+ .p_3()
1468- .bg(theme.accent_bg())1646+ .rounded_md()
1469- .child(small(format!(1647+ .border_1()
1470- "saved run: {} — {} · {status}",1648+ .border_color(theme.border())
1471- r.target_desc,1649+ .bg(theme.accent_bg())
1472- r.attack.describe()1650+ .child(small(format!(
1473- )))1651+ "saved run: {} — {} · {status}",
1474- .child(1652+ r.target_desc,
1475- button("btn-crack-resume", "Resume")1653+ r.attack.describe()
1476- .on_click({1654+ )))
1477- let view = view.clone();1655+ .child(button("btn-crack-resume", "Resume").on_click({
1478- move |_, window, cx| resume_saved(&view, window, cx)1656+ let view = view.clone();
1479- }),1657+ move |_, window, cx| resume_saved(&view, window, cx)
1480- )1658+ }))
1481- .child(1659+ .child(
1482- button("btn-crack-discard", "Discard")1660+ button("btn-crack-discard", "Discard")
1483- .destructive()1661+ .destructive()
1484- .on_click({1662+ .on_click({
1485- let view = view.clone();1663+ let view = view.clone();
1486- move |_, window, cx| discard_saved(&view, window, cx)1664+ move |_, window, cx| discard_saved(&view, window, cx)
1487- }),1665+ }),
1488- ),1666+ ),
1489- );1667+ );
1490- }
1491 }1668 }
1492 1669
1493 if !activity.is_empty() {1670 if !activity.is_empty() {
@@ -1508,8 +1685,12 @@ pub fn render(
1508 "rainbow build: {} PMKs · {} · {}",1685 "rainbow build: {} PMKs · {} · {}",
1509 cracker.rainbow_done,1686 cracker.rainbow_done,
1510 fmt_hps(cracker.rainbow_hps),1687 fmt_hps(cracker.rainbow_hps),
1511- fmt_worst_case(cracker.rainbow_done, cracker.rainbow_hps, cracker.rainbow_total)1688+ fmt_worst_case(
1512- .unwrap_or_default()1689+ cracker.rainbow_done,
1690+ cracker.rainbow_hps,
1691+ cracker.rainbow_total
1692+ )
1693+ .unwrap_or_default()
1513 )))1694 )))
1514 .child(1695 .child(
1515 button("btn-rainbow-stop", "Stop build")1696 button("btn-rainbow-stop", "Stop build")
@@ -1524,3 +1705,106 @@ pub fn render(
1524 1705
1525 page1706 page
1526 }1707 }
1708+
1709+#[cfg(test)]
1710+mod tests {
1711+ //! Regression tests for the async-estimate single-flight/stale-drop
1712+ //! guard and the pure worker-side estimate line formatting. UI glue
1713+ //! (gpui entities, event drains) is exercised by clicking in the app;
1714+ //! the defect here — a second click racing an in-flight 14 GB count,
1715+ //! or a stale completion overwriting newer state — lives entirely in
1716+ //! these two functions.
1717+ use super::*;
1718+
1719+ /// All guard tests share the module statics, so they run as ONE test
1720+ /// function (cargo would otherwise interleave them across threads).
1721+ #[test]
1722+ fn estimate_guard_single_flight_and_stale_drop() {
1723+ // First click claims the slot; a concurrent second click is a
1724+ // no-op (the button is also disabled while busy).
1725+ let first = estimate_claim().expect("slot must be free");
1726+ assert!(
1727+ estimate_claim().is_none(),
1728+ "second click while a count runs must be deduped"
1729+ );
1730+ assert!(estimate_busy(), "button must read busy");
1731+
1732+ // A completion carrying the newest generation is applied.
1733+ assert!(estimate_release(first), "newest completion is fresh");
1734+ assert!(!estimate_busy(), "slot freed after completion");
1735+
1736+ // After release a new click gets a NEW, higher generation — a
1737+ // completion from the older generation landing late is stale and
1738+ // must be dropped WITHOUT freeing the newer claim's slot.
1739+ let second = estimate_claim().expect("slot free after release");
1740+ assert!(second > first, "generations tick upward");
1741+ assert!(
1742+ !estimate_release(first),
1743+ "older generation landing after a newer claim is stale"
1744+ );
1745+ assert!(
1746+ estimate_busy(),
1747+ "stale completion must not free the newer claim's slot"
1748+ );
1749+ // The real completion of the newer count still applies and frees.
1750+ assert!(estimate_release(second));
1751+ assert!(!estimate_busy());
1752+ }
1753+
1754+ #[test]
1755+ fn estimate_wordlist_lines_mock_and_real_counts() {
1756+ // Empty path = mock size, no file touched.
1757+ let lines = estimate_wordlist_lines("", None, 1_000_000.0);
1758+ assert_eq!(lines.len(), 1);
1759+ assert!(
1760+ lines[0].contains("(mock-size)") && lines[0].contains("1000000 candidates"),
1761+ "expected mock-size candidate line, got {:?}",
1762+ lines[0]
1763+ );
1764+
1765+ // A real (tiny) wordlist is counted by line.
1766+ let dir = std::env::temp_dir();
1767+ let wl = dir.join(format!("wifi_lab-est-{}-a.lst", std::process::id()));
1768+ std::fs::write(&wl, b"alpha\nbeta\ngamma\n").expect("write wordlist");
1769+ let lines = estimate_wordlist_lines(&wl.display().to_string(), None, 1_000_000.0);
1770+ assert_eq!(lines.len(), 1);
1771+ assert!(
1772+ lines[0].contains(&format!("{}: 3 candidates", wl.display())),
1773+ "expected 3-line count, got {:?}",
1774+ lines[0]
1775+ );
1776+
1777+ // Rules mode multiplies the space by the rule count.
1778+ let rules = dir.join(format!("wifi_lab-est-{}-a.rule", std::process::id()));
1779+ std::fs::write(&rules, b":\n$1\n# comment\n\n$2\n").expect("write rules");
1780+ let lines = estimate_wordlist_lines(
1781+ &wl.display().to_string(),
1782+ Some(rules.display().to_string()).as_deref(),
1783+ 1_000_000.0,
1784+ );
1785+ assert_eq!(lines.len(), 1);
1786+ assert!(
1787+ lines[0].contains("× 3 rules") && lines[0].contains("9 candidates"),
1788+ "expected 3 lines × 3 rules = 9, got {:?}",
1789+ lines[0]
1790+ );
1791+
1792+ // A missing wordlist yields the error line instead of guessing.
1793+ let lines = estimate_wordlist_lines("/nonexistent/nope.lst", None, 1_000_000.0);
1794+ assert_eq!(lines.len(), 1);
1795+ assert!(lines[0].starts_with("estimate: wordlist unreadable:"));
1796+
1797+ // Rules mode with an unreadable rules file reports the error and
1798+ // suppresses the (unknown) space line — same as the old sync code.
1799+ let lines = estimate_wordlist_lines(
1800+ &wl.display().to_string(),
1801+ Some("/nonexistent/nope.rule"),
1802+ 1_000_000.0,
1803+ );
1804+ assert_eq!(lines.len(), 1);
1805+ assert!(lines[0].starts_with("estimate: rules unreadable:"));
1806+
1807+ let _ = std::fs::remove_file(&wl);
1808+ let _ = std::fs::remove_file(&rules);
1809+ }
1810+}
src/ui/log.rsmodified+7 -8
@@ -18,13 +18,7 @@ pub fn render(
18 cx: &mut Context<AppRoot>,18 cx: &mut Context<AppRoot>,
19 ) -> gpui::Div {19 ) -> gpui::Div {
20 // Sync the read-only view with the log buffer, oldest first.20 // Sync the read-only view with the log buffer, oldest first.
21- let joined = app21+ let joined = app.state.log.iter().cloned().collect::<Vec<_>>().join("\n");
22- .state
23- .log
24- .iter()
25- .cloned()
26- .collect::<Vec<_>>()
27- .join("\n");
28 if app.log_input.read(cx).content() != joined {22 if app.log_input.read(cx).content() != joined {
29 app.log_input23 app.log_input
30 .update(cx, |input, cx| input.set_content_silent(joined, cx));24 .update(cx, |input, cx| input.set_content_silent(joined, cx));
@@ -63,5 +57,10 @@ pub fn render(
63 }57 }
64 })),58 })),
65 )59 )
66- .child(gpui::div().flex_1().min_h_0().child(text_area(&app.log_input, cx)))60+ .child(
61+ gpui::div()
62+ .flex_1()
63+ .min_h_0()
64+ .child(text_area(&app.log_input, cx)),
65+ )
67 }66 }
src/ui/mock.rsmodified+125 -25
@@ -49,6 +49,27 @@ pub const MOCK_CLIENTS: [MacAddr; 4] = [
49 pub const MOCK_ROT1: MacAddr = MacAddr([0x02, 0xa0, 0xb1, 0xc2, 0xd3, 0xe4]);49 pub const MOCK_ROT1: MacAddr = MacAddr([0x02, 0xa0, 0xb1, 0xc2, 0xd3, 0xe4]);
50 pub const MOCK_ROT2: MacAddr = MacAddr([0x06, 0x5f, 0x4e, 0x3d, 0x2c, 0x1b]);50 pub const MOCK_ROT2: MacAddr = MacAddr([0x06, 0x5f, 0x4e, 0x3d, 0x2c, 0x1b]);
51 51
52+/// Channel sets the mock's scan reports over time. Real scans gain and lose
53+/// channels as devices come and go; rotating the set exercises both the
54+/// Networks page's fixed-height activity timeline (3 blocks of 8 rows for
55+/// the 20-channel set) and the crowded-channel warning. Rotated every
56+/// [`CHAN_SET_SNAPSHOTS`] snapshots.
57+const MOCK_CHAN_SETS: &[&[u8]] = &[
58+ &[1, 6, 11, 36],
59+ &[
60+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 100,
61+ ],
62+ &[1, 6, 11, 36, 44, 100],
63+ &[6, 11, 36],
64+];
65+
66+/// Counter slots kept for the rotating channel sets — must be ≥ the widest
67+/// set in [`MOCK_CHAN_SETS`] (asserted in tests).
68+const MAX_MOCK_CHANS: usize = 20;
69+
70+/// Snapshots per channel-set rotation (2 s each).
71+const CHAN_SET_SNAPSHOTS: u64 = 10;
72+
52 fn seed_aps() -> Vec<AccessPoint> {73 fn seed_aps() -> Vec<AccessPoint> {
53 let now = now_ms();74 let now = now_ms();
54 let ap = |mac: [u8; 6], ssid: &str, channel, security, rssi, akms: Vec<Akm>| AccessPoint {75 let ap = |mac: [u8; 6], ssid: &str, channel, security, rssi, akms: Vec<Akm>| AccessPoint {
@@ -64,7 +85,7 @@ fn seed_aps() -> Vec<AccessPoint> {
64 vec![85 vec![
65 ap(86 ap(
66 [0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff],87 [0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff],
67- "parafin",88+ "testnet",
68 6,89 6,
69 Security::Wpa2,90 Security::Wpa2,
70 -42,91 -42,
@@ -110,11 +131,11 @@ fn seed_aps() -> Vec<AccessPoint> {
110 -72,131 -72,
111 Vec::new(),132 Vec::new(),
112 ),133 ),
113- // Same SSID as `parafin` but OPEN + different BSSID: trips the134+ // Same SSID as `testnet` but OPEN + different BSSID: trips the
114 // UI's rogue-AP detection so the warning path is visible in mock.135 // UI's rogue-AP detection so the warning path is visible in mock.
115 ap(136 ap(
116 [0x02, 0x66, 0x66, 0x66, 0x66, 0x66],137 [0x02, 0x66, 0x66, 0x66, 0x66, 0x66],
117- "parafin",138+ "testnet",
118 11,139 11,
119 Security::Open,140 Security::Open,
120 -77,141 -77,
@@ -138,7 +159,12 @@ fn seed_clients() -> Vec<ClientInfo> {
138 vec![159 vec![
139 cl(MOCK_CLIENTS[0], MOCK_BSSID, -44, true),160 cl(MOCK_CLIENTS[0], MOCK_BSSID, -44, true),
140 cl(MOCK_CLIENTS[1], MOCK_BSSID, -51, true),161 cl(MOCK_CLIENTS[1], MOCK_BSSID, -51, true),
141- cl(MOCK_CLIENTS[2], MacAddr([0x02, 0x1a, 0x2b, 0x3c, 0x4d, 0x5e]), -60, true),162+ cl(
163+ MOCK_CLIENTS[2],
164+ MacAddr([0x02, 0x1a, 0x2b, 0x3c, 0x4d, 0x5e]),
165+ -60,
166+ true,
167+ ),
142 // Locally-administered (randomized) MAC — the ROT2 milestone below168 // Locally-administered (randomized) MAC — the ROT2 milestone below
143 // pairs it with ROT1 as one physical radio.169 // pairs it with ROT1 as one physical radio.
144 cl(MOCK_ROT1, MOCK_BSSID, -48, true),170 cl(MOCK_ROT1, MOCK_BSSID, -48, true),
@@ -160,7 +186,12 @@ fn fill(byte: u64) -> u8 {
160 /// Fabricate a syntactically valid-looking WPA1/WPA2 capture (dummy nonces,186 /// Fabricate a syntactically valid-looking WPA1/WPA2 capture (dummy nonces,
161 /// dummy MIC, dummy M2 EAPOL frame). The cracker would reject these, but the187 /// dummy MIC, dummy M2 EAPOL frame). The cracker would reject these, but the
162 /// UI only displays and exports them.188 /// UI only displays and exports them.
163-pub fn fabricate_handshake(ap: MacAddr, client: MacAddr, essid: &str, salt: u64) -> HandshakeCapture {189+pub fn fabricate_handshake(
190+ ap: MacAddr,
191+ client: MacAddr,
192+ essid: &str,
193+ salt: u64,
194+) -> HandshakeCapture {
164 let mut anonce = [0u8; 32];195 let mut anonce = [0u8; 32];
165 let mut snonce = [0u8; 32];196 let mut snonce = [0u8; 32];
166 let mut mic = [0u8; 16];197 let mut mic = [0u8; 16];
@@ -169,8 +200,8 @@ pub fn fabricate_handshake(ap: MacAddr, client: MacAddr, essid: &str, salt: u64)
169 anonce[i] = fill(rng.next() + i as u64);200 anonce[i] = fill(rng.next() + i as u64);
170 snonce[i] = fill(rng.next() + 7 * i as u64);201 snonce[i] = fill(rng.next() + 7 * i as u64);
171 }202 }
172- for i in 0..16 {203+ for (i, b) in mic.iter_mut().enumerate() {
173- mic[i] = fill(rng.next() + 11 * i as u64);204+ *b = fill(rng.next() + 11 * i as u64);
174 }205 }
175 // EAPOL v1, type Key, 95-byte key descriptor + empty key data: laid out206 // EAPOL v1, type Key, 95-byte key descriptor + empty key data: laid out
176 // so the exporter's MIC-field offset (81..97) lands inside real bytes.207 // so the exporter's MIC-field offset (81..97) lands inside real bytes.
@@ -190,7 +221,37 @@ pub fn fabricate_handshake(ap: MacAddr, client: MacAddr, essid: &str, salt: u64)
190 eapol_m2[17..17 + 32].copy_from_slice(&snonce);221 eapol_m2[17..17 + 32].copy_from_slice(&snonce);
191 // MIC field at EAPOL offset 81..97.222 // MIC field at EAPOL offset 81..97.
192 eapol_m2[81..97].copy_from_slice(&mic);223 eapol_m2[81..97].copy_from_slice(&mic);
193- HandshakeCapture::new(ap, client, essid.to_string(), anonce, snonce, mic, eapol_m2, 2)224+ HandshakeCapture::new(
225+ ap,
226+ client,
227+ essid.to_string(),
228+ anonce,
229+ snonce,
230+ mic,
231+ eapol_m2,
232+ 2,
233+ )
234+}
235+
236+/// Fabricate a partial M2+M3 capture — same dummy-material convention as
237+/// [`fabricate_handshake`], but `partial: true` (`eapol_m2` carries the
238+/// M3 frame with its MIC not zeroed; see [`HandshakeCapture::new_partial`]).
239+/// Exercises the [`Event::HandshakePartial`] path in mock mode.
240+pub fn fabricate_partial(ap: MacAddr, client: MacAddr, essid: &str, salt: u64) -> HandshakeCapture {
241+ let full = fabricate_handshake(ap, client, essid, salt);
242+ // Read the MIC BEFORE the field moves below (the accessor borrows
243+ // the whole capture).
244+ let mic = *full.mic();
245+ HandshakeCapture::new_partial(
246+ full.ap,
247+ full.client,
248+ full.essid,
249+ full.anonce,
250+ full.snonce,
251+ mic,
252+ full.eapol_m2,
253+ full.key_ver,
254+ )
194 }255 }
195 256
196 /// Fabricate a PMKID capture against `ap`, impersonating `client`.257 /// Fabricate a PMKID capture against `ap`, impersonating `client`.
@@ -212,7 +273,7 @@ pub fn fabricate_pmkid(ap: MacAddr, client: MacAddr, essid: &str, salt: u64) ->
212 /// (app exit) — error sends are simply dropped.273 /// (app exit) — error sends are simply dropped.
213 pub fn spawn_mock(tx: Sender<Event>) {274 pub fn spawn_mock(tx: Sender<Event>) {
214 thread::Builder::new()275 thread::Builder::new()
215- .name("wifilab-mock".into())276+ .name("wifi_lab-mock".into())
216 .spawn(move || run(tx))277 .spawn(move || run(tx))
217 .expect("mock thread");278 .expect("mock thread");
218 }279 }
@@ -235,9 +296,14 @@ fn run(tx: Sender<Event>) {
235 let started = Instant::now();296 let started = Instant::now();
236 let mut stage = 0usize;297 let mut stage = 0usize;
237 let mut tick = 0u64;298 let mut tick = 0u64;
238- // Drifting cumulative per-channel counters for the ChannelStats feed.299+ // Drifting cumulative per-channel counters for the ChannelStats feed,
239- let mut chan_frames: [u64; 4] = [120, 980, 340, 60];300+ // one slot per channel of the widest rotating set (see MOCK_CHAN_SETS).
240- let mut chan_beacons: [u64; 4] = [40, 210, 90, 12];301+ let mut chan_frames: [u64; MAX_MOCK_CHANS] = [
302+ 120, 340, 60, 85, 45, 980, 150, 70, 30, 55, 210, 500, 260, 180, 95, 140, 65, 40, 25, 15,
303+ ];
304+ let mut chan_beacons: [u64; MAX_MOCK_CHANS] = [
305+ 40, 90, 12, 20, 8, 210, 33, 15, 6, 11, 55, 120, 60, 44, 22, 31, 14, 9, 5, 3,
306+ ];
241 // Probe-request feed cycles these (client, ssid) pairs.307 // Probe-request feed cycles these (client, ssid) pairs.
242 const PROBE_FEED: &[(MacAddr, Option<&str>)] = &[308 const PROBE_FEED: &[(MacAddr, Option<&str>)] = &[
243 (MOCK_CLIENTS[0], Some("HOME-WIFI")),309 (MOCK_CLIENTS[0], Some("HOME-WIFI")),
@@ -255,7 +321,7 @@ fn run(tx: Sender<Event>) {
255 "hop: ch 6 → ch 11",321 "hop: ch 6 → ch 11",
256 "beacon: corp-wpa3 on ch 36 (SAE)",322 "beacon: corp-wpa3 on ch 36 (SAE)",
257 "hop: ch 36 → ch 44",323 "hop: ch 36 → ch 44",
258- "data frame burst on parafin (297 fps)",324+ "data frame burst on testnet (297 fps)",
259 "probe response coffeeshop (WPA2-PSK)",325 "probe response coffeeshop (WPA2-PSK)",
260 ];326 ];
261 327
@@ -266,9 +332,12 @@ fn run(tx: Sender<Event>) {
266 let now = now_ms();332 let now = now_ms();
267 333
268 // Per-channel activity snapshot every ~2 s (10 ticks).334 // Per-channel activity snapshot every ~2 s (10 ticks).
269- if tick % 10 == 0 {335+ if tick.is_multiple_of(10) {
270- let mut stats = Vec::with_capacity(4);336+ let snapshots = tick / 10;
271- for (i, ch) in [1u8, 6, 11, 36].iter().enumerate() {337+ let set =
338+ MOCK_CHAN_SETS[((snapshots / CHAN_SET_SNAPSHOTS) as usize) % MOCK_CHAN_SETS.len()];
339+ let mut stats = Vec::with_capacity(set.len());
340+ for (i, ch) in set.iter().enumerate() {
272 chan_frames[i] += 20 + rng.below(180);341 chan_frames[i] += 20 + rng.below(180);
273 chan_beacons[i] += rng.below(6);342 chan_beacons[i] += rng.below(6);
274 stats.push(ChannelStat {343 stats.push(ChannelStat {
@@ -281,7 +350,7 @@ fn run(tx: Sender<Event>) {
281 }350 }
282 351
283 // Probe-request feed every ~3 s (15 ticks).352 // Probe-request feed every ~3 s (15 ticks).
284- if tick % 15 == 0 {353+ if tick.is_multiple_of(15) {
285 let (client, ssid) = PROBE_FEED[probe_step % PROBE_FEED.len()];354 let (client, ssid) = PROBE_FEED[probe_step % PROBE_FEED.len()];
286 probe_step += 1;355 probe_step += 1;
287 let _ = tx.send(Event::ProbeObserved(ProbeInfo {356 let _ = tx.send(Event::ProbeObserved(ProbeInfo {
@@ -348,7 +417,7 @@ fn run(tx: Sender<Event>) {
348 match stage {417 match stage {
349 0 => {418 0 => {
350 let _ = tx.send(Event::Log(format!(419 let _ = tx.send(Event::Log(format!(
351- "locking onto parafin ({MOCK_BSSID}, ch 6)"420+ "locking onto testnet ({MOCK_BSSID}, ch 6)"
352 )));421 )));
353 }422 }
354 1 => {423 1 => {
@@ -367,7 +436,7 @@ fn run(tx: Sender<Event>) {
367 }436 }
368 3 => {437 3 => {
369 let cap =438 let cap =
370- fabricate_handshake(MOCK_BSSID, MOCK_CLIENTS[0], "parafin", 0x1234_5678);439+ fabricate_handshake(MOCK_BSSID, MOCK_CLIENTS[0], "testnet", 0x1234_5678);
371 let _ = tx.send(Event::HandshakeComplete(Box::new(cap)));440 let _ = tx.send(Event::HandshakeComplete(Box::new(cap)));
372 stage += 1;441 stage += 1;
373 break;442 break;
@@ -388,15 +457,28 @@ fn run(tx: Sender<Event>) {
388 stage += 1;457 stage += 1;
389 }458 }
390 459
391- if stage >= 5 && (rng.next() % 20 == 0) {460+ // Partial M2+M3 milestone at ~17 s (deterministic): exercises the
392- let _ = tx.send(Event::Log(format!(461+ // HandshakePartial reduction — log line, [partial] picker entry,
393- "{}",462+ // `state.partials`.
394- LOG_LINES[(rng.below(LOG_LINES.len() as u64)) as usize]463+ if stage == 5 && t >= 17.0 {
395- )));464+ let cap = fabricate_partial(
465+ MacAddr([0x02, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e]),
466+ MOCK_CLIENTS[2],
467+ "coffeeshop",
468+ 0xc0ff_ee11,
469+ );
470+ let _ = tx.send(Event::HandshakePartial(Box::new(cap)));
471+ stage += 1;
472+ }
473+
474+ if stage >= 5 && rng.next().is_multiple_of(20) {
475+ let _ = tx.send(Event::Log(
476+ LOG_LINES[(rng.below(LOG_LINES.len() as u64)) as usize].to_string(),
477+ ));
396 }478 }
397 479
398 // Occasionally nudge deauth stats so the log feels alive.480 // Occasionally nudge deauth stats so the log feels alive.
399- if stage >= 5 && t > 20.0 && rng.next() % 40 == 0 {481+ if stage >= 5 && t > 20.0 && rng.next().is_multiple_of(40) {
400 let _ = tx.send(Event::DeauthSent {482 let _ = tx.send(Event::DeauthSent {
401 ap: MOCK_BSSID,483 ap: MOCK_BSSID,
402 target: MOCK_CLIENTS[1],484 target: MOCK_CLIENTS[1],
@@ -405,3 +487,21 @@ fn run(tx: Sender<Event>) {
405 }487 }
406 }488 }
407 }489 }
490+#[cfg(test)]
491+mod tests {
492+ use super::*;
493+
494+ /// The stats feed indexes the per-channel counter arrays by position in
495+ /// the rotating set — a set wider than those arrays panics the mock
496+ /// thread (mock runs are how the UI is developed and screenshotted).
497+ #[test]
498+ fn mock_channel_sets_fit_counter_arrays() {
499+ for set in MOCK_CHAN_SETS {
500+ assert!(
501+ set.len() <= MAX_MOCK_CHANS,
502+ "channel set {set:?} exceeds MAX_MOCK_CHANS={MAX_MOCK_CHANS}"
503+ );
504+ }
505+ assert!(!MOCK_CHAN_SETS.is_empty());
506+ }
507+}
src/ui/mod.rsmodified+7 -5
@@ -1,4 +1,4 @@
1-//! GPUI + gpuikit shell for wifilab.1+//! GPUI + gpuikit shell for wifi_lab.
2 //!2 //!
3 //! `run_app` opens the window and wires the service event channel: the mock3 //! `run_app` opens the window and wires the service event channel: the mock
4 //! generator in [`mock`] (mock mode) or the privileged-service reader thread4 //! generator in [`mock`] (mock mode) or the privileged-service reader thread
@@ -22,15 +22,15 @@ use gpuikit::theme::{GlobalTheme, Theme};
22 /// Launch the UI. Blocks until the window closes.22 /// Launch the UI. Blocks until the window closes.
23 ///23 ///
24 /// `mock_flag` is the CLI `--mock` switch; combined with the legacy24 /// `mock_flag` is the CLI `--mock` switch; combined with the legacy
25-/// `WIFILAB_MOCK` env var. The REAL service is the default: the25+/// `WIFI_LAB_MOCK` env var. The REAL service is the default: the
26 /// [`crate::service::ServiceClient`] spawns lazily on the first26 /// [`crate::service::ServiceClient`] spawns lazily on the first
27 /// "Start capture" click (polkit-elevated child process).27 /// "Start capture" click (polkit-elevated child process).
28 pub fn run_app(iface: Option<String>, mock_flag: bool) {28 pub fn run_app(iface: Option<String>, mock_flag: bool) {
29 let (tx, rx) = crossbeam_channel::unbounded();29 let (tx, rx) = crossbeam_channel::unbounded();
30 30
31- // Mock mode: `--mock` flag or WIFILAB_MOCK=1 (any value except 0/false31+ // Mock mode: `--mock` flag or WIFI_LAB_MOCK=1 (any value except 0/false
32 // counts as 1 when set). Default (neither set) is real mode.32 // counts as 1 when set). Default (neither set) is real mode.
33- let env_mock = match std::env::var_os("WIFILAB_MOCK") {33+ let env_mock = match std::env::var_os("WIFI_LAB_MOCK") {
34 None => false,34 None => false,
35 Some(v) => v != "0" && v != "false",35 Some(v) => v != "0" && v != "false",
36 };36 };
@@ -63,12 +63,14 @@ pub fn run_app(iface: Option<String>, mock_flag: bool) {
63 .run(move |cx: &mut App| {63 .run(move |cx: &mut App| {
64 gpuikit::init(cx);64 gpuikit::init(cx);
65 cx.set_global(GlobalTheme(Arc::new(Theme::gruvbox_dark())));65 cx.set_global(GlobalTheme(Arc::new(Theme::gruvbox_dark())));
66+ // Window-level shortcuts: ctrl-q quit, ctrl-1..4 page switch.
67+ app::bind_app_keys(cx);
66 68
67 let window = cx69 let window = cx
68 .open_window(70 .open_window(
69 WindowOptions {71 WindowOptions {
70 titlebar: Some(TitlebarOptions {72 titlebar: Some(TitlebarOptions {
71- title: Some("wifilab".into()),73+ title: Some("wifi_lab".into()),
72 ..Default::default()74 ..Default::default()
73 }),75 }),
74 window_bounds: Some(WindowBounds::Windowed(Bounds {76 window_bounds: Some(WindowBounds::Windowed(Bounds {
src/ui/networks.rsmodified+713 -194
@@ -4,7 +4,6 @@
4 use gpui::{Context, Entity, IntoElement, ParentElement, Styled, Window, div, px};4 use gpui::{Context, Entity, IntoElement, ParentElement, Styled, Window, div, px};
5 use gpuikit::elements::badge::badge;5 use gpuikit::elements::badge::badge;
6 use gpuikit::elements::button::button;6 use gpuikit::elements::button::button;
7-use gpuikit::elements::progress::progress;
8 use gpuikit::elements::table::{CellAlign, Column, Row, SortDirection, Table, table};7 use gpuikit::elements::table::{CellAlign, Column, Row, SortDirection, Table, table};
9 use gpuikit::elements::text_field::text_field;8 use gpuikit::elements::text_field::text_field;
10 use gpuikit::elements::typography::{h3, small, text};9 use gpuikit::elements::typography::{h3, small, text};
@@ -18,17 +17,19 @@ use std::collections::VecDeque;
18 17
19 const COL_BSSID: usize = 0;18 const COL_BSSID: usize = 0;
20 const COL_SSID: usize = 1;19 const COL_SSID: usize = 1;
20+/// Risk tags (`rogue?` / `weak`) that used to be stacked under the SSID.
21+const COL_FLAGS: usize = 2;
21 // Column-order documentation; vendor columns are not sortable, so nothing22 // Column-order documentation; vendor columns are not sortable, so nothing
22 // references these by value (sort arms only name the sortable consts).23 // references these by value (sort arms only name the sortable consts).
23 #[allow(dead_code)]24 #[allow(dead_code)]
24-const COL_VENDOR: usize = 2;25+const COL_VENDOR: usize = 3;
25-const COL_LABEL: usize = 3;26+const COL_LABEL: usize = 4;
26-const COL_CH: usize = 4;27+const COL_CH: usize = 5;
27-const COL_BAND: usize = 5;28+const COL_BAND: usize = 6;
28-const COL_SEC: usize = 6;29+const COL_SEC: usize = 7;
29-const COL_RSSI: usize = 7;30+const COL_RSSI: usize = 8;
30-const COL_BEACONS: usize = 8;31+const COL_BEACONS: usize = 9;
31-const COL_AGE: usize = 9;32+const COL_AGE: usize = 10;
32 33
33 const CCOL_MAC: usize = 0;34 const CCOL_MAC: usize = 0;
34 #[allow(dead_code)]35 #[allow(dead_code)]
@@ -76,10 +77,6 @@ pub(crate) fn sec_badge_label(label: &str, sec: Security) -> gpuikit::elements::
76 }77 }
77 }78 }
78 79
79-fn sec_badge(sec: Security) -> gpuikit::elements::badge::Badge {
80- sec_badge_label(sec.label(), sec)
81-}
82-
83 /// Refined security label for the badge. The AKM suites of the RSN IE know80 /// Refined security label for the badge. The AKM suites of the RSN IE know
84 /// more than the broad `Security` buckets: a transition AP (PSK+SAE) reads81 /// more than the broad `Security` buckets: a transition AP (PSK+SAE) reads
85 /// `WPA2/3`, an SAE-only AP reads `WPA3`, an OWE-only AP `OWE`.82 /// `WPA2/3`, an SAE-only AP reads `WPA3`, an OWE-only AP `OWE`.
@@ -153,10 +150,7 @@ fn norm_ssid(s: &str) -> String {
153 /// right-aligned in recency order (last 20 values), padded to a stable150 /// right-aligned in recency order (last 20 values), padded to a stable
154 /// 20-slot width with transparent placeholders. Height maps rssi -95..-30151 /// 20-slot width with transparent placeholders. Height maps rssi -95..-30
155 /// dBm onto 2..10 px.152 /// dBm onto 2..10 px.
156-pub(crate) fn sparkline(153+pub(crate) fn sparkline(hist: Option<&VecDeque<i8>>, accent: gpui::Hsla) -> gpui::AnyElement {
157- hist: Option<&VecDeque<i8>>,
158- accent: gpui::Hsla,
159-) -> gpui::AnyElement {
160 let mut bars: Vec<gpui::Div> = Vec::with_capacity(20);154 let mut bars: Vec<gpui::Div> = Vec::with_capacity(20);
161 if let Some(hist) = hist {155 if let Some(hist) = hist {
162 for &r in hist.iter().rev().take(20) {156 for &r in hist.iter().rev().take(20) {
@@ -192,11 +186,12 @@ fn prefill_label(app: &AppRoot, mac: MacAddr, cx: &mut Context<AppRoot>) {
192 }186 }
193 187
194 /// Save button: write the input as the label of the current target (empty188 /// Save button: write the input as the label of the current target (empty
195-/// input = clear), then persist the whole map to `~/wifilab/labels.json`.189+/// input = clear), then persist the whole map to `~/wifi_lab/labels.json`.
196 fn save_label(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {190 fn save_label(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App) {
197 view.update(cx, |app, cx| {191 view.update(cx, |app, cx| {
198 let Some(mac) = label_target(app) else {192 let Some(mac) = label_target(app) else {
199- app.state.push_log("label: select an AP or client row first");193+ app.state
194+ .push_log("label: select an AP or client row first");
200 cx.notify();195 cx.notify();
201 return;196 return;
202 };197 };
@@ -216,13 +211,102 @@ fn save_label(view: &Entity<AppRoot>, _window: &mut Window, cx: &mut gpui::App)
216 });211 });
217 }212 }
218 213
214+/// One risk tag of an AP. `severity` orders the FLAGS column and the
215+/// briefing list (higher = worse). [`risk_tags`] is the single source of
216+/// truth: the column, its sorting and the Attacks briefing all read it, so
217+/// a new tag is one line there.
218+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
219+pub(crate) struct RiskTag {
220+ pub(crate) label: &'static str,
221+ pub(crate) severity: u8,
222+}
223+
224+/// Every risk tag of `ap`, worst first. Today: `rogue?` (same SSID on a
225+/// different BSSID with different security) and `weak` (Open/WEP).
226+pub(crate) fn risk_tags(
227+ ap: &AccessPoint,
228+ rogues: &std::collections::HashSet<String>,
229+) -> Vec<RiskTag> {
230+ let mut tags = Vec::new();
231+ if !ap.ssid.is_empty() && rogues.contains(&norm_ssid(&ap.ssid)) {
232+ tags.push(RiskTag {
233+ label: "rogue?",
234+ severity: 2,
235+ });
236+ }
237+ if matches!(ap.security, Security::Open | Security::Wep) {
238+ tags.push(RiskTag {
239+ label: "weak",
240+ severity: 1,
241+ });
242+ }
243+ tags.sort_by_key(|t| std::cmp::Reverse(t.severity));
244+ tags
245+}
246+
247+/// Risk rank for sorting the FLAGS column: severity of the worst tag (0 =
248+/// no tags). Higher = worse.
249+pub(crate) fn risk_rank(ap: &AccessPoint, rogues: &std::collections::HashSet<String>) -> u8 {
250+ risk_tags(ap, rogues).first().map_or(0, |t| t.severity)
251+}
252+
253+/// Width budget of the FLAGS column — fixed, so badges can never push the
254+/// neighbouring columns around.
255+const FLAGS_W: f32 = 150.;
256+/// Gap between badges (mirrors the cell's `gap_2`).
257+const FLAGS_GAP: f32 = 8.;
258+/// Width of the `+N` overflow marker (`text_xs` text).
259+const FLAGS_MORE_W: f32 = 26.;
260+
261+/// Estimated width of one badge: Small control metrics are 16 px tall with
262+/// 6 px horizontal padding, a 1 px border per side and 11 px semibold text
263+/// (≈ 7 px per character at this scale). The estimate only decides how many
264+/// badges to draw — the cell also clips, so an under-estimate can never
265+/// bleed into the next column.
266+fn badge_width(label: &str) -> f32 {
267+ label.chars().count() as f32 * 7.0 + 14.0
268+}
269+
270+/// How many of `tags` fit the FLAGS column: `(shown, hidden)`. Whatever does
271+/// not fit collapses into one `+N` marker, so ten tags still occupy a single
272+/// constant-width cell; the full list stays readable on the Attacks
273+/// briefing card.
274+fn fit_tags(tags: &[RiskTag], width: f32) -> (usize, usize) {
275+ if tags.is_empty() {
276+ return (0, 0);
277+ }
278+ // Width of the first `n` badges, gaps included.
279+ let drawn = |n: usize| -> f32 {
280+ if n == 0 {
281+ 0.0
282+ } else {
283+ tags[..n].iter().map(|t| badge_width(t.label)).sum::<f32>() + FLAGS_GAP * (n - 1) as f32
284+ }
285+ };
286+ if drawn(tags.len()) <= width {
287+ return (tags.len(), 0);
288+ }
289+ // Drop tags from the tail until the survivors plus the marker fit.
290+ for shown in (0..tags.len()).rev() {
291+ let marker = if shown > 0 { FLAGS_GAP } else { 0.0 } + FLAGS_MORE_W;
292+ if drawn(shown) + marker <= width {
293+ return (shown, tags.len() - shown);
294+ }
295+ }
296+ (0, tags.len())
297+}
298+
219 fn sorted_aps(app: &AppRoot) -> Vec<AccessPoint> {299 fn sorted_aps(app: &AppRoot) -> Vec<AccessPoint> {
220 let mut rows: Vec<AccessPoint> = app.state.aps.values().cloned().collect();300 let mut rows: Vec<AccessPoint> = app.state.aps.values().cloned().collect();
221 if let Some(sort) = app.ap_sort {301 if let Some(sort) = app.ap_sort {
222 let labels = &app.state.labels;302 let labels = &app.state.labels;
303+ let rogues = &app.state.rogue_ssids;
223 let ord = |l: &AccessPoint, r: &AccessPoint| match sort.column {304 let ord = |l: &AccessPoint, r: &AccessPoint| match sort.column {
224 COL_BSSID => l.bssid.cmp(&r.bssid),305 COL_BSSID => l.bssid.cmp(&r.bssid),
225 COL_SSID => l.ssid.cmp(&r.ssid).then_with(|| l.bssid.cmp(&r.bssid)),306 COL_SSID => l.ssid.cmp(&r.ssid).then_with(|| l.bssid.cmp(&r.bssid)),
307+ COL_FLAGS => risk_rank(l, rogues)
308+ .cmp(&risk_rank(r, rogues))
309+ .then_with(|| l.bssid.cmp(&r.bssid)),
226 COL_LABEL => labels310 COL_LABEL => labels
227 .get(&l.bssid)311 .get(&l.bssid)
228 .cmp(&labels.get(&r.bssid))312 .cmp(&labels.get(&r.bssid))
@@ -255,17 +339,16 @@ fn sorted_clients(app: &AppRoot) -> Vec<ClientInfo> {
255 .cmp(&labels.get(&r.mac))339 .cmp(&labels.get(&r.mac))
256 .then_with(|| l.mac.cmp(&r.mac)),340 .then_with(|| l.mac.cmp(&r.mac)),
257 CCOL_AP => {341 CCOL_AP => {
258- // Sort by what the column shows: the AP's SSID (bssid falls342+ // Sort by what the column shows: the AP's SSID (bssid falls
259- // back behind named entries, ties on raw MAC).343+ // back behind named entries, ties on raw MAC).
260- let key = |c: &ClientInfo| {344+ let key = |c: &ClientInfo| {
261- c.ap345+ c.ap.and_then(|b| app.state.aps.get(&b))
262- .and_then(|b| app.state.aps.get(&b))346+ .filter(|a| !a.ssid.is_empty())
263- .filter(|a| !a.ssid.is_empty())347+ .map(|a| a.ssid.to_lowercase())
264- .map(|a| a.ssid.to_lowercase())348+ .unwrap_or_else(|| "\u{10ffff}".into())
265- .unwrap_or_else(|| "\u{10ffff}".into())349+ };
266- };350+ key(l).cmp(&key(r)).then_with(|| l.ap.cmp(&r.ap))
267- key(l).cmp(&key(r)).then_with(|| l.ap.cmp(&r.ap))351+ }
268- }
269 CCOL_RSSI => l.rssi_dbm.cmp(&r.rssi_dbm),352 CCOL_RSSI => l.rssi_dbm.cmp(&r.rssi_dbm),
270 CCOL_FRAMES => l.frames.cmp(&r.frames),353 CCOL_FRAMES => l.frames.cmp(&r.frames),
271 CCOL_AGE => l.last_seen_ms.cmp(&r.last_seen_ms).reverse(),354 CCOL_AGE => l.last_seen_ms.cmp(&r.last_seen_ms).reverse(),
@@ -291,8 +374,9 @@ fn ap_table(app: &AppRoot, view: &Entity<AppRoot>) -> Table<AccessPoint> {
291 .map(|ap| {374 .map(|ap| {
292 let bssid = ap.bssid;375 let bssid = ap.bssid;
293 let view = view.clone();376 let view = view.clone();
294- Row::new(ap).selected(selected == Some(bssid)).on_click(377+ Row::new(ap)
295- move |_window, cx| {378+ .selected(selected == Some(bssid))
379+ .on_click(move |_window, cx| {
296 view.update(cx, |app, cx| {380 view.update(cx, |app, cx| {
297 app.selected = Some(bssid);381 app.selected = Some(bssid);
298 // Keep the target's AP row for the Attacks card —382 // Keep the target's AP row for the Attacks card —
@@ -306,8 +390,7 @@ fn ap_table(app: &AppRoot, view: &Entity<AppRoot>) -> Table<AccessPoint> {
306 app.state.push_log(format!("target selected: {bssid}"));390 app.state.push_log(format!("target selected: {bssid}"));
307 cx.notify();391 cx.notify();
308 });392 });
309- },393+ })
310- )
311 })394 })
312 .collect::<Vec<_>>();395 .collect::<Vec<_>>();
313 396
@@ -323,29 +406,52 @@ fn ap_table(app: &AppRoot, view: &Entity<AppRoot>) -> Table<AccessPoint> {
323 .min_width(px(150.)),406 .min_width(px(150.)),
324 )407 )
325 .column({408 .column({
326- let rogues = rogues.clone();409+ Column::new("SSID", |ap: &AccessPoint, _w, _cx| {
327- Column::new("SSID", move |ap: &AccessPoint, _w, _cx| {410+ // SSID text only — risk tags live in the FLAGS column (they
328- let mut cell = h_stack().gap_2().items_center().child(div().child(411+ // used to be stacked under the SSID, which made the column
329- if ap.ssid.is_empty() {412+ // two lines tall and squeezed the text).
413+ div()
414+ .w_full()
415+ .overflow_hidden()
416+ .text_ellipsis()
417+ .whitespace_nowrap()
418+ .child(if ap.ssid.is_empty() {
330 "<hidden>".to_string()419 "<hidden>".to_string()
331 } else {420 } else {
332 ap.ssid.clone()421 ap.ssid.clone()
333- },422+ })
334- ));423+ .into_any_element()
335- if !ap.ssid.is_empty() && rogues.contains(&norm_ssid(&ap.ssid)) {
336- cell = cell.child(badge("rogue?").destructive());
337- }
338- // Weak-encryption marker: Open/WEP is a liability everyone
339- // in range should notice straight away.
340- if matches!(ap.security, Security::Open | Security::Wep) {
341- cell = cell.child(badge("weak").destructive());
342- }
343- cell.into_any_element()
344 })424 })
345 .sortable()425 .sortable()
346 .flex(2.0)426 .flex(2.0)
347 .min_width(px(120.))427 .min_width(px(120.))
348 })428 })
429+ .column({
430+ let rogues = rogues.clone();
431+ Column::new("FLAGS", move |ap: &AccessPoint, _w, _cx| {
432+ let tags = risk_tags(ap, &rogues);
433+ // Constant-width cell: badges that do not fit collapse into
434+ // `+N` (full list on the Attacks briefing), and the cell
435+ // clips as a hard backstop — gpuikit cells do not clip by
436+ // themselves, so no badge can paint over VENDOR.
437+ let (shown, hidden) = fit_tags(&tags, FLAGS_W);
438+ let mut row = h_stack().gap_2().items_center();
439+ for tag in tags.iter().take(shown) {
440+ row = row.child(badge(tag.label).destructive());
441+ }
442+ if hidden > 0 {
443+ row = row.child(small(format!("+{hidden}")).muted());
444+ }
445+ div()
446+ .w(px(FLAGS_W))
447+ .flex_none()
448+ .overflow_hidden()
449+ .child(row)
450+ .into_any_element()
451+ })
452+ .sortable()
453+ .fixed(px(FLAGS_W))
454+ })
349 .column(455 .column(
350 Column::new("VENDOR", |ap: &AccessPoint, _w, _cx| {456 Column::new("VENDOR", |ap: &AccessPoint, _w, _cx| {
351 div().child(vendor_of(&ap.bssid)).into_any_element()457 div().child(vendor_of(&ap.bssid)).into_any_element()
@@ -385,30 +491,46 @@ fn ap_table(app: &AppRoot, view: &Entity<AppRoot>) -> Table<AccessPoint> {
385 .end(),491 .end(),
386 )492 )
387 .column(493 .column(
388-Column::new("SEC", |ap: &AccessPoint, _w, _cx| {494+ Column::new("SEC", |ap: &AccessPoint, _w, _cx| {
389- // Fixed-width badge slot: the AKM text starts at the same x in495+ // Fixed-width badge slot: the AKM text starts at the same x in
390- // every row regardless of badge-label width.496+ // every row regardless of badge-label width. 64 px fits the
391- let badge_slot = div()497+ // longest badge ("WPA2/3"); 52 clipped it mid-glyph over the
392- .w(px(52.))498+ // AKM text. The cell itself is bounded so an over-long AKM join
393- .flex_none()499+ // ellipsizes instead of painting into SIGNAL.
394- .child(sec_badge_label(&sec_label(ap), ap.security));500+ let badge_slot = div()
395- let joined = ap501+ .w(px(64.))
396- .akms502+ .flex_none()
397- .iter()503+ .child(sec_badge_label(&sec_label(ap), ap.security));
398- .map(|a| a.label())504+ let joined = ap
399- .collect::<Vec<_>>()505+ .akms
400- .join("+");506+ .iter()
401- let mut cell = h_stack().gap_1().items_center().child(badge_slot);507+ .map(|a| a.label())
402- if !joined.is_empty() {508+ .collect::<Vec<_>>()
403- cell = cell509+ .join("+");
404- .child(div().flex_none().whitespace_nowrap().child(small(joined)))510+ let mut cell = h_stack()
405- .justify_start();511+ .gap_1()
406- }512+ .items_center()
407- cell.into_any_element()513+ .w_full()
408- })514+ .overflow_hidden()
409- .sortable()515+ .child(badge_slot);
410- .fixed(px(170.))516+ if !joined.is_empty() {
411- .align(CellAlign::Center),517+ cell = cell
518+ .child(
519+ div()
520+ .flex_1()
521+ .min_w_0()
522+ .overflow_hidden()
523+ .text_ellipsis()
524+ .whitespace_nowrap()
525+ .child(small(joined)),
526+ )
527+ .justify_start();
528+ }
529+ cell.into_any_element()
530+ })
531+ .sortable()
532+ .fixed(px(170.))
533+ .align(CellAlign::Center),
412 )534 )
413 .column({535 .column({
414 let rssi_hist = rssi_hist.clone();536 let rssi_hist = rssi_hist.clone();
@@ -648,17 +770,15 @@ fn probe_table(app: &AppRoot) -> Table<ProbeInfo> {
648 )770 )
649 .column({771 .column({
650 let rogues = rogues.clone();772 let rogues = rogues.clone();
651- Column::new("SSID", move |p: &ProbeInfo, _w, cx| {773+ Column::new("SSID", move |p: &ProbeInfo, _w, cx| match &p.ssid {
652- match &p.ssid {774+ Some(s) => {
653- Some(s) => {775+ let mut cell = div().child(s.clone());
654- let mut cell = div().child(s.clone());776+ if !s.is_empty() && rogues.contains(&norm_ssid(s)) {
655- if !s.is_empty() && rogues.contains(&norm_ssid(s)) {777+ cell = cell.text_color(cx.theme().warning());
656- cell = cell.text_color(cx.theme().warning());
657- }
658- cell.into_any_element()
659 }778 }
660- None => div().child("<any>").into_any_element(),779+ cell.into_any_element()
661 }780 }
781+ None => div().child("<any>").into_any_element(),
662 })782 })
663 .flex(2.0)783 .flex(2.0)
664 .min_width(px(120.))784 .min_width(px(120.))
@@ -684,54 +804,131 @@ fn probe_table(app: &AppRoot) -> Table<ProbeInfo> {
684 .empty("No probe requests observed")804 .empty("No probe requests observed")
685 }805 }
686 806
687-/// Per-channel activity strip: one cell per observed channel with a small807+/// Fixed row count per activity column. Constant by design: the block must
688-/// progress bar scaled to the busiest channel. Hidden when idle. Used as808+/// not resize when channels appear or disappear.
689-/// the fallback of [`channel_activity`] until the timeline has ≥2809+const TL_ROWS: usize = 8;
690-/// snapshots.810+/// Per-snapshot columns drawn per row (older samples scroll off the left).
691-fn channel_strip(app: &AppRoot) -> Option<gpui::AnyElement> {811+const TL_COLUMNS: usize = 45;
692- let mut stats = app.state.channel_stats.clone();812+/// AP count on one channel that triggers the crowded warning.
693- if stats.is_empty() {813+const TL_CROWD_WARN: usize = 4;
694- return None;814+/// Width one column block needs: channel label + [`TL_COLUMNS`] cells + the
815+/// trailing frame counter, plus stack gaps. Blocks are laid out side by
816+/// side, so extra channels cost WIDTH, never height.
817+const TL_BLOCK_WIDTH: f32 = 360.;
818+/// Hard cap on side-by-side blocks (4 × 8 = 32 channels on screen).
819+const TL_MAX_BLOCKS: usize = 4;
820+/// Horizontal space that is not the timeline (page nav, paddings) — ignored
821+/// when deciding how many blocks fit.
822+const TL_RESERVED_WIDTH: f32 = 220.;
823+
824+/// One timeline row. A blank slot (`channel: None`) exists purely to keep
825+/// the block's height constant.
826+#[derive(Clone, Debug, PartialEq)]
827+struct TimelineRow {
828+ channel: Option<u8>,
829+ /// Frame deltas per snapshot, oldest→newest (may exceed [`TL_COLUMNS`];
830+ /// the renderer shows the newest columns).
831+ deltas: Vec<u64>,
832+ /// Cumulative frames seen for the channel — shown before a second
833+ /// snapshot makes a delta meaningful.
834+ total: u64,
835+ /// APs currently on the channel.
836+ aps: usize,
837+}
838+
839+/// The rendered timeline: `blocks` side-by-side column stacks of exactly
840+/// [`TL_ROWS`] rows each, plus how many channels the newest snapshot
841+/// reported and how many of them made it on screen.
842+#[derive(Clone, Debug, Default, PartialEq)]
843+struct TimelineView {
844+ blocks: Vec<Vec<TimelineRow>>,
845+ shown: usize,
846+ active: usize,
847+}
848+
849+/// Lay the timeline out for `available_width` px of horizontal space: the
850+/// busiest channels of the newest snapshot — ordered by channel number and
851+/// split into side-by-side column blocks of [`TL_ROWS`] rows — padded to
852+/// whole blocks with blank rows. The row count per block (and therefore the
853+/// block height) is constant whatever the channel set does; channels beyond
854+/// the width's capacity are dropped by frame count, and the caller reports
855+/// them via [`TimelineView::active`] vs [`TimelineView::shown`].
856+fn timeline_view(
857+ tl: &VecDeque<Vec<crate::common::ChannelStat>>,
858+ crowd: &std::collections::HashMap<u8, usize>,
859+ available_width: f32,
860+) -> TimelineView {
861+ let Some(latest) = tl.back() else {
862+ return TimelineView::default();
863+ };
864+ let mut busy = latest.clone();
865+ busy.sort_by_key(|s| std::cmp::Reverse(s.frames));
866+ let active = busy.len();
867+ let blocks = (((available_width.max(0.) / TL_BLOCK_WIDTH) as usize).clamp(1, TL_MAX_BLOCKS))
868+ .min(active.div_ceil(TL_ROWS).max(1));
869+ let capacity = blocks * TL_ROWS;
870+ busy.truncate(capacity);
871+ busy.sort_by_key(|s| s.channel);
872+
873+ let mut rows: Vec<TimelineRow> = busy
874+ .into_iter()
875+ .map(|b| {
876+ // Frame series across the snapshots that reported this channel
877+ // (missed snapshots are skipped, minor skew).
878+ let series: Vec<u64> = tl
879+ .iter()
880+ .filter_map(|snap| {
881+ snap.iter()
882+ .find(|s| s.channel == b.channel)
883+ .map(|s| s.frames)
884+ })
885+ .collect();
886+ TimelineRow {
887+ channel: Some(b.channel),
888+ deltas: series
889+ .windows(2)
890+ .map(|w| w[1].saturating_sub(w[0]))
891+ .collect(),
892+ total: series.last().copied().unwrap_or(b.frames),
893+ aps: *crowd.get(&b.channel).unwrap_or(&0),
894+ }
895+ })
896+ .collect();
897+ let shown = rows.len();
898+ while rows.len() < capacity {
899+ rows.push(TimelineRow {
900+ channel: None,
901+ deltas: Vec::new(),
902+ total: 0,
903+ aps: 0,
904+ });
905+ }
906+ TimelineView {
907+ blocks: rows.chunks(TL_ROWS).map(|c| c.to_vec()).collect(),
908+ shown,
909+ active,
695 }910 }
696- stats.sort_by_key(|s| s.channel);
697- let max_frames = stats.iter().map(|s| s.frames).max().unwrap_or(0);
698- Some(
699- h_stack()
700- .gap_3()
701- .items_center()
702- .children(stats.into_iter().map(|s| {
703- let frac = if max_frames < 1 {
704- 0.0
705- } else {
706- s.frames as f32 / max_frames as f32
707- };
708- v_stack()
709- .gap_1()
710- .child(small(format!("ch{}", s.channel)))
711- .child(progress(frac).width(px(60.)).height(px(4.)))
712- .child(small(s.frames.to_string()))
713- }))
714- .into_any_element(),
715- )
716 }911 }
717 912
718-/// Timeline over the static strip: one row per busiest channel (max 8),913+/// Timeline of per-channel activity: one row per busiest channel, each row
719-/// each row a right-aligned run of per-snapshot frame-delta columns914+/// a right-aligned run of per-snapshot frame-delta columns (opacity =
720-/// (opacity = relative intensity). A channel hosting ≥4 APs gets a915+/// relative intensity). A channel hosting ≥4 APs gets a crowded warning —
721-/// crowded warning — overlapping BSSs eat each other's airtime.916+/// overlapping BSSs eat each other's airtime.
722-fn channel_timeline(app: &AppRoot, theme: &gpuikit::theme::Theme) -> Option<gpui::AnyElement> {917+///
918+/// Rows are laid out in side-by-side column blocks sized to the available
919+/// width, so a wide window shows more channels instead of wasting the space
920+/// to the right. Every block always renders exactly [`TL_ROWS`] rows —
921+/// unused slots are blank placeholders, same geometry — so channels entering
922+/// or leaving the scan never resize the block: the tables below stay put.
923+fn channel_timeline(
924+ app: &AppRoot,
925+ theme: &gpuikit::theme::Theme,
926+ available_width: f32,
927+) -> Option<gpui::AnyElement> {
723 let tl = &app.state.chan_timeline;928 let tl = &app.state.chan_timeline;
724- if tl.len() < 2 {929+ if tl.is_empty() {
725 return None;930 return None;
726 }931 }
727- const COLUMNS: usize = 45;
728- const CROWD_WARN: usize = 4;
729-
730- // Busiest channels by latest cumulative frame count.
731- let latest = tl.back().expect("len checked");
732- let mut busy: Vec<crate::common::ChannelStat> = latest.clone();
733- busy.sort_by_key(|s| std::cmp::Reverse(s.frames));
734- busy.truncate(8);
735 932
736 // AP count per channel → crowded-channel warning.933 // AP count per channel → crowded-channel warning.
737 let mut crowd: std::collections::HashMap<u8, usize> = std::collections::HashMap::new();934 let mut crowd: std::collections::HashMap<u8, usize> = std::collections::HashMap::new();
@@ -742,87 +939,119 @@ fn channel_timeline(app: &AppRoot, theme: &gpuikit::theme::Theme) -> Option<gpui
742 }939 }
743 940
744 let accent = theme.accent();941 let accent = theme.accent();
745- let rows: Vec<gpui::AnyElement> = busy942+ // One row builder for data AND placeholder rows: identical geometry is
746- .iter()943+ // what keeps the block height constant.
747- .filter_map(|b| {944+ let build_row = |label_text: String, warn: bool, cols: Vec<gpui::Div>, trailer: String| {
748- let ch = b.channel;945+ let mut label = div().w(px(80.)).flex_none().text_xs();
749- // Frame series for this channel across snapshots the scanner946+ label = if warn {
750- // reported it in (missed snapshots are skipped, minor skew).947+ label.text_color(theme.warning())
751- let series: Vec<u64> = tl948+ } else {
752- .iter()949+ label.text_color(theme.fg_muted())
753- .filter_map(|snap| snap.iter().find(|s| s.channel == ch).map(|s| s.frames))950+ };
754- .collect();951+ h_stack()
755- let deltas: Vec<u64> = series952+ .gap_2()
756- .windows(2)953+ .items_center()
757- .map(|w| w[1].saturating_sub(w[0]))954+ .child(label.child(label_text))
758- .collect();955+ .child(h_stack().items_end().children(cols))
759- if deltas.is_empty() {956+ .child(
760- return None;957+ div()
761- }958+ .w(px(70.))
762- let max = deltas.iter().copied().max().unwrap_or(0).max(1) as f32;959+ .flex_none()
763- let shown: &[u64] = &deltas[deltas.len().saturating_sub(COLUMNS)..];960+ .text_xs()
764- let mut cols: Vec<gpui::Div> = Vec::with_capacity(COLUMNS);961+ .text_color(theme.fg_muted())
765- // Left-pad quiet history so rows align at the newest edge.962+ .child(trailer),
766- for _ in 0..COLUMNS.saturating_sub(shown.len()) {
767- cols.push(div().w(px(4.)).h(px(12.)));
768- }
769- for &d in shown {
770- let a = 0.15 + 0.85 * (d as f32 / max);
771- cols.push(div().w(px(4.)).h(px(12.)).bg(accent.opacity(a)));
772- }
773- let crowd_n = *crowd.get(&ch).unwrap_or(&0);
774- let mut label = div().w(px(80.)).flex_none().text_xs();
775- let label_text = if crowd_n >= CROWD_WARN {
776- format!("ch{ch} ⚠{crowd_n} APs")
777- } else {
778- format!("ch{ch}")
779- };
780- if crowd_n >= CROWD_WARN {
781- label = label.text_color(theme.warning());
782- } else {
783- label = label.text_color(theme.fg_muted());
784- }
785- let last_delta = *deltas.last().unwrap_or(&0);
786- Some(
787- h_stack()
788- .gap_2()
789- .items_center()
790- .child(label.child(label_text))
791- .child(h_stack().items_end().children(cols))
792- .child(
793- div()
794- .w(px(70.))
795- .flex_none()
796- .text_xs()
797- .text_color(theme.fg_muted())
798- .child(format!("{last_delta} fr")),
799- )
800- .into_any_element(),
801 )963 )
964+ .into_any_element()
965+ };
966+ let blank_cols = || (0..TL_COLUMNS).map(|_| div().w(px(4.)).h(px(12.)));
967+
968+ let view = timeline_view(tl, &crowd, available_width);
969+ let render_row = |r: &TimelineRow| -> gpui::AnyElement {
970+ let Some(ch) = r.channel else {
971+ // Unused slot: invisible, but occupying its row. The NBSP
972+ // keeps the label/trailer line boxes at full text height so
973+ // blank rows match data rows exactly.
974+ return build_row(
975+ "\u{00a0}".to_string(),
976+ false,
977+ blank_cols().collect(),
978+ "\u{00a0}".to_string(),
979+ );
980+ };
981+ let max = r.deltas.iter().copied().max().unwrap_or(0).max(1) as f32;
982+ let shown: &[u64] = &r.deltas[r.deltas.len().saturating_sub(TL_COLUMNS)..];
983+ let mut cols: Vec<gpui::Div> = Vec::with_capacity(TL_COLUMNS);
984+ // Left-pad quiet history so rows align at the newest edge.
985+ cols.extend(blank_cols().take(TL_COLUMNS.saturating_sub(shown.len())));
986+ for &d in shown {
987+ let a = 0.15 + 0.85 * (d as f32 / max);
988+ cols.push(div().w(px(4.)).h(px(12.)).bg(accent.opacity(a)));
989+ }
990+ let warn = r.aps >= TL_CROWD_WARN;
991+ let label_text = if warn {
992+ format!("ch{ch} ⚠{} APs", r.aps)
993+ } else {
994+ format!("ch{ch}")
995+ };
996+ // Before a second snapshot there is no delta to show — the row
997+ // carries the cumulative count instead of a misleading `0 fr`.
998+ let last = r.deltas.last().copied().unwrap_or(r.total);
999+ build_row(label_text, warn, cols, format!("{last} fr"))
1000+ };
1001+ // Side by side: extra channels widen the block, they never make it
1002+ // taller.
1003+ let blocks: Vec<gpui::AnyElement> = view
1004+ .blocks
1005+ .iter()
1006+ .map(|block| {
1007+ v_stack()
1008+ .gap_1()
1009+ .flex_none()
1010+ .children(block.iter().map(&render_row).collect::<Vec<_>>())
1011+ .into_any_element()
802 })1012 })
803 .collect();1013 .collect();
804- if rows.is_empty() {1014+ let header = if tl.len() < 2 {
805- return None;1015+ "channel activity — first snapshot, waiting for deltas".to_string()
806- }1016+ } else {
1017+ let mut h = format!(
1018+ "channel activity — last {} snapshots (one column each), brightest = busiest",
1019+ tl.len()
1020+ );
1021+ if view.active > view.shown {
1022+ h.push_str(&format!(
1023+ " · {} busiest of {} active channels shown",
1024+ view.shown, view.active
1025+ ));
1026+ }
1027+ h
1028+ };
807 Some(1029 Some(
808 v_stack()1030 v_stack()
809 .gap_1()1031 .gap_1()
810- .child(small(format!(1032+ .child(small(header))
811- "channel activity — last {} snapshots (one column each), brightest = busiest",1033+ .child(h_stack().gap_6().items_start().children(blocks))
812- tl.len()
813- )))
814- .children(rows)
815 .into_any_element(),1034 .into_any_element(),
816 )1035 )
817 }1036 }
818 1037
819-/// Channel activity visualization: scrolling timeline once ≥2 snapshots1038+/// Channel activity visualization: the fixed-height per-channel timeline,
820-/// exist, static strip before that, hidden when silent.1039+/// hidden only until the first snapshot arrives. `available_width` is the
821-fn channel_activity(app: &AppRoot, theme: &gpuikit::theme::Theme) -> Option<gpui::AnyElement> {1040+/// window width the timeline may occupy.
822- channel_timeline(app, theme).or_else(|| channel_strip(app))1041+fn channel_activity(
1042+ app: &AppRoot,
1043+ theme: &gpuikit::theme::Theme,
1044+ available_width: f32,
1045+) -> Option<gpui::AnyElement> {
1046+ channel_timeline(app, theme, available_width)
823 }1047 }
824 1048
825-pub fn render(app: &mut AppRoot, view: &Entity<AppRoot>, _window: &mut Window, cx: &mut Context<AppRoot>) -> gpui::Div {1049+pub fn render(
1050+ app: &mut AppRoot,
1051+ view: &Entity<AppRoot>,
1052+ window: &mut Window,
1053+ cx: &mut Context<AppRoot>,
1054+) -> gpui::Div {
826 // Persistent label editor: applies to the selected row (a selected1055 // Persistent label editor: applies to the selected row (a selected
827 // client wins over the selected AP — see [`label_target`]).1056 // client wins over the selected AP — see [`label_target`]).
828 let label_bar = label_target(app).map(|mac| {1057 let label_bar = label_target(app).map(|mac| {
@@ -859,7 +1088,11 @@ pub fn render(app: &mut AppRoot, view: &Entity<AppRoot>, _window: &mut Window, c
859 ))),1088 ))),
860 )1089 )
861 .children(label_bar)1090 .children(label_bar)
862- .children(channel_activity(app, cx.theme()))1091+ .children(channel_activity(
1092+ app,
1093+ cx.theme(),
1094+ f32::from(window.viewport_size().width) - TL_RESERVED_WIDTH,
1095+ ))
863 .child(ap_table(app, view))1096 .child(ap_table(app, view))
864 .child(1097 .child(
865 gpuikit::layout::h_stack()1098 gpuikit::layout::h_stack()
@@ -878,3 +1111,289 @@ pub fn render(app: &mut AppRoot, view: &Entity<AppRoot>, _window: &mut Window, c
878 )1111 )
879 .child(probe_table(app))1112 .child(probe_table(app))
880 }1113 }
1114+#[cfg(test)]
1115+mod tests {
1116+ use super::*;
1117+ use crate::common::ChannelStat;
1118+ use std::collections::HashMap;
1119+
1120+ fn snap(pairs: &[(u8, u64)]) -> Vec<ChannelStat> {
1121+ pairs
1122+ .iter()
1123+ .map(|&(channel, frames)| ChannelStat {
1124+ channel,
1125+ frames,
1126+ beacons: 0,
1127+ })
1128+ .collect()
1129+ }
1130+
1131+ fn timeline(snaps: Vec<Vec<ChannelStat>>) -> VecDeque<Vec<ChannelStat>> {
1132+ snaps.into()
1133+ }
1134+
1135+ /// Window width that fits every block (tests use it to isolate the
1136+ /// channel-count behaviour from the width behaviour).
1137+ const WIDE: f32 = TL_BLOCK_WIDTH * TL_MAX_BLOCKS as f32;
1138+
1139+ fn rows_of(view: &TimelineView) -> Vec<TimelineRow> {
1140+ view.blocks.iter().flatten().cloned().collect()
1141+ }
1142+
1143+ /// The reported bug: the activity block resized (pushing everything
1144+ /// below it) when channels were added to or removed from the scan.
1145+ /// Height is now `TL_ROWS` rows per block whatever the channel set does
1146+ /// — 4 channels and 20 channels produce the same block height.
1147+ #[test]
1148+ fn timeline_height_is_constant_across_channel_sets() {
1149+ let cases: Vec<Vec<(u8, u64)>> = vec![
1150+ vec![],
1151+ vec![(1, 10)],
1152+ vec![(1, 10), (6, 200), (11, 30), (36, 5)],
1153+ (1..=12).map(|c| (c, c as u64 * 7)).collect(),
1154+ (1..=20).map(|c| (c, c as u64 * 7)).collect(),
1155+ (1..=40).map(|c| (c, c as u64 * 7)).collect(),
1156+ ];
1157+ for set in cases {
1158+ let view = timeline_view(&timeline(vec![snap(&set)]), &HashMap::new(), WIDE);
1159+ for (i, block) in view.blocks.iter().enumerate() {
1160+ assert_eq!(
1161+ block.len(),
1162+ TL_ROWS,
1163+ "channel set {set:?} block {i} must hold exactly TL_ROWS rows"
1164+ );
1165+ }
1166+ let rows = rows_of(&view);
1167+ // Blank slots only ever trail the data rows.
1168+ let first_blank = rows.iter().position(|r| r.channel.is_none());
1169+ if let Some(i) = first_blank {
1170+ assert!(
1171+ rows[i..].iter().all(|r| r.channel.is_none()),
1172+ "blank slots must be trailing: {rows:?}"
1173+ );
1174+ }
1175+ }
1176+ // An empty timeline yields no blocks at all (block hidden).
1177+ assert!(
1178+ timeline_view(&timeline(vec![]), &HashMap::new(), WIDE)
1179+ .blocks
1180+ .is_empty()
1181+ );
1182+ }
1183+
1184+ /// 20 channels: as many column blocks as the width allows, and every
1185+ /// one of them exactly TL_ROWS rows tall.
1186+ #[test]
1187+ fn timeline_uses_horizontal_space_for_many_channels() {
1188+ let set: Vec<(u8, u64)> = (1..=20).map(|c| (c, 1000 - c as u64)).collect();
1189+ let view = timeline_view(&timeline(vec![snap(&set)]), &HashMap::new(), WIDE);
1190+ assert_eq!(view.active, 20);
1191+ assert_eq!(view.shown, 20, "wide window must show all 20 channels");
1192+ assert_eq!(view.blocks.len(), 20usize.div_ceil(TL_ROWS));
1193+ assert!(view.blocks.iter().all(|b| b.len() == TL_ROWS));
1194+
1195+ // Narrow window: fewer blocks, extras dropped by frame count (the
1196+ // busiest survive), height unchanged.
1197+ let narrow = timeline_view(&timeline(vec![snap(&set)]), &HashMap::new(), TL_BLOCK_WIDTH);
1198+ assert_eq!(narrow.blocks.len(), 1);
1199+ assert_eq!(narrow.shown, TL_ROWS);
1200+ assert_eq!(narrow.active, 20);
1201+ let kept: Vec<u8> = rows_of(&narrow).iter().filter_map(|r| r.channel).collect();
1202+ assert_eq!(
1203+ kept,
1204+ vec![1, 2, 3, 4, 5, 6, 7, 8],
1205+ "busiest kept, ascending"
1206+ );
1207+
1208+ // No more blocks than the cap, however wide the window gets. The
1209+ // block count is also bounded by how many channels exist — a 40
1210+ // channel set is what can actually reach the cap.
1211+ let many: Vec<(u8, u64)> = (1..=40).map(|c| (c, 1000 - c as u64)).collect();
1212+ let huge = timeline_view(&timeline(vec![snap(&many)]), &HashMap::new(), 100_000.);
1213+ assert_eq!(huge.blocks.len(), TL_MAX_BLOCKS);
1214+ assert_eq!(huge.shown, TL_MAX_BLOCKS * TL_ROWS, "capacity is the cap");
1215+ assert_eq!(huge.active, 40);
1216+ assert!(
1217+ huge.shown < huge.active,
1218+ "the header must be able to report dropped channels"
1219+ );
1220+ }
1221+
1222+ /// Surviving channels keep their relative order whatever else joins or
1223+ /// leaves the busiest set, so rows don't shuffle between scans.
1224+ #[test]
1225+ fn timeline_order_is_by_channel() {
1226+ let sets = [
1227+ vec![(1, 10), (6, 200), (36, 5)],
1228+ vec![(3, 900), (1, 10), (36, 5), (11, 40)],
1229+ vec![(11, 40), (36, 5)],
1230+ ];
1231+ for set in sets {
1232+ let view = timeline_view(&timeline(vec![snap(&set)]), &HashMap::new(), WIDE);
1233+ let channels: Vec<u8> = rows_of(&view).iter().filter_map(|r| r.channel).collect();
1234+ let mut sorted = channels.clone();
1235+ sorted.sort_unstable();
1236+ assert_eq!(channels, sorted, "rows must ascend by channel: {set:?}");
1237+ }
1238+ }
1239+
1240+ #[test]
1241+ fn timeline_deltas_and_totals() {
1242+ let mut crowd = HashMap::new();
1243+ crowd.insert(6, 5);
1244+ // ch6 reported in every snapshot, ch11 missing from the middle one.
1245+ let tl = timeline(vec![
1246+ snap(&[(6, 100), (11, 10)]),
1247+ snap(&[(6, 160)]),
1248+ snap(&[(6, 200), (11, 50)]),
1249+ ]);
1250+ let view = timeline_view(&tl, &crowd, WIDE);
1251+ let rows = rows_of(&view);
1252+ let ch6 = rows.iter().find(|r| r.channel == Some(6)).expect("ch6 row");
1253+ assert_eq!(ch6.deltas, vec![60, 40], "consecutive deltas");
1254+ assert_eq!(ch6.total, 200);
1255+ assert_eq!(ch6.aps, 5);
1256+ let ch11 = rows
1257+ .iter()
1258+ .find(|r| r.channel == Some(11))
1259+ .expect("ch11 row");
1260+ // Missed snapshot skipped: the delta spans the gap.
1261+ assert_eq!(ch11.deltas, vec![40]);
1262+ assert_eq!(ch11.total, 50);
1263+
1264+ // A single snapshot has no delta yet — the row shows the total.
1265+ let view = timeline_view(&timeline(vec![snap(&[(1, 42)])]), &HashMap::new(), WIDE);
1266+ let ch1 = rows_of(&view)
1267+ .into_iter()
1268+ .find(|r| r.channel == Some(1))
1269+ .expect("ch1 row");
1270+ assert!(ch1.deltas.is_empty());
1271+ assert_eq!(ch1.total, 42);
1272+ }
1273+
1274+ #[test]
1275+ fn risk_rank_orders_rogue_over_weak_over_none() {
1276+ let mut rogues = std::collections::HashSet::new();
1277+ rogues.insert(norm_ssid("evil-twin"));
1278+ let ap = |ssid: &str, sec: Security| AccessPoint {
1279+ bssid: MacAddr([1, 2, 3, 4, 5, 6]),
1280+ ssid: ssid.to_string(),
1281+ channel: 6,
1282+ security: sec,
1283+ rssi_dbm: -50,
1284+ beacons: 1,
1285+ last_seen_ms: 0,
1286+ akms: Vec::new(),
1287+ };
1288+ let rogue = ap("evil-twin", Security::Wpa2);
1289+ let weak = ap("open-wifi", Security::Open);
1290+ let wep = ap("old-ap", Security::Wep);
1291+ let fine = ap("home", Security::Wpa2);
1292+ assert_eq!(risk_rank(&rogue, &rogues), 2);
1293+ assert_eq!(risk_rank(&weak, &rogues), 1);
1294+ assert_eq!(risk_rank(&wep, &rogues), 1);
1295+ assert_eq!(risk_rank(&fine, &rogues), 0);
1296+ // A hidden SSID can never be flagged rogue (nothing to match).
1297+ let hidden = ap("", Security::Wpa2);
1298+ assert_eq!(risk_rank(&hidden, &rogues), 0);
1299+ // Sorting by the FLAGS column puts the worst first ascending.
1300+ let mut order = [fine.clone(), weak.clone(), rogue.clone()];
1301+ order.sort_by_key(|a| risk_rank(a, &rogues));
1302+ assert_eq!(order[0].ssid, "home");
1303+ assert_eq!(order[1].ssid, "open-wifi");
1304+ assert_eq!(order[2].ssid, "evil-twin");
1305+ }
1306+
1307+ /// Ten tags on one AP must not grow the cell, push its neighbours, or
1308+ /// silently vanish: whatever does not fit becomes `+N`, and the tag the
1309+ /// user must not miss (the worst) is always the one drawn.
1310+ #[test]
1311+ fn flags_column_collapses_overflow_into_a_marker() {
1312+ // A synthetic worst case: ten tags of the shape real ones have.
1313+ let many: Vec<RiskTag> = (0..10)
1314+ .map(|i| RiskTag {
1315+ label: if i % 2 == 0 { "rogue?" } else { "weak" },
1316+ severity: 2,
1317+ })
1318+ .collect();
1319+
1320+ let (shown, hidden) = fit_tags(&many, FLAGS_W);
1321+ assert!(shown < many.len(), "ten tags cannot all fit one cell");
1322+ assert_eq!(shown + hidden, many.len(), "every tag is accounted for");
1323+ assert!(shown >= 1, "at least the worst tag stays visible");
1324+ // What is drawn — badges plus the marker — stays inside the column.
1325+ let drawn: f32 = many[..shown]
1326+ .iter()
1327+ .map(|t| badge_width(t.label))
1328+ .sum::<f32>()
1329+ + FLAGS_GAP * shown.saturating_sub(1) as f32
1330+ + FLAGS_MORE_W;
1331+ assert!(
1332+ drawn <= FLAGS_W,
1333+ "drawn width {drawn} must fit the {FLAGS_W} px column"
1334+ );
1335+ }
1336+
1337+ #[test]
1338+ fn fit_tags_is_conservative_at_every_width() {
1339+ let tags = |n: usize| -> Vec<RiskTag> {
1340+ (0..n)
1341+ .map(|_| RiskTag {
1342+ label: "rogue?",
1343+ severity: 2,
1344+ })
1345+ .collect()
1346+ };
1347+ for n in 0..=12 {
1348+ let list = tags(n);
1349+ for width in [0., 20., 40., 80., 120., FLAGS_W, 300., 1000.] {
1350+ let (shown, hidden) = fit_tags(&list, width);
1351+ assert_eq!(
1352+ shown + hidden,
1353+ n,
1354+ "tags must be conserved (n={n}, w={width})"
1355+ );
1356+ let drawn: f32 = list[..shown]
1357+ .iter()
1358+ .map(|t| badge_width(t.label))
1359+ .sum::<f32>()
1360+ + FLAGS_GAP * shown.saturating_sub(1) as f32
1361+ + if hidden > 0 { FLAGS_MORE_W } else { 0.0 };
1362+ assert!(
1363+ drawn <= width.max(FLAGS_MORE_W),
1364+ "n={n} width={width}: drawn {drawn} overflows"
1365+ );
1366+ if n > 0 && width >= badge_width("rogue?") + FLAGS_MORE_W {
1367+ assert!(shown >= 1, "n={n} width={width}: nothing shown");
1368+ }
1369+ }
1370+ }
1371+ assert_eq!(fit_tags(&[], FLAGS_W), (0, 0));
1372+ }
1373+
1374+ /// One order for tags everywhere: worst first, and the column sort uses
1375+ /// the worst tag's severity.
1376+ #[test]
1377+ fn risk_tags_are_ordered_worst_first() {
1378+ let mut rogues = std::collections::HashSet::new();
1379+ rogues.insert(norm_ssid("evil-twin"));
1380+ let ap = |ssid: &str, sec: Security| AccessPoint {
1381+ bssid: MacAddr([9, 9, 9, 9, 9, 9]),
1382+ ssid: ssid.to_string(),
1383+ channel: 6,
1384+ security: sec,
1385+ rssi_dbm: -50,
1386+ beacons: 1,
1387+ last_seen_ms: 0,
1388+ akms: Vec::new(),
1389+ };
1390+ let labels = |ap: &AccessPoint| -> Vec<&'static str> {
1391+ risk_tags(ap, &rogues).iter().map(|t| t.label).collect()
1392+ };
1393+ assert_eq!(labels(&ap("evil-twin", Security::Open)), ["rogue?", "weak"]);
1394+ assert_eq!(labels(&ap("open-wifi", Security::Open)), ["weak"]);
1395+ assert_eq!(labels(&ap("home", Security::Wpa2)), [] as [&str; 0]);
1396+ assert_eq!(risk_rank(&ap("evil-twin", Security::Wep), &rogues), 2);
1397+ assert_eq!(risk_rank(&ap("home", Security::Wpa2), &rogues), 0);
1398+ }
1399+}
src/ui/state.rsmodified+263 -61
@@ -15,8 +15,12 @@ pub const LOG_CAP: usize = 500;
15 /// Live status of the (currently simulated) handshake cracker.15 /// Live status of the (currently simulated) handshake cracker.
16 #[derive(Default)]16 #[derive(Default)]
17 pub struct CrackerState {17 pub struct CrackerState {
18- /// Human description of the selected capture (see [`AppState::capture_descs`]).18+ /// Selected capture, as an index into [`AppState::capture_descs`] /
19- pub target: Option<String>,19+ /// the aligned target vectors. Index (not description string) keyed so
20+ /// a selection never depends on regenerated display strings; the
21+ /// vectors are append-only, so new captures arriving mid-run cannot
22+ /// shift an existing selection.
23+ pub target: Option<usize>,
20 pub wordlist: Option<String>,24 pub wordlist: Option<String>,
21 pub running: bool,25 pub running: bool,
22 /// Guesses per second.26 /// Guesses per second.
@@ -50,7 +54,12 @@ pub struct CrackerState {
50 /// resolved to the capture's current description).54 /// resolved to the capture's current description).
51 #[derive(Clone)]55 #[derive(Clone)]
52 pub struct ResumeInfo {56 pub struct ResumeInfo {
53- /// Dropdown description of the capture this run belongs to.57+ /// Capture index (the [`AppState::capture_descs`] / target-select
58+ /// index) of the capture this run belongs to — the Resume action sets
59+ /// `CrackerState.target` from this without any string re-matching.
60+ pub target_idx: usize,
61+ /// Dropdown description of the capture this run belongs to (display
62+ /// text for the banner; selection logic keys on `target_idx`).
54 pub target_desc: String,63 pub target_desc: String,
55 /// Attack definition at the saved candidate offset.64 /// Attack definition at the saved candidate offset.
56 pub attack: crate::attack::Attack,65 pub attack: crate::attack::Attack,
@@ -69,20 +78,25 @@ pub struct AppState {
69 pub aps: BTreeMap<MacAddr, AccessPoint>,78 pub aps: BTreeMap<MacAddr, AccessPoint>,
70 pub clients: BTreeMap<MacAddr, ClientInfo>,79 pub clients: BTreeMap<MacAddr, ClientInfo>,
71 /// User-assigned names by MAC (APs and clients share one namespace;80 /// User-assigned names by MAC (APs and clients share one namespace;
72- /// a MAC is unique). Persisted to `~/wifilab/labels.json`81+ /// a MAC is unique). Persisted to `~/wifi_lab/labels.json`
73 /// ([`crate::store`]); UI-side only.82 /// ([`crate::store`]); UI-side only.
74 pub labels: BTreeMap<MacAddr, String>,83 pub labels: BTreeMap<MacAddr, String>,
75 pub handshakes: Vec<HandshakeCapture>,84 pub handshakes: Vec<HandshakeCapture>,
76 pub pmkids: Vec<PmkidCapture>,85 pub pmkids: Vec<PmkidCapture>,
77- /// [`capture_descs`]-aligned crack targets: `capture_targets()[i]` is86+ /// Partial M2+M3 captures (from [`Event::HandshakePartial`]): crackable
78- /// the [`CrackTarget`] described by `capture_descs()[i]`, so the87+ /// with the identical PTK/MIC math, distinguished for provenance and
79- /// cracker starts a run without re-parsing an hc22000 line.88+ /// export (`partial == true`, hashcat message-pair field `02`).
89+ /// Deduped on (AP, client) + MIC.
90+ pub partials: Vec<HandshakeCapture>,
91+ /// [`capture_descs`]-aligned crack targets, in ARRIVAL ORDER
92+ /// (handshakes, PMKIDs and partials interleaved as they arrived):
93+ /// `capture_targets[i]` is the [`CrackTarget`] described by
94+ /// `capture_descs()[i]`, so the cracker starts a run without
95+ /// re-parsing an hc22000 line. Append-only by construction — new
96+ /// captures never shift existing indices.
80 capture_targets: Vec<CrackTarget>,97 capture_targets: Vec<CrackTarget>,
81 pub log: VecDeque<String>,98 pub log: VecDeque<String>,
82 pub cracker: CrackerState,99 pub cracker: CrackerState,
83- /// Last per-channel frame/beacon counters snapshot
84- /// ([`Event::ChannelStats`]).
85- pub channel_stats: Vec<ChannelStat>,
86 /// Observed probe requests, newest last.100 /// Observed probe requests, newest last.
87 pub probes: VecDeque<ProbeInfo>,101 pub probes: VecDeque<ProbeInfo>,
88 /// Recent RSSI samples per MAC (APs and clients keyed by their own102 /// Recent RSSI samples per MAC (APs and clients keyed by their own
@@ -143,10 +157,10 @@ impl AppState {
143 labels: BTreeMap::new(),157 labels: BTreeMap::new(),
144 handshakes: Vec::new(),158 handshakes: Vec::new(),
145 pmkids: Vec::new(),159 pmkids: Vec::new(),
160+ partials: Vec::new(),
146 capture_targets: Vec::new(),161 capture_targets: Vec::new(),
147 log: VecDeque::with_capacity(LOG_CAP),162 log: VecDeque::with_capacity(LOG_CAP),
148 cracker: CrackerState::default(),163 cracker: CrackerState::default(),
149- channel_stats: Vec::new(),
150 probes: VecDeque::with_capacity(64),164 probes: VecDeque::with_capacity(64),
151 rssi_hist: HashMap::new(),165 rssi_hist: HashMap::new(),
152 rogue_ssids: HashSet::new(),166 rogue_ssids: HashSet::new(),
@@ -186,14 +200,13 @@ impl AppState {
186 200
187 /// The same capture as a [`crate::store::StoredCapture`] (resume201 /// The same capture as a [`crate::store::StoredCapture`] (resume
188 /// session identity), `capture_descs()`-aligned like202 /// session identity), `capture_descs()`-aligned like
189- /// [`AppState::crack_target_at`]: handshakes first, then PMKIDs.203+ /// [`AppState::crack_target_at`]. Sourced from the arrival-ordered
204+ /// `capture_targets` so the index space never shifts under appends.
190 pub fn stored_capture_at(&self, i: usize) -> Option<crate::store::StoredCapture> {205 pub fn stored_capture_at(&self, i: usize) -> Option<crate::store::StoredCapture> {
191- if i < self.handshakes.len() {206+ match self.capture_targets.get(i)? {
192- return Some(crate::store::StoredCapture::Handshake(self.handshakes[i].clone()));207+ CrackTarget::Handshake(h) => Some(crate::store::StoredCapture::Handshake(h.clone())),
208+ CrackTarget::Pmkid(p) => Some(crate::store::StoredCapture::Pmkid(p.clone())),
193 }209 }
194- self.pmkids
195- .get(i - self.handshakes.len())
196- .map(|p| crate::store::StoredCapture::Pmkid(p.clone()))
197 }210 }
198 211
199 pub fn push_log(&mut self, line: impl Into<String>) {212 pub fn push_log(&mut self, line: impl Into<String>) {
@@ -205,10 +218,14 @@ impl AppState {
205 218
206 /// Reduce one service event into state. Returns `true` when the set of219 /// Reduce one service event into state. Returns `true` when the set of
207 /// crackable captures changed (callers rebuild dependent widgets).220 /// crackable captures changed (callers rebuild dependent widgets).
221+ ///
222+ /// Does NOT sweep stale clients: at 10 Hz+ probe volumes a per-event
223+ /// sweep allocates a full `clients` snapshot every call. The sweep
224+ /// runs once per 100 ms drain tick instead — see
225+ /// [`AppState::sweep_stale_clients`], invoked by the app drain loop
226+ /// after the event batch is applied.
208 pub fn apply(&mut self, event: Event) -> bool {227 pub fn apply(&mut self, event: Event) -> bool {
209- let changed = self.reduce(event);228+ self.reduce(event)
210- self.sweep_stale_clients();
211- changed
212 }229 }
213 230
214 /// Backstop mirror of the scanner's 60 s client-expiry: rows learned231 /// Backstop mirror of the scanner's 60 s client-expiry: rows learned
@@ -217,7 +234,7 @@ impl AppState {
217 /// forever without this. Clock-offset between the service and UI234 /// forever without this. Clock-offset between the service and UI
218 /// epochs (both `now_ms`, different process-local zero points) is a235 /// epochs (both `now_ms`, different process-local zero points) is a
219 /// few seconds at most — negligible against a 60 s threshold.236 /// few seconds at most — negligible against a 60 s threshold.
220- fn sweep_stale_clients(&mut self) {237+ pub fn sweep_stale_clients(&mut self) {
221 const UI_CLIENT_EXPIRE_MS: u64 = 60_000;238 const UI_CLIENT_EXPIRE_MS: u64 = 60_000;
222 let now = crate::common::now_ms();239 let now = crate::common::now_ms();
223 let swept: Vec<MacAddr> = self240 let swept: Vec<MacAddr> = self
@@ -234,12 +251,12 @@ impl AppState {
234 251
235 /// Drop a MAC's pairing record (client row gone).252 /// Drop a MAC's pairing record (client row gone).
236 fn forget_ident(&mut self, mac: &MacAddr) {253 fn forget_ident(&mut self, mac: &MacAddr) {
237- if let Some((gid, _)) = self.idents.remove(mac) {254+ if let Some((gid, _)) = self.idents.remove(mac)
238- if let Some(set) = self.ident_groups.get_mut(&gid) {255+ && let Some(set) = self.ident_groups.get_mut(&gid)
239- set.remove(mac);256+ {
240- if set.is_empty() {257+ set.remove(mac);
241- self.ident_groups.remove(&gid);258+ if set.is_empty() {
242- }259+ self.ident_groups.remove(&gid);
243 }260 }
244 }261 }
245 }262 }
@@ -297,7 +314,11 @@ impl AppState {
297 self.forget_ident(&mac);314 self.forget_ident(&mac);
298 false315 false
299 }316 }
300- Event::ClientIdent { mac, group, confidence } => {317+ Event::ClientIdent {
318+ mac,
319+ group,
320+ confidence,
321+ } => {
301 let rotated = self322 let rotated = self
302 .ident_groups323 .ident_groups
303 .get(&group)324 .get(&group)
@@ -340,10 +361,29 @@ impl AppState {
340 self.handshakes.push(*cap);361 self.handshakes.push(*cap);
341 true362 true
342 }363 }
364+ Event::HandshakePartial(cap) => {
365+ // Same material re-delivered (e.g. tracker drain after the
366+ // capture session already reported it) must not duplicate
367+ // the picker entry.
368+ if self
369+ .partials
370+ .iter()
371+ .any(|p| p.ap == cap.ap && p.client == cap.client && p.mic() == cap.mic())
372+ {
373+ return false;
374+ }
375+ self.push_log(format!(
376+ "partial handshake (M2+M3) for {}: hashcat-exportable",
377+ cap.essid
378+ ));
379+ self.capture_targets
380+ .push(CrackTarget::Handshake(cap.as_ref().clone()));
381+ self.partials.push(*cap);
382+ true
383+ }
343 Event::PmkidCaptured(cap) => {384 Event::PmkidCaptured(cap) => {
344 self.push_log(format!("PMKID captured: {} ({})", cap.essid, cap.ap));385 self.push_log(format!("PMKID captured: {} ({})", cap.essid, cap.ap));
345- self.capture_targets386+ self.capture_targets.push(CrackTarget::Pmkid(cap.clone()));
346- .push(CrackTarget::Pmkid(cap.clone()));
347 self.pmkids.push(cap);387 self.pmkids.push(cap);
348 true388 true
349 }389 }
@@ -371,11 +411,27 @@ impl AppState {
371 Event::CrackStopped { found } => {411 Event::CrackStopped { found } => {
372 self.push_log(format!(412 self.push_log(format!(
373 "cracker: run ended ({})",413 "cracker: run ended ({})",
374- if found { "password recovered" } else { "stopped/exhausted" }414+ if found {
415+ "password recovered"
416+ } else {
417+ "stopped/exhausted"
418+ }
375 ));419 ));
376 self.cracker.running = false;420 self.cracker.running = false;
377 true // force dependent-widget refresh so the cracker page updates promptly421 true // force dependent-widget refresh so the cracker page updates promptly
378 }422 }
423+ Event::CrackError { reason } => {
424+ // Backend failure (GPU device lost, dispatch timeout,
425+ // worker panic) — NOT exhaustion, NOT user stop. Log the
426+ // reason (the cracker page's recent-activity block is a
427+ // filtered view over this log, so the line mirrors there
428+ // automatically) and reset the cracker to idle like
429+ // CrackStopped, but do NOT touch the saved resume session:
430+ // the failure is recoverable and the run may be resumed.
431+ self.push_log(format!("crack FAILED (backend): {reason}"));
432+ self.cracker.running = false;
433+ true // force dependent-widget refresh so the cracker page updates promptly
434+ }
379 Event::RainbowProgress { done, hps, total } => {435 Event::RainbowProgress { done, hps, total } => {
380 if self.cracker.rainbow_building {436 if self.cracker.rainbow_building {
381 self.cracker.rainbow_done = done;437 self.cracker.rainbow_done = done;
@@ -401,8 +457,7 @@ impl AppState {
401 if self.chan_timeline.len() == CHAN_TL_CAP {457 if self.chan_timeline.len() == CHAN_TL_CAP {
402 self.chan_timeline.pop_front();458 self.chan_timeline.pop_front();
403 }459 }
404- self.chan_timeline.push_back(stats.clone());460+ self.chan_timeline.push_back(stats);
405- self.channel_stats = stats;
406 false461 false
407 }462 }
408 Event::ProbeObserved(probe) => {463 Event::ProbeObserved(probe) => {
@@ -418,12 +473,18 @@ impl AppState {
418 self.bench_cpu = Some(cpu_hps);473 self.bench_cpu = Some(cpu_hps);
419 self.push_log(format!(474 self.push_log(format!(
420 "benchmark: gpu {} H/s, cpu {} H/s",475 "benchmark: gpu {} H/s, cpu {} H/s",
421- gpu_hps.map(|h| h.to_string()).unwrap_or_else(|| "none".to_string()),476+ gpu_hps
477+ .map(|h| h.to_string())
478+ .unwrap_or_else(|| "none".to_string()),
422 cpu_hps479 cpu_hps
423 ));480 ));
424 false481 false
425 }482 }
426- Event::DeauthAlert { source, target, count } => {483+ Event::DeauthAlert {
484+ source,
485+ target,
486+ count,
487+ } => {
427 let msg = format!("DEAUTH STORM: {source} → {target} x{count}");488 let msg = format!("DEAUTH STORM: {source} → {target} x{count}");
428 self.push_log(msg.clone());489 self.push_log(msg.clone());
429 self.deauth_alert = Some(msg);490 self.deauth_alert = Some(msg);
@@ -433,12 +494,28 @@ impl AppState {
433 match cap {494 match cap {
434 crate::common::ImportedCapture::Handshake(h) => {495 crate::common::ImportedCapture::Handshake(h) => {
435 self.push_log(format!(496 self.push_log(format!(
436- "imported handshake: {} ({} ⇄ {})",497+ "import{} handshake: {} ({} ⇄ {})",
437- h.essid, h.ap, h.client498+ if h.partial { "ed [partial]" } else { "ed" },
499+ h.essid,
500+ h.ap,
501+ h.client
438 ));502 ));
439 self.capture_targets503 self.capture_targets
440 .push(CrackTarget::Handshake(h.as_ref().clone()));504 .push(CrackTarget::Handshake(h.as_ref().clone()));
441- self.handshakes.push(*h);505+ // Imported partials join the partial provenance
506+ // list (dedup, [partial] marker, hc22000-export
507+ // path) just like service-emitted partials.
508+ if h.partial {
509+ if !self
510+ .partials
511+ .iter()
512+ .any(|p| p.ap == h.ap && p.client == h.client && p.mic() == h.mic())
513+ {
514+ self.partials.push(*h);
515+ }
516+ } else {
517+ self.handshakes.push(*h);
518+ }
442 }519 }
443 crate::common::ImportedCapture::Pmkid(p) => {520 crate::common::ImportedCapture::Pmkid(p) => {
444 self.push_log(format!("imported PMKID: {} ({})", p.essid, p.ap));521 self.push_log(format!("imported PMKID: {} ({})", p.essid, p.ap));
@@ -451,25 +528,30 @@ impl AppState {
451 }528 }
452 }529 }
453 530
454- /// Stable, unique descriptions of every crackable capture — the cracker's531+ /// Stable, unique descriptions of every crackable capture — the
455- /// target dropdown is fed with these (index prefix keeps duplicates532+ /// cracker's target dropdown is fed with these (index prefix keeps
456- /// apart).533+ /// duplicates apart). Arrival-ordered ([`self.capture_targets`]), so
534+ /// appending new captures can never renumber an existing entry — the
535+ /// selection structs key on the index, not the string. Partial M2+M3
536+ /// captures carry a `[partial]` marker so their provenance is visible
537+ /// at a glance.
457 pub fn capture_descs(&self) -> Vec<String> {538 pub fn capture_descs(&self) -> Vec<String> {
458- let mut out = Vec::with_capacity(self.handshakes.len() + self.pmkids.len());539+ self.capture_targets
459- for (i, hs) in self.handshakes.iter().enumerate() {540+ .iter()
460- out.push(format!(541+ .enumerate()
461- "#{:02} HS {} {} ⇄ {} kv{}",542+ .map(|(i, t)| match t {
462- i + 1,543+ CrackTarget::Handshake(hs) => format!(
463- hs.essid,544+ "#{:02} HS {}{} {} ⇄ {} kv{}",
464- hs.ap,545+ i + 1,
465- hs.client,546+ if hs.partial { "[partial] " } else { "" },
466- hs.key_ver547+ hs.essid,
467- ));548+ hs.ap,
468- }549+ hs.client,
469- for (i, pm) in self.pmkids.iter().enumerate() {550+ hs.key_ver
470- out.push(format!("#{:02} PMKID {} {}", i + 1, pm.essid, pm.ap));551+ ),
471- }552+ CrackTarget::Pmkid(pm) => format!("#{:02} PMKID {} {}", i + 1, pm.essid, pm.ap),
472- out553+ })
554+ .collect()
473 }555 }
474 }556 }
475 557
@@ -478,7 +560,111 @@ mod tests {
478 use super::*;560 use super::*;
479 561
480 fn stat(ch: u8, frames: u64) -> ChannelStat {562 fn stat(ch: u8, frames: u64) -> ChannelStat {
481- ChannelStat { channel: ch, frames, beacons: 0 }563+ ChannelStat {
564+ channel: ch,
565+ frames,
566+ beacons: 0,
567+ }
568+ }
569+
570+ fn mac(byte: u8) -> MacAddr {
571+ MacAddr([byte; 6])
572+ }
573+
574+ fn partial_cap(seed: u8, essid: &str) -> HandshakeCapture {
575+ HandshakeCapture::new_partial(
576+ mac(0xaa),
577+ mac(0xbb),
578+ essid.to_string(),
579+ [seed; 32],
580+ [seed.wrapping_add(1); 32],
581+ [seed; 16],
582+ vec![1, 3, 0, 95],
583+ 2,
584+ )
585+ }
586+
587+ #[test]
588+ fn handshake_partial_appends_marked_and_dedups() {
589+ let mut s = AppState::new("wlan0");
590+ let cap = partial_cap(7, "partialnet");
591+ assert!(s.apply(Event::HandshakePartial(Box::new(cap.clone()))));
592+ // Same (AP, client) + MIC re-delivered: no duplicate picker entry.
593+ assert!(!s.apply(Event::HandshakePartial(Box::new(cap))));
594+ assert_eq!(s.partials.len(), 1);
595+ assert!(s.partials[0].partial);
596+ let descs = s.capture_descs();
597+ assert_eq!(descs.len(), 1);
598+ assert!(descs[0].contains("[partial]"), "desc: {}", descs[0]);
599+ // Cracker-side index space includes it (same run path as HS/PMKID).
600+ assert!(matches!(
601+ s.stored_capture_at(0),
602+ Some(crate::store::StoredCapture::Handshake(_))
603+ ));
604+ assert_eq!(
605+ s.log.back().map(String::as_str),
606+ Some("partial handshake (M2+M3) for partialnet: hashcat-exportable")
607+ );
608+ }
609+
610+ #[test]
611+ fn crack_error_resets_running_and_logs_reason() {
612+ let mut s = AppState::new("wlan0");
613+ s.cracker.running = true;
614+ assert!(s.apply(Event::CrackError {
615+ reason: "GPU device lost".to_string()
616+ }));
617+ assert!(!s.cracker.running);
618+ assert_eq!(
619+ s.log.back().map(String::as_str),
620+ Some("crack FAILED (backend): GPU device lost")
621+ );
622+ }
623+
624+ #[test]
625+ fn capture_index_space_is_append_stable() {
626+ let mut s = AppState::new("wlan0");
627+ let h1 = HandshakeCapture::new(
628+ mac(1),
629+ mac(2),
630+ "alpha".to_string(),
631+ [0; 32],
632+ [1; 32],
633+ [2; 16],
634+ vec![0],
635+ 2,
636+ );
637+ s.apply(Event::HandshakeComplete(Box::new(h1)));
638+ s.apply(Event::PmkidCaptured(PmkidCapture {
639+ ap: mac(3),
640+ client: mac(4),
641+ essid: "beta".to_string(),
642+ pmkid: [5; 16],
643+ }));
644+ let before = s.capture_descs();
645+ assert_eq!(before.len(), 2);
646+ assert!(before[1].contains("PMKID"));
647+ // A later handshake must NOT renumber the PMKID entry: with an
648+ // index-keyed target selection, a shift would silently crack the
649+ // wrong capture.
650+ let h2 = HandshakeCapture::new(
651+ mac(5),
652+ mac(6),
653+ "gamma".to_string(),
654+ [1; 32],
655+ [2; 32],
656+ [3; 16],
657+ vec![0],
658+ 2,
659+ );
660+ s.apply(Event::HandshakeComplete(Box::new(h2)));
661+ let after = s.capture_descs();
662+ assert_eq!(after.len(), 3);
663+ assert_eq!(&after[..before.len()], &before[..]);
664+ assert!(matches!(
665+ s.stored_capture_at(1),
666+ Some(crate::store::StoredCapture::Pmkid(_))
667+ ));
482 }668 }
483 669
484 #[test]670 #[test]
@@ -490,17 +676,33 @@ mod tests {
490 assert_eq!(s.chan_timeline.len(), CHAN_TL_CAP);676 assert_eq!(s.chan_timeline.len(), CHAN_TL_CAP);
491 // Oldest dropped: the first surviving snapshot is frames=6.677 // Oldest dropped: the first surviving snapshot is frames=6.
492 assert_eq!(s.chan_timeline.front().unwrap()[0].frames, 6);678 assert_eq!(s.chan_timeline.front().unwrap()[0].frames, 6);
493- assert_eq!(s.channel_stats[0].frames, (CHAN_TL_CAP + 5) as u64);679+ // Newest snapshot is the tail of the timeline.
680+ assert_eq!(
681+ s.chan_timeline.back().unwrap()[0].frames,
682+ (CHAN_TL_CAP + 5) as u64
683+ );
494 }684 }
495 685
496 #[test]686 #[test]
497 fn hps_history_advances_only_while_running() {687 fn hps_history_advances_only_while_running() {
498 let mut s = AppState::new("wlan0");688 let mut s = AppState::new("wlan0");
499- s.apply(Event::CrackProgress { done: 10, hps: 100.0, total: None });689+ s.apply(Event::CrackProgress {
690+ done: 10,
691+ hps: 100.0,
692+ total: None,
693+ });
500 assert!(s.hps_hist.is_empty(), "stopped run must not feed the curve");694 assert!(s.hps_hist.is_empty(), "stopped run must not feed the curve");
501 s.cracker.running = true;695 s.cracker.running = true;
502- s.apply(Event::CrackProgress { done: 20, hps: 200.0, total: Some(50) });696+ s.apply(Event::CrackProgress {
503- s.apply(Event::CrackProgress { done: 30, hps: 300.0, total: Some(50) });697+ done: 20,
698+ hps: 200.0,
699+ total: Some(50),
700+ });
701+ s.apply(Event::CrackProgress {
702+ done: 30,
703+ hps: 300.0,
704+ total: Some(50),
705+ });
504 assert_eq!(706 assert_eq!(
505 s.hps_hist.iter().copied().collect::<Vec<_>>(),707 s.hps_hist.iter().copied().collect::<Vec<_>>(),
506 vec![200.0, 300.0]708 vec![200.0, 300.0]
src/wordlist.rsmodified+92 -21
@@ -4,26 +4,57 @@
4 use std::fs::File;4 use std::fs::File;
5 use std::io::{BufRead, BufReader};5 use std::io::{BufRead, BufReader};
6 use std::path::Path;6 use std::path::Path;
7+use std::sync::atomic::{AtomicU64, Ordering};
7 8
8 use anyhow::{Context, Result};9 use anyhow::{Context, Result};
9 10
11+/// Process-wide count of lines skipped by [`open`] iterators: unreadable
12+/// lines and lines outside the WPA passphrase range (8..=63 bytes).
13+/// Lines with invalid UTF-8 are NOT skipped — passphrases are raw bytes
14+/// (rockyou-family lists carry high-bit bytes) and are yielded as read.
15+static SKIPPED_LINES: AtomicU64 = AtomicU64::new(0);
16+
17+/// Cumulative number of wordlist lines skipped since process start. Read
18+/// before and after exhausting an iterator; the delta is that file's
19+/// skipped-line total (undecodable/unreadable + overlong/undersized).
20+pub fn skipped_lines() -> u64 {
21+ SKIPPED_LINES.load(Ordering::Relaxed)
22+}
23+
10 struct WordIter {24 struct WordIter {
11- lines: std::io::Lines<BufReader<File>>,25+ reader: BufReader<File>,
12 }26 }
13 27
14 impl Iterator for WordIter {28 impl Iterator for WordIter {
15 type Item = Vec<u8>;29 type Item = Vec<u8>;
16 30
17 fn next(&mut self) -> Option<Vec<u8>> {31 fn next(&mut self) -> Option<Vec<u8>> {
32+ let mut buf = Vec::new();
18 loop {33 loop {
19- let line = match self.lines.next()? {34+ buf.clear();
20- Ok(l) => l,35+ match self.reader.read_until(b'\n', &mut buf) {
21- // Unreadable line (bad UTF-8 etc.): skip it, keep streaming.36+ Ok(0) => return None,
22- Err(_) => continue,37+ Ok(_) => {
23- };38+ // Trim the line terminator only: `\n`, then one `\r` of a
24- let bytes = line.into_bytes();39+ // CRLF pair (no whitespace trimming — trailing spaces are
25- if (8..=63).contains(&bytes.len()) {40+ // passphrase material).
26- return Some(bytes);41+ if buf.last() == Some(&b'\n') {
42+ buf.pop();
43+ if buf.last() == Some(&b'\r') {
44+ buf.pop();
45+ }
46+ }
47+ if (8..=63).contains(&buf.len()) {
48+ return Some(std::mem::take(&mut buf));
49+ }
50+ SKIPPED_LINES.fetch_add(1, Ordering::Relaxed);
51+ }
52+ // Unreadable line: count it and stop. A read error on a
53+ // plain file almost always persists; retrying would spin.
54+ Err(_) => {
55+ SKIPPED_LINES.fetch_add(1, Ordering::Relaxed);
56+ return None;
57+ }
27 }58 }
28 }59 }
29 }60 }
@@ -35,8 +66,8 @@ impl Iterator for WordIter {
35 pub fn line_count(path: &Path) -> Result<u64> {66 pub fn line_count(path: &Path) -> Result<u64> {
36 use std::io::Read;67 use std::io::Read;
37 68
38- let mut f = File::open(path)69+ let mut f =
39- .with_context(|| format!("counting lines of {}", path.display()))?;70+ File::open(path).with_context(|| format!("counting lines of {}", path.display()))?;
40 let mut buf = vec![0u8; 1 << 23];71 let mut buf = vec![0u8; 1 << 23];
41 let mut count = 0u64;72 let mut count = 0u64;
42 let mut any = false;73 let mut any = false;
@@ -60,16 +91,15 @@ pub fn line_count(path: &Path) -> Result<u64> {
60 91
61 /// Open a wordlist file as a streaming iterator of passphrase candidates.92 /// Open a wordlist file as a streaming iterator of passphrase candidates.
62 ///93 ///
63-/// Lines are trimmed of `\r\n` only (no whitespace trimming), and only94+/// Byte-safe: lines are split at `\n` and trimmed of a trailing `\r` (no
64-/// candidates of 8..=63 *bytes* are yielded. The iterator is `Send` and does95+/// UTF-8 decoding, so high-bit bytes survive — WPA passphrases are raw
65-/// not load the file into memory.96+/// bytes); only candidates of 8..=63 *bytes* are yielded. Skipped lines are
97+/// tallied in [`skipped_lines`]. The iterator is `Send` and does not load
98+/// the file into memory.
66 pub fn open(path: &Path) -> Result<Box<dyn Iterator<Item = Vec<u8>> + Send>> {99 pub fn open(path: &Path) -> Result<Box<dyn Iterator<Item = Vec<u8>> + Send>> {
67- let f = File::open(path)100+ let f = File::open(path).with_context(|| format!("opening wordlist {}", path.display()))?;
68- .with_context(|| format!("opening wordlist {}", path.display()))?;
69 let reader = BufReader::with_capacity(1 << 20, f);101 let reader = BufReader::with_capacity(1 << 20, f);
70- Ok(Box::new(WordIter {102+ Ok(Box::new(WordIter { reader }))
71- lines: reader.lines(),
72- }))
73 }103 }
74 104
75 #[cfg(test)]105 #[cfg(test)]
@@ -77,10 +107,21 @@ mod tests {
77 use super::*;107 use super::*;
78 use std::io::Write;108 use std::io::Write;
79 109
110+ /// Serializes tests that assert on the process-wide skip counter.
111+ /// (parking_lot isn't a direct dependency; recover from poisoning
112+ /// instead of unwrapping.)
113+ static SKIP_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
114+
115+ /// Lock `SKIP_LOCK`, recovering the guard if a panicked test poisoned it.
116+ fn skip_lock() -> std::sync::MutexGuard<'static, ()> {
117+ SKIP_LOCK.lock().unwrap_or_else(|e| e.into_inner())
118+ }
119+
80 #[test]120 #[test]
81 fn filters_and_trims() {121 fn filters_and_trims() {
122+ let _g = skip_lock();
82 let dir = std::env::temp_dir();123 let dir = std::env::temp_dir();
83- let path = dir.join(format!("wifilab-wordlist-test-{}", std::process::id()));124+ let path = dir.join(format!("wifi_lab-wordlist-test-{}", std::process::id()));
84 {125 {
85 let mut f = File::create(&path).unwrap();126 let mut f = File::create(&path).unwrap();
86 // too short, ok, crlf ok, trailing space kept (too short when127 // too short, ok, crlf ok, trailing space kept (too short when
@@ -94,6 +135,7 @@ mod tests {
94 writeln!(f, "{}", "b".repeat(64)).unwrap();135 writeln!(f, "{}", "b".repeat(64)).unwrap();
95 f.write_all(b"\n").unwrap();136 f.write_all(b"\n").unwrap();
96 }137 }
138+ let before = skipped_lines();
97 let mut it = open(&path).unwrap();139 let mut it = open(&path).unwrap();
98 let got: Vec<Vec<u8>> = std::iter::from_fn(|| it.next()).collect();140 let got: Vec<Vec<u8>> = std::iter::from_fn(|| it.next()).collect();
99 // "eight88 " keeps its trailing space: only \r\n is trimmed.141 // "eight88 " keeps its trailing space: only \r\n is trimmed.
@@ -107,6 +149,35 @@ mod tests {
107 "a".repeat(63).into_bytes(),149 "a".repeat(63).into_bytes(),
108 ]150 ]
109 );151 );
152+ // "short", the 64-byte line and the empty line were skipped.
153+ assert_eq!(skipped_lines() - before, 3);
154+ let _ = std::fs::remove_file(&path);
155+ }
156+
157+ #[test]
158+ fn non_utf8_bytes_are_candidates_not_dropped() {
159+ let _g = skip_lock();
160+ let dir = std::env::temp_dir();
161+ let path = dir.join(format!("wifi_lab-wordlist-utf8-{}", std::process::id()));
162+ {
163+ let mut f = File::create(&path).unwrap();
164+ // rockyou-style high-bit bytes: invalid UTF-8, VALID passphrase.
165+ f.write_all(b"p\xe4ssw\xf6rd\n").unwrap();
166+ f.write_all(b"\xff\xfepass\x80\x81\n").unwrap();
167+ // plus noise that must be counted as skipped:
168+ f.write_all(b"tiny\n").unwrap();
169+ f.write_all(&[b'x'; 64]).unwrap();
170+ f.write_all(b"\n").unwrap();
171+ }
172+ let before = skipped_lines();
173+ let mut it = open(&path).unwrap();
174+ let got: Vec<Vec<u8>> = std::iter::from_fn(|| it.next()).collect();
175+ assert_eq!(
176+ got,
177+ vec![b"p\xe4ssw\xf6rd".to_vec(), b"\xff\xfepass\x80\x81".to_vec()]
178+ );
179+ // "tiny" and the 64-byte line skipped; the binary lines yielded.
180+ assert_eq!(skipped_lines() - before, 2);
110 let _ = std::fs::remove_file(&path);181 let _ = std::fs::remove_file(&path);
111 }182 }
112 183
@@ -126,7 +197,7 @@ mod tests {
126 ("trailing-nl-only", b"\n", 1),197 ("trailing-nl-only", b"\n", 1),
127 ("crlf", b"a\r\nb\r\n", 2),198 ("crlf", b"a\r\nb\r\n", 2),
128 ] {199 ] {
129- let path = dir.join(format!("wifilab-lc-{name}-{}", std::process::id()));200+ let path = dir.join(format!("wifi_lab-lc-{name}-{}", std::process::id()));
130 std::fs::write(&path, bytes).unwrap();201 std::fs::write(&path, bytes).unwrap();
131 assert_eq!(line_count(&path).unwrap(), want, "{name}");202 assert_eq!(line_count(&path).unwrap(), want, "{name}");
132 let _ = std::fs::remove_file(&path);203 let _ = std::fs::remove_file(&path);