0% found this document useful (0 votes)
49 views3 pages

A Records

This document contains Python code examples for performing various DNS lookups and manipulations, including: 1) Querying for A, AAAA, MX, and NS records 2) Performing a reverse DNS lookup 3) Manipulating domain names by checking subdomains, superdomains, and converting between names 4) Converting between IPv4/IPv6 addresses and their DNS reverse names 5) Converting between E.164 phone numbers and ENUM names

Uploaded by

Akhil Venkata
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views3 pages

A Records

This document contains Python code examples for performing various DNS lookups and manipulations, including: 1) Querying for A, AAAA, MX, and NS records 2) Performing a reverse DNS lookup 3) Manipulating domain names by checking subdomains, superdomains, and converting between names 4) Converting between IPv4/IPv6 addresses and their DNS reverse names 5) Converting between E.164 phone numbers and ENUM names

Uploaded by

Akhil Venkata
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

A Records

import dns.resolver
answers = dns.resolver.query('topdog.za.net', 'A')
for rdata in answers:
print rdata.address

2. AAAA Records

import dns.resolver

answers = dns.resolver.query('instagram.com', 'AAAA')

for rdata in answers:

print rdata.address

3. MX Records
import dns.resolver

answers = dns.resolver.query('microsoft.com', 'MX')

for rdata in answers:

print 'host', rdata.exchange, 'has preference', rdata.preference


4. NS Records

import dns.resolver

answers = dns.resolver.query('vit.ac.in', 'NS')

for rdata in answers:

print rdata.to_text()

5. DNS REVERSE

import dns.reversename

print dns.reversename.from_address('114.141.28.53')

6. Manipulate domain names:

import dns.name

n = dns.name.from_text('www.vit.ac.in')

o = dns.name.from_text('ac.in')

print n.is_subdomain(o) # True

print n.is_superdomain(o) # False

print n > o # True


rel = n.relativize(o) # rel is the relative name 'www'

n2 = rel + o

print n2 == n # True

print n.labels # ('www', 'dnspython', 'org', '')

7. Convert IPv4 and IPv6 addresses to/from their corresponding DNS reverse map names:

import dns.reversename
n = dns.reversename.from_address("127.0.0.1")
print n
print dns.reversename.to_address(n)

8. Convert E.164 numbers to/from their corresponding ENUM names:

import dns.e164

n = dns.e164.from_e164("+1 555 1212")

print n

print dns.e164.to_e164(n)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy