cs ltvip脚本-CS脚本领域
wget http://www.inetbase.com/scripts/ddos/install.sh\nchmod 0700 install.sh\n./install.sh
wget http://www.inetbase.com/scripts/ddos/uninstall.ddos\nchmod 0700 uninstall.ddos\n./uninstall.ddos
#!/bin/sh\n#author:Tom\n#date:2023-11-29\ncc ( )\n{\n[ -f ignore.ip.list ] || echo \"127.0.0.1\" > ignore.ip.list\n netstat -ntu | awk '{print $5}' | cut -d: -f4 | sort | uniq -c | sort -nr > BAD_IP_LIST\n while read line; do\n CURR_LINE_CONN=$(echo $line | cut -d\" \" -f1)\n CURR_LINE_IP=$(echo $line | cut -d\" \" -f2)\n iptables -L -n |grep -i $CURR_LINE_IP >>/dev/null\n if [ $? = 0 ];then\n break\n else\n if [ $CURR_LINE_CONN -lt 100 ]; then\n break\n else \n IGNORE_BAN=`grep -c \"$CURR_LINE_IP\" ignore.ip.list` >>/dev/null\n if [ $IGNORE_BAN -ge 1 ]; then\n continue\n else\n iptables -I INPUT -s $CURR_LINE_IP -j DROP >> /dev/null\n fi\n fi\n fi\n done < BAD_IP_LIST\n}\nwhile true;do\n cc\n sleep 1\ndone
1 ignore.ip.list 可以添加白名单
2 $CURR_LINE_CONN -lt 100 这个100按自己需求去定义这里默认是写了100个并发连接就拒绝了。
最后脚本在后台执行就循环了
--END--
欢迎关注【辉哥传书vlog】头条号,喜欢记得点赞、收藏、评论、转发哦!