March 2019
Beginner
490 pages
12h 40m
English
With this script, we can convert an IP address into a name object, whose value will be the reverse map domain name of the address. Using the following command, we can find out which domain name corresponds to each of the specified addresses, that is, whether they are IPv4 or IPv6.
If you want to make a reverse lookup, you need to use the dns.reversename submodule.
You can find the following code in the dns_reverse.py file:
!/usr/bin/env python3import argparseimport dns.reversenameimport dns.resolverdef main(address): name = dns.reversename.from_address(address) print(name) print(dns.reversename.to_address(name)) try: # Pointer records (PTR) maps a network interface (IP) to ...
Read now
Unlock full access