Script

  
that automatically rejects dangerous IP addresses A very useful iptables script

#!/bin/bash

netstat -an grep :80 awk '{print $5 }' sort awk -F: '{print $1}' uniq -c awk '$1 > 100 {print $1,$2}' > /root/bad_ip.txt cat /root/bad_ip.txt >>/root/back_bad.txt

for i1 in `awk '{print $2}' /root/bad_ip sed -n '1p'`

do

iptables -A INPUT -p tcp -s $i1 - j REJECT

done

for i2 in `awk '{print $2}' /root/bad_ip sed -n '2p'`

do

Iptables -A INPUT -p tcp -s $i2 -j REJECT

done

for i3 in `awk '{print $2}' /root/bad_ip sed -n '3p'` < BR>
do

iptables -A INPUT -p tcp -s $i3 -j REJECT

done

This script says there are 3 ip connections 80 ports larger than 100, refused to iptables, afraid that there are more IP attacks at the same time, you can get a few more lines

~

Write your own, shell will not use, but the script is certainly easy to use.

This script can be added to the mission plan and executed once every minute.
Copyright © Windows knowledge All Rights Reserved