feat: ESP32-less Linux bridge for uConsole CM4 — WiFi/BLE scanning, handshake capture, deauth#7
Open
FusedStamen wants to merge 6 commits into
Open
feat: ESP32-less Linux bridge for uConsole CM4 — WiFi/BLE scanning, handshake capture, deauth#7FusedStamen wants to merge 6 commits into
FusedStamen wants to merge 6 commits into
Conversation
…d, dispatch stubs - Add SCAN_COOLDOWN (5s) rate limiter: returns cached results if scan requested too quickly, prevents mt7921u timeout under rapid game scan requests - On iw scan timeout, serve last known cache instead of empty results - Add version command handler — game expects response, was silently ignored - Dispatch handshake/sniffer to external scripts (hs_capture.py, pkt_sniff.py) rather than running inline — bridge stays thin and stable - Remove inline airodump-ng/tcpdump code from bridge entirely - Remove stale wlan1 restore from _stop_hs_capture (hcxdumptool leftover) - Default bt-iface changed to hci1 (CM4 internal UART BT, separate bus from WiFi) - Tested on uConsole CM4 + AC1200 (wlan1) + hci1, zero timeouts under stress
hs_capture.py (new): - Standalone handshake capture dispatched by bridge on start_handshake - airodump-ng + hcxpcapngtool polling, handles WPA* and 22000* formats - Per-BSSID loot files: .txt / .22000 / .pcap (tshark-filtered) - _find_active_session() writes to current game session directory - SIGTERM/SIGINT clean teardown, restores wlan2 managed mode wdg_wifi_bridge.py: - SIGTERM handler for clean systemctl stop - Atomic PTY symlink via mkdtemp + rename - --iface validation prevents monitor mode on default route interface - Popen-based HS/sniffer dispatch with proper start/stop toggle - HS stderr logged to journalctl via _hs_stderr_loop - Scan rate limiter + cache fallback - version command handler - pip advice points to venv pip docs/uconsole-setup.md: - Full uConsole CM4 + AIO v1 setup guide - BT udev pinning, NM unmanaged, wlan1-up service, GPS PTY
- start_deauth <bssid> <channel> command dispatches aireplay-ng -0 5 - Checks monitor mode before setting — avoids fighting with hs_capture - Skips channel set if hs_capture is active - Restores managed mode only if hs_capture is not running - hs_capture skips monitor mode set if wlan2 already in monitor (left by deauth) - HS stderr now logged to journalctl via _hs_stderr_loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a complete ESP32-less bridge for running WatchDogsGo on a ClockworkPi uConsole CM4 with HackerGadgets AIO v1, using the host's WiFi and Bluetooth hardware instead of a physical ESP32.
Tested on: uConsole CM4 + AC1200 (MT7921u, wlan1) + AWUS036ACM (wlan2) + CM4 internal BT (hci0)
Handshake capture and deauth require an external monitor-capable adapter on wlan2
(tested with AWUS036ACM / MT7612U). WiFi scanning and BLE work with built-in hardware only.
Files
wdg_wifi_bridge.py(updated)Addresses all code review feedback from the previous round:
mkdtemp+os.rename(atomic)signal.signal(SIGTERM, ...)callsstop()cleanly onsystemctl stop; no more dangling symlink or monitor mode on shutdown--ifacevalidation - checksip route get 8.8.8.8before allowing monitor mode flip; prevents accidental default route loss on typo.venv/bin/pip install bleak, not--break-system-packagesiw scancalls; returns cached results on rapid requests, preventing mt7921u timeoutiw scantimeout, serves last known results instead of emptyversioncommand - returns firmware version string the game expects (was silently ignored)start_handshake/stop_handshakeandstart_sniffer/stop_snifferusePopenwith proper start/stop toggle supporths_capture.pystderr is forwarded to journalctl via_hs_stderr_loopstart_deauthdispatchesaireplay-ng -0 5; checks monitor mode before setting to avoid race with hs_capturehs_capture.py(new)Standalone handshake capture script dispatched by the bridge:
WPA*and22000*hash formatsloot_manager.pynaming convention:_.txt / .22000 / .pcap(tshark-filtered)_find_active_session()writes to the current game session directorydocs/uconsole-setup.md(new)Full setup guide covering:
airodump-ng,hcxpcapngtool,tshark-iwanddump1090handled bysetup.shper 0.9.4)wlan1-up.servicefor boot persistenceKnown limitations
os.setresuid()after PTY/monitor setup is not implemented. On a single-user embedded device the risk/complexity tradeoff doesn't justify it, but acknowledged._wl_build_scan_listreads fromself.wifi_networkswhich is empty when all BSSIDs are pre-loaded into_known_wififrom loot history. Filed separately as a bug.hs_capture.pyand deauth both require a monitor-capableadapter on wlan2. The bridge handles WiFi scanning and BLE without it. If wlan2 is absent,
hs/deauth commands return a friendly error and do nothing.
Testing
.txt/.22000/.pcapfiles confirmed in session directoryaireplay-ng -0 5confirmed working, monitor mode handoff to hs_capture clean