Updated zone stats in README, updated code to be more verbose
This commit is contained in:
parent
1b90b6e099
commit
4be93ce367
@ -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,076 have been approved, 58 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.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
### Authentication
|
### Authentication
|
||||||
|
5
czds
5
czds
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# ICANN API for the Centralized Zones Data Service - developed by acidvegas (https://git.acid.vegas/czds)
|
# ICANN API for the Centralized Zones Data Service - developed by acidvegas (https://git.acid.vegas/czds)
|
||||||
|
|
||||||
# https://czds.icann.org
|
# https://czds.icann.org
|
||||||
@ -24,8 +24,9 @@ download_zone() {
|
|||||||
token="$2"
|
token="$2"
|
||||||
filename=$(basename "$url")
|
filename=$(basename "$url")
|
||||||
filepath="zonefiles/$filename"
|
filepath="zonefiles/$filename"
|
||||||
|
|
||||||
# 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 -s -o "$filepath" -H "Authorization: Bearer $token" "$url"
|
||||||
|
5
czds.py
5
czds.py
@ -20,6 +20,10 @@ except ImportError:
|
|||||||
raise ImportError('Missing dependency: requests (pip install requests)')
|
raise ImportError('Missing dependency: requests (pip install requests)')
|
||||||
|
|
||||||
|
|
||||||
|
# Setting up logging
|
||||||
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
|
|
||||||
|
|
||||||
def authenticate(username: str, password: str) -> str:
|
def authenticate(username: str, password: str) -> str:
|
||||||
'''
|
'''
|
||||||
Authenticate with ICANN's API and return the access token.
|
Authenticate with ICANN's API and return the access token.
|
||||||
@ -65,7 +69,6 @@ def main(username: str, password: str, concurrency: int):
|
|||||||
response = requests.get('https://czds-api.icann.org/czds/downloads/links', headers=headers)
|
response = requests.get('https://czds-api.icann.org/czds/downloads/links', headers=headers)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
zone_links = response.json()
|
zone_links = response.json()
|
||||||
|
|
||||||
output_directory = 'zonefiles'
|
output_directory = 'zonefiles'
|
||||||
os.makedirs(output_directory, exist_ok=True)
|
os.makedirs(output_directory, exist_ok=True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user