detect deauthentication attempts on wireless networks. vibe coded yet untested.
- Python 100%
|
|
||
|---|---|---|
| README.md | ||
| wlan_deauth_detector.py | ||
WLAN Deauthentication Attack Detector
A Python script that monitors 802.11 management frames to detect deauthentication attacks on a wireless network. It flags bursts of deauth frames, broadcast deauths, and deauths from non-AP sources (potential MAC spoofing).
Requirements
- Python 3.8+
- A wireless adapter capable of monitor mode
- Root privileges (to capture 802.11 frames)
uv(fast Python package manager)
Setting Up the Environment with uv
1. Install uv
On Linux / macOS:
curl -LsSf https://astral.sh/uv/install.sh | sh
On Windows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Verify the installation:
uv --version
2. Create a project (optional but recommended)
uv init wlan-deauth-detector
cd wlan-deauth-detector
3. Add the scapy dependency
uv add scapy
This creates a pyproject.toml and a virtual environment automatically.
4. (Linux) Put your wireless interface in monitor mode
sudo airmon-ng stop wlan0
sudo airmon-ng start wlan0
This creates a wlan0mon (or mon0) interface in monitor mode.
Running the Detector
All commands below use uv run so the correct virtual environment is activated
automatically.
Basic usage
sudo uv run wlan_deauth_detector.py -i wlan0mon
With a known AP MAC (enables spoofing detection)
sudo uv run wlan_deauth_detector.py -i wlan0mon --ap-mac AA:BB:CC:DD:EE:FF
Custom burst thresholds
sudo uv run wlan_deauth_detector.py -i wlan0mon --burst-window 3 --burst-threshold 5
Verbose / debug output
sudo uv run wlan_deauth_detector.py -i wlan0mon -v
Disable specific alerts
sudo uv run wlan_deauth_detector.py -i wlan0mon --no-broadcast-alert --no-non-ap-alert
Custom log file
sudo uv run wlan_deauth_detector.py -i wlan0mon --log-file /var/log/deauth.log
CLI Reference
| Flag | Default | Description |
|---|---|---|
-i, --interface |
mon0 |
Wireless interface in monitor mode |
--ap-mac |
(none) | Known legitimate AP MAC address |
--burst-window |
5.0 |
Sliding window in seconds for burst detection |
--burst-threshold |
3 |
Deauths in window to trigger a burst alert |
--no-broadcast-alert |
(off) | Disable broadcast deauth alerts |
--no-non-ap-alert |
(off) | Disable non-AP source alerts |
--log-file |
deauth_detector.log |
Path to the log file |
-v, --verbose |
(off) | Enable debug-level output |
Detection Rules
- Burst detection – N or more deauth frames from the same source within a sliding time window (default: 3 in 5 s).
- Broadcast deauth – A deauth frame addressed to
ff:ff:ff:ff:ff:ff, which disconnects every associated client. - Non-AP source – A deauth frame whose source MAC does not match the configured AP MAC, indicating possible MAC spoofing.
Stopping
Press Ctrl+C to stop the detector. A summary of all observed deauths and
triggered alerts is printed to the console and appended to the log file.
Project Layout
wlan_deauth_detector.py # Main script (detector + CLI)
pyproject.toml # Managed by uv
deauth_detector.log # Runtime log (created on first run)
README.md # This file