Skip to main content

Async DNS client

Project description

Triton DNS client

Triton is a simple DNS client made for better understanding of DNS protocol

Installation

From PYPI

pip3 install triton-dns-client

From this repo

git clone https://git.best-service.online/yurzs/triton.git  
cd triton 
python3 setup.py install

How to use

Here is an example query for A record of this gitlab instance

>>> import triton
>>> a = triton.sync_query('8.8.8.8', 'google.com')
>>> print(a.to_json())
{
    "header": {
        "id": 37920,
        "qr": 1,
        "opcode": 0,
        "aa": 0,
        "tc": 0,
        "rd": 1,
        "ra": 1,
        "z": 0,
        "rcode": 0,
        "qdcount": 1,
        "ancount": 6,
        "nscount": 0,
        "arcount": 0
    },
    "question": [
        {
            "name": "google.com",
            "type": 1,
            "class": 1
        }
    ],
    "answer": [
        {
            "name": "google.com",
            "type": "A",
            "class": 1,
            "ttl": 257,
            "rdata": {
                "address": "64.233.165.113"
            }
        },
        {
            "name": "google.com",
            "type": "A",
            "class": 1,
            "ttl": 257,
            "rdata": {
                "address": "64.233.165.102"
            }
        },
        {
            "name": "google.com",
            "type": "A",
            "class": 1,
            "ttl": 257,
            "rdata": {
                "address": "64.233.165.101"
            }
        },
        {
            "name": "google.com",
            "type": "A",
            "class": 1,
            "ttl": 257,
            "rdata": {
                "address": "64.233.165.139"
            }
        },
        {
            "name": "google.com",
            "type": "A",
            "class": 1,
            "ttl": 257,
            "rdata": {
                "address": "64.233.165.100"
            }
        },
        {
            "name": "google.com",
            "type": "A",
            "class": 1,
            "ttl": 257,
            "rdata": {
                "address": "64.233.165.138"
            }
        }
    ],
    "authority": [],
    "additional": []
}

For demonstration purposes sync function is used.
Call triton.query for async version

Tree resolve

Also there is experimental full DNS tree resolve function

>>> import triton
>>> a = triton.sync_full_chain('git.best-service.online', 1)
>>> print(a.to_json())
{
    "header": {
        "id": 45902,
        "qr": 1,
        "opcode": 0,
        "aa": 1,
        "tc": 0,
        "rd": 1,
        "ra": 0,
        "z": 0,
        "rcode": 0,
        "qdcount": 1,
        "ancount": 1,
        "nscount": 1,
        "arcount": 1
    },
    "question": [
        {
            "name": "git.best-service.online",
            "type": 1,
            "class": 1
        }
    ],
    "answer": [
        {
            "name": "git.best-service.online",
            "type": "A",
            "class": 1,
            "ttl": 1000,
            "rdata": {
                "address": "80.211.196.34"
            }
        }
    ],
    "authority": [
        {
            "name": "best-service.online",
            "type": "NS",
            "class": 1,
            "ttl": 100,
            "rdata": {
                "nsdname": "dns-core.best-service.online"
            }
        }
    ],
    "additional": [
        {
            "name": "dns-core.best-service.online",
            "type": "A",
            "class": 1,
            "ttl": 1000,
            "rdata": {
                "address": "163.172.161.149"
            }
        }
    ]
}

For demonstration purposes sync function is used.
Call triton.full_chain for async version

TODO List

  • Enable EDNS
  • Add DNSSEC Resource Record types

List of available resource record types

  • A
  • AAAA
  • NS
  • TXT
  • SOA
  • OPT
  • RRSIG
  • DNSKEY
  • DS
  • NSEC
  • NSEC3
  • NSEC3PARAM

Currently supported DNSSEC algorithms

  • RSASHA1
  • RSASHA256
  • RSASHA512
  • ECCGOST
  • RSA_NSEC3_SHA1
  • DSA
  • DSA_NSEC3_SHA1
  • ECDSAP256SHA256
  • ECDSAP256SHA384
  • ED448
  • ED25519

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

triton_dns_client-2019.10.13.2158.tar.gz (21.4 kB view details)

Uploaded Source

File details

Details for the file triton_dns_client-2019.10.13.2158.tar.gz.

File metadata

  • Download URL: triton_dns_client-2019.10.13.2158.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for triton_dns_client-2019.10.13.2158.tar.gz
Algorithm Hash digest
SHA256 ad2d311a9d38286029df3d722a4d7c5e0171940857b63a66c9fa6756835076bd
MD5 7e46fb6867f8142e3121ed02d12e8f67
BLAKE2b-256 ef8c63a706dd23b6ff2fc2b6f04b44c6daf2d8199af5d3ae526942920eaeb25f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page