首页 > 代码库 > 快速过滤出IP添加到IPtables中

快速过滤出IP添加到IPtables中

awk ‘{IP[$1]++}END{for( i in IP ) print IP[i],i}‘  access.2016-12-09.log |sort -nr  > /tmp/ewb.2016-12-09.log

awk ‘{IP[$1]++}END{for( i in IP ) print IP[i],i}‘  access.2016-12-10.log |sort -nr  > /tmp/ewb.2016-12-10.log

awk ‘{IP[$1]++}END{for( i in IP ) print IP[i],i}‘  access.2016-12-11.log |sort -nr  > /tmp/ewb.2016-12-11.log

awk ‘{IP[$1]++}END{for( i in IP ) print IP[i],i}‘  access.log |sort -nr  > /tmp/ewb.2016-12-12.log



awk ‘{IP[$1]++}END{for( i in IP ) print IP[i],i}‘  logs/localhost_access_log.2016-12-10.txt |sort -nr |head -n 130|awk ‘{print $2}‘ >111

for i in `cat 111`;do iptables -I INPUT -s $i -j REJECT ;done


快速过滤出IP添加到IPtables中