|
楼主 |
发表于 2020-2-29 23:13
|
显示全部楼层
百度了下说有个办法如下,但是太专业了吧,关键专业不怕,我就想思考,就是不懂啊,路由器里哪里有写这些代码的地方啊?去哪执行什么“执行opkg update”啊?我想思考,一步一步来,请大神教我
在github上有一段kickass.sh代码(bash脚本)https://github.com/Quenii/kickass
代码为:
复制代码
#!/bin/bash
while true;
do
maclist=(`iw dev wlan0 station dump | grep "Station" | cut -f 2 -s -d " "`)
rxlist=(`iw dev wlan0 station dump | grep "signal:" | cut -f 3 -s -d " "`)
#maclist=(`iwinfo wlan0 assoclist | grep "dBm" | cut -f 1 -s -d " "`)
#rxlist=(`iwinfo wlan0 assoclist | grep "dBm" | cut -f 3 -s -d " "`)
rxref="-80" #threshold
len=${#maclist[@]}
for((i=0;i<$len;i++))
do
mac=${maclist[$i]}
rx=${rxlist[$i]}
# here, use string comparation, simple but error prone
if [[ "$rx" > "$rxref" ]]; then
#echo $mac $rx
ubus call hostapd.wlan0 del_client '{"addr":"'"$mac"'", "reason": 5, "deauth": True, "ban_time": 3000}'
#ubus call hostapd.wlan0 list_bans
fi
done
sleep 1
done
复制代码
使用方法:
1、执行opkg update,然后opkg install bash和opkg install iwinfo两条安装指令
2、将kickass.sh文件,下载到/usr/文件夹下面,修改权限为755.
chmod 755 /use/kickass.sh
3、修改程序代码中rxref的值为想要设置剔除的信号强度值;
4、/etc/re.local文件是openwrt系统启动执行的文件,在里面写上执行命令,即可在openwrt启动时执行命令:
bash kickass.sh
5、重启路由器之后,即可。 |
|