EOF
# cat /etc/persistent/banbadccq.sh
#!/bin/ash
ravi=ccq
badcpe=75
while :
do
ARRAY=`wstalist |egrep '(mac|'$ravi'")'| sed -e 's/"mac": //g' -e "s/$ravi//g" -e 's/ ://g' -e 's/,//g' -e 's/-//g' -e 's/"//g'`
for j in $ARRAY; do
if [ ${#j} -gt 3 ];
then
MAC=$j
continue
else
CCQ=$j
echo $MAC $CCQ
if [ $CCQ -lt $badcpe ];
then
/usr/bin/iwpriv ath0 maccmd 2
/usr/bin/iwpriv ath0 addmac $MAC
logger "MAC:" $MAC "is below threshold at "$CCQ
echo "MAC:" $MAC "is below threshold at "$CCQ
/usr/bin/iwpriv ath0 kickmac $MAC
CPE_MAC=$(echo $MAC |sed s/://g)
echo $CPE_MAC
tmp_file="/var/tmp/restore_${CPE_MAC}"
cat <<endKat >/$tmp_file
#!/bin/ash
sleep 300
/usr/bin/iwpriv ath0 delmac $MAC
rm $tmp_file
endKat
chmod +x $tmp_file
sh $tmp_file &
else
echo "do nothing"
fi
fi
done
sleep 600
done
Para ejecutar el script en el inicio hay que modificar el fichero /etc/persistent/rc.prestart
# cat rc.prestart
/etc/persistent/banbadccq.sh&
cfgmtd -w -p /etc/
reboot
Manipulating the MAC white/black list
Use:
- iwpriv ath0 maccmd 3 To clear the MAC list.
- iwpriv ath0 maccmd 1 To make the list a whitelist.
- iwpriv ath0 maccmd 2 To make the list a blacklist.
- iwpriv ath0 addmac 00:11:22:33:44:55 To add a mac address to the list.
- iwpriv ath0 delmac 00:11:22:33:44:55 To delete a mac from the list.
- iwpriv ath0 kickmac 00:11:22:33:44:55 To send a disassociation frame to an associated station.
No hay comentarios:
Publicar un comentario