Scriptul de mai jos ar trebui să facă ceea ce aveți nevoie. Rețineți că numele fișierului din care veți citi IP-urile este ips.txt în script. Îl puteți înlocui cu propriul nume de fișier.
#!/bin/bash
ip_addresses=$(cat ips.txt)
echo -n "" > iptables_configuration
echo "*raw" >> iptables_configuration
echo „:PREROUTING ACCEPT [0:0]” >> iptables_configuration
echo ":OUTPUT ACCEPT [0:0]" >> iptables_configuration
pentru i în $ip_addresses
do
echo -A PREROUTING -d $i/32 -j DROP >> iptables_configuration
Terminat
echo "COMMIT" >> iptables_configuration
echo "*filtru" >> iptables_configuration
echo „:INPUT ACCEPT [0:0]” >> iptables_configuration
echo „: FORWARD ACCEPT [0:0]” >> iptables_configuration
echo ":OUTPUT ACCEPT [0:0]" >> iptables_configuration
echo "-A INPUT -p tcp -m tcp --dport 25565 --tcp-opțiunea 8 --tcp-flags FIN,SYN,RST,ACK SYN -j REJECT --reject-with icmp-port-inaccessible" >> iptables_configuration
echo "COMMIT" >> iptables_configuration
cat iptables_configuration | iptables-restore
rm iptables_configuration
iptables -t brut -A PREROUTING -p tcp --dport 25565 -j ACCEPT
iptables -t raw -A PREROUTING -p tcp --dport 25565 -m stare --state RELATED,ESTABLISHED -j ACCEPT
iptables -t raw -A PREROUTING -p tcp --dport 25565 --tcp-flags FIN,SYN,RST,ACK SYN -m connlimit --connlimit-above 150 --connlimit-mask 32 --connlimit-saddr -j DROP
iptables -t raw -A PREROUTING -p tcp --dport 25565 --tcp-flags FIN,SYN,RST,ACK SYN -m connlimit --connlimit-above 10 --connlimit-mask 32 --connlimit-saddr -j DROP
Tot ce trebuie să faceți este să executați scriptul în care este prezent fișierul ips.txt. De restul se va ocupa de scenariu.