czds

- ICANN Centralized Zone Data Service Tool
git clone git://git.acid.vegas/czds.git
Log | Files | Refs | Archive | README | LICENSE

commit 345d5bd4f1cc69f6c9a767f090d60fdb5d2ce6e2
parent 4be93ce3677f17feecefd6466f59ce074f22ab73
Author: acidvegas <acid.vegas@acid.vegas>
Date: Thu, 18 Jan 2024 18:15:09 -0500

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

Diffstat:
MREADME.md | 2+-
Mczds | 12++++++++----

2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
@@ -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.
 
-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
 ### Authentication
diff --git a/czds b/czds
@@ -23,13 +23,15 @@ download_zone() {
 	url="$1"
 	token="$2"
 	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
 	mkdir -p zonefiles
 
 	# 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"
 }
 
@@ -56,8 +58,10 @@ zone_links=$(curl -s -H "Authorization: Bearer $token" "https://czds-api.icann.o
 
 # Download zone files
 for url in $zone_links; do
-	echo "Downloading $url..."
-	download_zone "$url" "$token"
+	if [ ! -f $filepath ]; then
+		echo "Downloading $url..."
+		download_zone "$url" "$token"
+	fi
 done
 
 echo "All zone files downloaded."