This commit is contained in:
parent
7b81f5a1ea
commit
8f67cf68cb
17
start.sh
17
start.sh
@ -41,16 +41,21 @@ for country in $COUNTRIES; do #https://www.ipdeny.com/ipblocks/data/countries/${
|
||||
url="https://raw.githubusercontent.com/firehol/blocklist-ipsets/refs/heads/master/geolite2_country/country_${country}.netset" #
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Baixando lista IPs: $country"
|
||||
|
||||
tmp_file2="${ZONE_DIR}/${country}.zone.tmp2"
|
||||
tmp_file="${ZONE_DIR}/${country}.zone.tmp"
|
||||
target_file="${ZONE_DIR}/${country}.zone"
|
||||
|
||||
if curl -sSf -o "$tmp_file" "$url"; then
|
||||
grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(/[0-9]+)?$' "$tmp_file" > "$target_file"
|
||||
if curl -sSf -o "$tmp_file2" "$url"; then
|
||||
grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(/[0-9]+)?$' "$tmp_file2" > "$tmp_file"
|
||||
rm "$tmp_file2"
|
||||
|
||||
|
||||
if [ -f "$target_file" ] && cmp -s "$tmp_file" "$target_file"; then
|
||||
echo "[$country] Arquivo inalterado."
|
||||
rm "$tmp_file"
|
||||
if [ ! -s "$target_file" ]; then
|
||||
echo "[$country] Lista filtrada vazia, ignorando atualização."
|
||||
rm "$target_file"
|
||||
continue
|
||||
else
|
||||
echo "[$country] Atualizando IPs."
|
||||
mv "$tmp_file" "$target_file"
|
||||
fi
|
||||
else
|
||||
echo "[$country] Falha no download. Mantendo antigo (se existir)."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user