Skip to content

scanner: explain *why* a scan found no targets#528

Merged
kimocoder merged 1 commit into
masterfrom
scanner-no-targets-diagnostics
Jun 3, 2026
Merged

scanner: explain *why* a scan found no targets#528
kimocoder merged 1 commit into
masterfrom
scanner-no-targets-diagnostics

Conversation

@kimocoder

Copy link
Copy Markdown
Owner

"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".

"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>
Copilot AI review requested due to automatic review settings June 3, 2026 18:50
@kimocoder kimocoder merged commit 71b55f8 into master Jun 3, 2026
1 check passed
@kimocoder kimocoder deleted the scanner-no-targets-diagnostics branch June 3, 2026 18:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread wifite/util/scanner.py
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 thread wifite/util/scanner.py
Comment on lines +344 to +345
Color.pl(' {O} - Some USB chipsets (rtw88/rtl8xxxu) have flaky monitor '
'mode; try a different adapter.{W}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants