Automatically kick weak-signal Wi-Fi clients off your OpenWrt device, no matter which driver or interface naming scheme is at play. Because who needs freeloaders with a cringe-worthy signal anyway? 🚀🦶
This repository was inspired by smallerxie/wifi-kickout, thanks for his/her original work :) But it can't work on my Xiaomi BE10000 :(
- Overview
- Features
- Installation
- Usage
- Configuration
- How It Works
- Troubleshooting
- License
- Acknowledgments
wifi-kickout-universal is a one-stop script for OpenWrt that tries every known Wi-Fi management method (like wlanconfig, iw, hostapd_cli, ubus) to:
- Discover your Wi-Fi interfaces.
- Gather connected station info.
- Inspect their signal/RSSI.
- Kick anyone who falls below your threshold (a.k.a. The Line of Shame 😏).
In short: It’s your Wi-Fi bouncer. And it’s not afraid to show clients the door (disassociation) if they don’t meet your signal standards. 🔥
- Auto-detect Wi-Fi interfaces named
athX,wifiX, orwlanX. - Tries multiple station-listing methods until one works:
wlanconfig(old Atheros/Madwifi),iw dev <iface> station dump(mac80211),hostapd_cli -i <iface> all_sta,ubus call hostapd.<iface> get_clients.
- Auto-kick clients below your specified signal threshold:
- Uses
wlanconfig ... kickmacif available, - Falls back to
iw dev <iface> station del, - or
hostapd_cli disassociate, - or… whatever it can find.
- Uses
- Extensive logging in
/tmp/autokick.log. - Cron-friendly – set it and forget it, letting it run every N minutes.
- Add the script to your router, e.g.
/usr/bin/wifi-kickout-universal.sh.wget -P /usr/bin/ https://github.com/xiaowuap/wifi-kickout-universal/raw/refs/heads/main/wifi-kickout-universal.sh
- Make it executable:
chmod +x /usr/bin/wifi-kickout-universal.sh
Run it manually:
/usr/bin/wifi-kickout-universal.shCheck logs to see if it kicked out any unsuspecting devices:
cat /tmp/autokick.log | grep KickIf you’d like to keep the Wi-Fi realm free of moochers 24/7, schedule it:
echo "* * * * * /usr/bin/wifi-kickout-universal.sh" >> /etc/crontabs/root
/etc/init.d/cron restartThat’ll run it every minutes. Feel free to adjust as you see fit.
By default, the script uses:
THRESHOLD=-70This means: “Kick any station with a signal weaker than -70 dBm.” If your device gives positive RSSI values (e.g., 40 for strong, 15 for weak), change that line to a positive threshold (e.g., THRESHOLD=30).
-
Collect Interfaces
It scans/sys/class/net/for anything that starts withath,wifi, orwlan. -
Try Methods in Order
wlanconfig: Looks for a station list containing “ADDR.”iw: Checks if output fromstation dumpis non-empty.hostapd_cli: Checks if it can connect to the socket.ubus: Checks ifhostapd.<iface>is listed inubus.
If one method successfully returns station data, it’s used to parse MAC + signal.
-
Kick
If a station’s signal is below$THRESHOLD, the script logs and forcibly boots them:wlanconfig <iface> kickmac <MAC>- or
iw dev <iface> station del <MAC> - or
hostapd_cli -i <iface> disassociate <MAC> - depending on which method was successful.
-
Logs
Everything gets recorded to/tmp/autokick.log, so you can read your triumphant war stories whenever you please.
-
Syntax Errors
- Possibly caused by Windows line endings. Use
dos2unixorsed -i 's/\r//g' wifi-kickout-universal.sh.
- Possibly caused by Windows line endings. Use
-
No Stations Kicked
- Maybe no device is below your threshold. Lower your threshold to something ridiculous like
-30just to test. - Or check you’re referencing the correct columns if
wlanconfighas a weird output format.
- Maybe no device is below your threshold. Lower your threshold to something ridiculous like
-
All Clients Kicked
- If your device uses negative dBm (like
-60) but your threshold is a positive integer (like30), you’ll forcibly punt everyone (since-60 < 30). Switch to a negative threshold (e.g.-70).
- If your device uses negative dBm (like
-
Method Not Found
- Not all drivers support all commands. The script tries to guess. Trim out methods you don’t need if they cause confusion or errors.
This project is licensed under the MIT License. In short: do whatever you want with it, just don’t blame us if you banish your entire Wi-Fi neighborhood. 😇
- The OpenWrt community for making Wi-Fi wizardry possible.
- Past, present, and future freeloaders—your tenuous signals have inspired this script’s creation.
Now go forth and banish those subpar signals from your glorious Wi-Fi kingdom!
May your logs be ever full and your SSIDs remain snarkily unburdened by weak devices. 🏰⚔️✨