zoukankan      html  css  js  c++  java
  • shell黑名单

    #/bin/bash
    netstat -ant | grep "EST" | grep -v "22000" | awk '{print $5}' | grep -v "^10" | cut -d ":" -f1 | sort | uniq -c | sort -nr | awk '$1 > 4 {print $1,$2}' > /root/root/black.txt
    
    for i in `awk '{print $2}' /root/root/black.txt`
    do
    COUNT=`grep $i /root/root/black.txt | awk '{print $1}'`
    DEFINE="4"
    ZERO="0"
    if [ $COUNT -gt $DEFINE ];
      then
      grep $i /root/root/white.txt > /dev/null
        if [ $? -gt $ZERO ];
          then
          echo "$COUNT $i"
          iptables -F
          iptables -I INPUT -i em1 -p tcp -s $i -j DROP
        fi
    fi
    done    
    
    
    iptables -I INPUT -i em1 -p tcp --dport 80 -m connlimit  --connlimit-above 10 -j DROP
  • 相关阅读:
    DP -- 递推
    二分查找题
    动态规划
    二分专题
    并查集
    三分法
    二分法
    插入排序
    排序小结
    Go go.mod入门
  • 原文地址:https://www.cnblogs.com/icemonkey/p/10430316.html
Copyright © 2011-2022 走看看