Created
August 26, 2016 11:44
-
-
Save jaka/5914a7b4044406e82a78c9d861723596 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/sh | |
LOWER=15 | |
BANTIME=5000 | |
iw event | while read line; do | |
case "$line" in | |
*": new station "*) | |
iface="${line%%:*}" | |
mac=`echo "${line##* }" | tr [a-f] [A-F]` | |
snr=`iwinfo $iface assoclist | grep $mac | sed 's/^.*(/(/' | cut -f1 -d")" | sed "s/^(SNR //"` | |
[ "$snr" -lt "$LOWER" ] && { | |
par="{\"addr\":\"$mac\", \"reason\":\"assoc toomany\", \"deauth\":true, \"ban_time\":$BANTIME}" | |
ubus call hostapd.$_iface del_client "$par" | |
} | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment