[Cialug] saving a step in rdns lookups

Jeffrey Ollie jeff at ocjtech.us
Wed Oct 8 14:14:32 CDT 2008


On Wed, Oct 8, 2008 at 10:38 AM, Matthew Nuzum <newz at bearfruit.org> wrote:
> Here is a task I do frequently:
>
> $ host <some hostname>
> <some hostname> has address 11.22.33.44
> /me copies and pastes the ip address
> $ host <pastes ip address>
> w.x.y.z.in-addr.arpa domain name pointer <some hostname>
>
> So I'm wondering, is there a way in one command to put in a hostname
> and get out the reverse dns hostname for the machine? The reason is I
> deal with numerous virtual hosts and I have a hard time remembering
> which hosts are on which servers (and it doesn't help that they have a
> tendency to move around without notice).

I've attached a short little Python script that should fit the bill.
Aside from Python itself you'll need the dnspython library[1].  It's
available on Fedora/RedHat systems as python-dns.  Ubuntu/Debian
probably has it as well but I don't know what the package would be
called.

$ python rdns-check.py www.google.com
www.google.com.
    -> 72.14.205.147
        -> qb-in-f147.google.com.

    -> 72.14.205.99
        -> qb-in-f99.google.com.

    -> 72.14.205.103
        -> qb-in-f103.google.com.

    -> 72.14.205.104
        -> qb-in-f104.google.com.

-- 
Jeff Ollie

"You know, I used to think it was awful that life was so unfair. Then
I thought, wouldn't it be much worse if life were fair, and all the
terrible things that happen to us come because we actually deserve
them? So, now I take great comfort in the general hostility and
unfairness of the universe."

	-- Marcus to Franklin in Babylon 5: "A Late Delivery from Avalon"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rdns-check.py
Type: text/x-python
Size: 511 bytes
Desc: not available
Url : http://cialug.org/pipermail/cialug/attachments/20081008/ef982c95/rdns-check-0001.py


More information about the Cialug mailing list