scanner: explain *why* a scan found no targets#528
Merged
Conversation
"No targets found … you may have issues with your wifi card" gave users no way to tell apart the three common causes, which all look identical. Add Scanner._diagnose_no_targets(), printed before the failure, that probes them: - Reads the monitor interface's rx_packets counter. In monitor mode the kernel bumps it for every captured frame, so a near-zero count is a strong signal the card/driver isn't actually capturing — a monitor-mode/driver problem, not a network one. Emits the driver name and concrete next steps (aireplay-ng --test, try another adapter, check dmesg). - If frames ARE being received, points at filtering/band instead. - Notes when the scan only covered 2.4 GHz (default) and suggests -5 / --band for 5 GHz APs. - Surfaces any active encryption/type filter (e.g. --wpa) that may be hiding APs. Best-effort and print-only; resolves the long-standing TODO at the no-targets raise site. Verified live: distinguishes "card receiving N frames -> filter/band" from "card received ~0 frames -> driver/monitor issue". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves the “No targets found” failure path by printing targeted diagnostics to help users distinguish between common root causes (no monitor-mode capture vs. filtering/band selection) before raising the exception.
Changes:
- Added
Scanner._diagnose_no_targets()to print best-effort scan diagnostics (rx packet counter, band coverage, encryption/type filter). - Invoked
_diagnose_no_targets()when a scan yields zero targets, replacing the previous TODO block.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+353
to
+354
| Color.pl(' {O} - Scanning {C}2.4 GHz only{O} (default); for 5 GHz APs add ' | ||
| '{C}-5{O} or {C}--band abg{W}.') |
Comment on lines
+344
to
+345
| Color.pl(' {O} - Some USB chipsets (rtw88/rtl8xxxu) have flaky monitor ' | ||
| 'mode; try a different adapter.{W}') |
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.
"No targets found … you may have issues with your wifi card" gave users no way to tell apart the three common causes, which all look identical. Add Scanner._diagnose_no_targets(), printed before the failure, that probes them:
Best-effort and print-only; resolves the long-standing TODO at the no-targets raise site. Verified live: distinguishes "card receiving N frames -> filter/band" from "card received ~0 frames -> driver/monitor issue".