diff --git a/czds/__init__.py b/czds/__init__.py index a7165a0..85011aa 100644 --- a/czds/__init__.py +++ b/czds/__init__.py @@ -5,7 +5,7 @@ from .client import CZDS -__version__ = '1.0.0' +__version__ = '1.0.1' __author__ = 'acidvegas' __email__ = 'acid.vegas@acid.vegas' __github__ = 'https://github.com/acidvegas/czds' \ No newline at end of file diff --git a/czds/__main__.py b/czds/__main__.py index a4d300c..ddfef48 100644 --- a/czds/__main__.py +++ b/czds/__main__.py @@ -12,7 +12,7 @@ import time from .client import CZDS -def main(username: str, password: str, concurrency: int) -> None: +def run_czds(username: str, password: str, concurrency: int) -> None: ''' Main function to download all zone files @@ -61,8 +61,8 @@ def main(username: str, password: str, concurrency: int) -> None: logging.error(f'{url} generated an exception: {e}') - -if __name__ == '__main__': +def main(): + '''Entry point for the command line interface''' parser = argparse.ArgumentParser(description='ICANN API for the Centralized Zones Data Service') parser.add_argument('-u', '--username', default=os.getenv('CZDS_USER'), help='ICANN Username') parser.add_argument('-p', '--password', default=os.getenv('CZDS_PASS'), help='ICANN Password') @@ -75,4 +75,8 @@ if __name__ == '__main__': username = args.username or input('ICANN Username: ') password = args.password or getpass.getpass('ICANN Password: ') - main(username, password, args.concurrency) \ No newline at end of file + run_czds(username, password, args.concurrency) + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/czds_api.egg-info/PKG-INFO b/czds_api.egg-info/PKG-INFO new file mode 100644 index 0000000..545d2a5 --- /dev/null +++ b/czds_api.egg-info/PKG-INFO @@ -0,0 +1,90 @@ +Metadata-Version: 2.2 +Name: czds-api +Version: 1.0.0 +Summary: ICANN API for the Centralized Zones Data Service +Home-page: https://github.com/acidvegas/czds +Author: acidvegas +Author-email: acid.vegas@acid.vegas +Project-URL: Bug Tracker, https://github.com/acidvegas/czds/issues +Project-URL: Documentation, https://github.com/acidvegas/czds#readme +Project-URL: Source Code, https://github.com/acidvegas/czds +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: ISC License (ISCL) +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Topic :: Internet +Classifier: Topic :: Security +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: >=3.6 +Description-Content-Type: text/markdown +License-File: LICENSE +Dynamic: author +Dynamic: author-email +Dynamic: classifier +Dynamic: description +Dynamic: description-content-type +Dynamic: home-page +Dynamic: project-url +Dynamic: requires-python +Dynamic: summary + +# ICANN Centralized Zone Data Service API + +The [ICANN Centralized Zone Data Service](https://czds.icann.org) *(CZDS)* allows *approved* users to request and download DNS zone files in bulk, provided they represent a legitimate company or academic institution and their intended use is legal and ethical. Once ICANN approves the request, this tool streamlines the retrieval of extensive domain name system data, facilitating research and security analysis in the realm of internet infrastructure. + +## Zone Information +Zone files are updated once every 24 hours, specifically from 00:00 UTC to 06:00 UTC. Access to these zones is granted in increments, and the total time for approval across all zones may extend to a month or longer. It is typical for more than 90% of requested zones to receive approval. Access to certain zone files may require additional application forms with the TLD organization. Please be aware that access to certain zones is time-bound, expiring at the beginning of the following year, or up to a decade after the initial approval has been confirmed. + +At the time of writing this repository, the CZDS offers access to 1,151 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. Zones that have expired automatically had the expiration extended for me without doing anything, aside from 13 zones that remained expired. I have included a recent [stats file](./extras/stats.csv) directly from my ICANN account. + +## Installation +```bash +pip install czds-api +``` + +## Usage +###### Command line +```bash +czds [--username --password ] [--concurrency ] +``` + +You can also set the `CZDS_USER` & `CZDS_PASS` environment variables to automatically authenticate: + +```bash +export CZDS_USER='your_username' +export CZDS_PASS='your_password' +``` + +###### As a Python module +```python +import os + +from czds import CZDS + +CZDS_client = CZDS(username, password) + +CZDS_client.download_report('report.csv') + +zone_links = CZDS_client.fetch_zone_links() + +os.makedirs('zones', exist_ok=True) + +for zone_link in zone_links: + CZDS_client.download_zone(zone_link, 'zones') +``` + +## Respects & extras +While ICANN does have an official [czds-api-client-python](https://github.com/icann/czds-api-client-python) repository, I rewrote it from scratch to be more streamline & included a [POSIX version](./extras/czds) for portability. There is some [official documentation](https://raw.githubusercontent.com/icann/czds-api-client-java/master/docs/ICANN_CZDS_api.pdf) that was referenced in the creation of the POSIX version. Either way, big props to ICANN for allowing me to use the CZDS for research purposes! + +___ + +###### Mirrors for this repository: [acid.vegas](https://git.acid.vegas/czds) • [SuperNETs](https://git.supernets.org/acidvegas/czds) • [GitHub](https://github.com/acidvegas/czds) • [GitLab](https://gitlab.com/acidvegas/czds) • [Codeberg](https://codeberg.org/acidvegas/czds) diff --git a/czds_api.egg-info/SOURCES.txt b/czds_api.egg-info/SOURCES.txt new file mode 100644 index 0000000..4b466c0 --- /dev/null +++ b/czds_api.egg-info/SOURCES.txt @@ -0,0 +1,11 @@ +LICENSE +README.md +setup.py +czds/__init__.py +czds/__main__.py +czds/client.py +czds_api.egg-info/PKG-INFO +czds_api.egg-info/SOURCES.txt +czds_api.egg-info/dependency_links.txt +czds_api.egg-info/entry_points.txt +czds_api.egg-info/top_level.txt \ No newline at end of file diff --git a/czds_api.egg-info/dependency_links.txt b/czds_api.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/czds_api.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/czds_api.egg-info/entry_points.txt b/czds_api.egg-info/entry_points.txt new file mode 100644 index 0000000..e9afd74 --- /dev/null +++ b/czds_api.egg-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +czds = czds.__main__:main diff --git a/czds_api.egg-info/top_level.txt b/czds_api.egg-info/top_level.txt new file mode 100644 index 0000000..1fc839e --- /dev/null +++ b/czds_api.egg-info/top_level.txt @@ -0,0 +1 @@ +czds diff --git a/dist/czds_api-1.0.0-py3-none-any.whl b/dist/czds_api-1.0.0-py3-none-any.whl new file mode 100644 index 0000000..b438a95 Binary files /dev/null and b/dist/czds_api-1.0.0-py3-none-any.whl differ diff --git a/dist/czds_api-1.0.0.tar.gz b/dist/czds_api-1.0.0.tar.gz new file mode 100644 index 0000000..a23c5e2 Binary files /dev/null and b/dist/czds_api-1.0.0.tar.gz differ diff --git a/setup.py b/setup.py index ae592b4..b339563 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ with open('README.md', 'r', encoding='utf-8') as fh: setup( name='czds-api', - version='1.0.0', + version='1.0.1', author='acidvegas', author_email='acid.vegas@acid.vegas', description='ICANN API for the Centralized Zones Data Service',