Skip to content

Instantly share code, notes, and snippets.

@jaka
Created August 26, 2016 11:44
Show Gist options
  • Save jaka/5914a7b4044406e82a78c9d861723596 to your computer and use it in GitHub Desktop.
Save jaka/5914a7b4044406e82a78c9d861723596 to your computer and use it in GitHub Desktop.
#!/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