Updated stats in README and fixed CZDS shell script to save the correct file type as a gunzip archive

This commit is contained in:
Dionysus 2024-01-18 18:15:09 -05:00
parent 4be93ce367
commit 345d5bd4f1
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
2 changed files with 9 additions and 5 deletions

View File

@ -7,7 +7,7 @@ Zone files are updated once every 24 hours, specifically from 00:00 UTC to 06:00
At the time of writing this repository, the CZDS offers access to 1,150 zones in total. At the time of writing this repository, the CZDS offers access to 1,150 zones in total.
1,079 have been approved, 55 are still pending *(after 3 months)*, 10 have been revoked because the TLDs are longer active, and 6 have been denied. 1,079 have been approved, 55 are still pending *(after 3 months)*, 10 have been revoked because the TLDs are longer active, and 6 have been denied. Zones that have expired automatically had the expiration extended for me without doing anything, aside from 13 zones that remained expired.
## Usage ## Usage
### Authentication ### Authentication

12
czds
View File

@ -23,13 +23,15 @@ download_zone() {
url="$1" url="$1"
token="$2" token="$2"
filename=$(basename "$url") filename=$(basename "$url")
filepath="zonefiles/$filename" tld=$(echo "$filename" | cut -d '.' -f 1)
filepath="zonefiles/$tld.txt.gz"
# Create output directory if it does not exist # Create output directory if it does not exist
mkdir -p zonefiles mkdir -p zonefiles
# Make the GET request and save the response to a file # Make the GET request and save the response to a file
curl -s -o "$filepath" -H "Authorization: Bearer $token" "$url" curl --progress-bar -o "$filepath" -H "Authorization: Bearer $token" "$url"
echo "Downloaded zone file to $filepath" echo "Downloaded zone file to $filepath"
} }
@ -56,8 +58,10 @@ zone_links=$(curl -s -H "Authorization: Bearer $token" "https://czds-api.icann.o
# Download zone files # Download zone files
for url in $zone_links; do for url in $zone_links; do
echo "Downloading $url..." if [ ! -f $filepath ]; then
download_zone "$url" "$token" echo "Downloading $url..."
download_zone "$url" "$token"
fi
done done
echo "All zone files downloaded." echo "All zone files downloaded."