Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added examples to showcase how cool this dns library is #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

meramsey
Copy link

I love this library of all the ones i've tried it was the fastest easiest to use. I will say at first it took a bit to figure out how to best get all the results I wanted to reuse.

I think the examples would be super helpful for any people checking out the project and wanting something easy to use to see how they can do most anything easily.

The rdns/ptr lookups for example are glossed over on the examples but fully shown with functions for both using coroutines.

The domaindns.py has a really badass class I have been working on for my app which uses whois/rdap whois and aiodns. I have commented out the non aiodns stuff but left it in so people can see what's possible. If possible would be nice if this was included as some of these things will save people having to reinvent the wheel. For anyone else that already knows how to do this stuff it won't affect them negatively.

Keep up the great work with this library.

Examples:

From domaindns.py

print('')
print('DNS Records JSON:')
# print(json.dumps(domain_dict, default=str))
print(json.dumps(DomainInfo('google.com').domain_dict))

print('')
print('DNS Records JSON Pretty Print:')
print(json.dumps(DomainInfo('google.com').domain_dict, indent=4, sort_keys=False))

Output:

DNS Records JSON:
{"domain": "google.com", "DNS": {"SOA": {"nsname": "ns1.google.com", "hostmaster": "dns-admin.google.com", "serial": "343814713", "refresh": "900", "retry": "900", "expires": "1800", "minttl": "60", "ttl": "16"}, "NS": [["ns1.google.com", "216.239.32.10"], ["ns3.google.com", "216.239.36.10"], ["ns4.google.com", "216.239.38.10"], ["ns2.google.com", "216.239.34.10"]], "WWW": [["A", "www.google.com", "142.250.64.196"], ["A", "google.com", "142.250.64.238"], ["AAAA", "google.com", "2607:f8b0:4008:807::200e"]], "MX": [["MX", "alt3.aspmx.l.google.com", "40"], ["MX", "aspmx.l.google.com", "10"], ["MX", "alt4.aspmx.l.google.com", "50"], ["MX", "alt2.aspmx.l.google.com", "30"], ["MX", "alt1.aspmx.l.google.com", "20"]], "TXT": [["TXT", "_dmarc.google.com", "v=DMARC1; p=reject; rua=mailto:mailauth-reports@google.com"], ["TXT", "google.com", "v=spf1 include:_spf.google.com ~all"], ["TXT", "google.com", "globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8="], ["TXT", "google.com", "docusign=05958488-4752-4ef2-95eb-aa7ba8a3bd0e"], ["TXT", "google.com", "docusign=1b0a6754-49b1-4db5-8540-d2c12664b289"], ["TXT", "google.com", "facebook-domain-verification=22rm551cu4k0ab0bxsw536tlds4h95"]]}}

DNS Records JSON Pretty Print:
{
    "domain": "google.com",
    "DNS": {
        "SOA": {
            "nsname": "ns1.google.com",
            "hostmaster": "dns-admin.google.com",
            "serial": "343814713",
            "refresh": "900",
            "retry": "900",
            "expires": "1800",
            "minttl": "60",
            "ttl": "15"
        },
        "NS": [
            [
                "ns2.google.com",
                "216.239.34.10"
            ],
            [
                "ns4.google.com",
                "216.239.38.10"
            ],
            [
                "ns3.google.com",
                "216.239.36.10"
            ],
            [
                "ns1.google.com",
                "216.239.32.10"
            ]
        ],
        "WWW": [
            [
                "A",
                "www.google.com",
                "142.250.64.196"
            ],
            [
                "A",
                "google.com",
                "142.250.64.238"
            ],
            [
                "AAAA",
                "google.com",
                "2607:f8b0:4008:807::200e"
            ]
        ],
        "MX": [
            [
                "MX",
                "alt1.aspmx.l.google.com",
                "20"
            ],
            [
                "MX",
                "alt2.aspmx.l.google.com",
                "30"
            ],
            [
                "MX",
                "alt4.aspmx.l.google.com",
                "50"
            ],
            [
                "MX",
                "aspmx.l.google.com",
                "10"
            ],
            [
                "MX",
                "alt3.aspmx.l.google.com",
                "40"
            ]
        ],
        "TXT": [
            [
                "TXT",
                "_dmarc.google.com",
                "v=DMARC1; p=reject; rua=mailto:mailauth-reports@google.com"
            ],
            [
                "TXT",
                "google.com",
                "facebook-domain-verification=22rm551cu4k0ab0bxsw536tlds4h95"
            ],
            [
                "TXT",
                "google.com",
                "docusign=1b0a6754-49b1-4db5-8540-d2c12664b289"
            ],
            [
                "TXT",
                "google.com",
                "docusign=05958488-4752-4ef2-95eb-aa7ba8a3bd0e"
            ],
            [
                "TXT",
                "google.com",
                "globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8="
            ],
            [
                "TXT",
                "google.com",
                "v=spf1 include:_spf.google.com ~all"
            ]
        ]
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant