Generate reverse DNS entries

A friend of mine recently asked to provide a simple way to generate reverse DNS from a list of IP (v4 and v6), host, and a given domain.

School courses and projects were very boring, so I decided to deal with this request.

The script is written in Python.

The usage is as follow :

usage: [-h] [-v] [-r] [-f] [-d DOMAIN]

Generate Reverse RR & Forward RR from ipv4/ipv6 & host list

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         Show the version
  -r, --reverserr       Only output the Reverse RR
  -f, --forwardrr       Only output the Forward RR
  -d DOMAIN, --domain DOMAIN        Change the domain (Default :

For example, to generate only Reverse RR for the domain :

python -r -d

Will ask you to enter the list of IPs and hosts associated :

Please C/C your IP / host list below:  ns0

The generated output :


You can also use the stdin to fill the buffer with a file containing your list :

cat my_list | python -f -r


Feel free to adapt them and submit your patches :)

Thanks to Jvoisin, Arcaik & Rboissat for the help :)