This commit is contained in:
Bxio 2025-06-23 18:58:10 +01:00
parent 04e36eb9b5
commit 0221028ca9

View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
#casysctl net.ipv4.ip_forward
echo -e " echo -e "
░█████╗░███╗░░██╗██████╗░██████╗░░█████╗░░██████╗ ░█████╗░███╗░░██╗██████╗░██████╗░░█████╗░░██████╗
██╔══██╗████╗░██║██╔══██╗██╔══██╗██╔══██╗██╔════╝ ██╔══██╗████╗░██║██╔══██╗██╔══██╗██╔══██╗██╔════╝
@ -71,9 +73,7 @@ for country in $COUNTRIES; do
continue continue
fi fi
done
for country in $COUNTRIES; do
if ipset list "$country" &>/dev/null; then if ipset list "$country" &>/dev/null; then
echo "[$country] Limpando ipset antigo..." echo "[$country] Limpando ipset antigo..."
@ -83,16 +83,12 @@ for country in $COUNTRIES; do
echo "[$country] Criando novo ipset..." echo "[$country] Criando novo ipset..."
ipset create "$country" hash:net maxelem 262144 ipset create "$country" hash:net maxelem 262144
fi fi
done
for country in $COUNTRIES; do
while read -r subnet; do while read -r subnet; do
ipset add "$country" "$subnet" -exist || echo "Falha ao adicionar: $subnet" ipset add "$country" "$subnet" -exist || echo "Falha ao adicionar: $subnet"
echo "[$country | $subnet] Criando novo ipset..." echo "[$country | $subnet] Criando novo ipset..."
done < "$target_file" done < "$target_file"
done
for country in $COUNTRIES; do
add_iptables_rule PREROUTING "$country" add_iptables_rule PREROUTING "$country"
echo "[$country] Proteção configurada." echo "[$country] Proteção configurada."
done done