Take the 2-minute tour ×

For example, given the range: -

I need to find some domain that resolves to an IP-adress within the range. Is it possible ? I'm using a Linux system.

share|improve this question

4 Answers 4

up vote 3 down vote accepted

You can do reverse lookups on each IP in the range and search through the results for the domain you're looking for. However, this will only work if the person/s responsible for that domain created a PTR record for the IP.

This is a quick and dirty working example:

#!/usr/bin/env python
ipAddrRange function ripped from:

import sys
import socket

def ipAddrRange(startAddr, endAddr):
    def incrAddr(addrList):
        addrList[3] += 1
        for i in (3,2,1):
            if addrList[i] == 256:
                addrList[i] = 0
                addrList[i-1] += 1
    def asString(addrList):
        return ".".join(map(str,addrList))
    startAddrList = map(int,startAddr.split("."))
    endAddrList = map(int,endAddr.split("."))
    curAddrList = startAddrList[:]
    yield asString(curAddrList)
    for i in range(4):
        while curAddrList[i] < endAddrList[i]:
            yield asString(curAddrList)

if len(sys.argv) > 1 and sys.argv[1]:
    domain_filter = sys.argv[1]
    domain_filter = ""

for addr in ipAddrRange("",""):
    ptr = socket.gethostbyaddr(addr)[0]
    if domain_filter:
        if domain_filter in ptr:
            print ptr
        print ptr

Example run:

# ./reverse_spy.py aol

You can limit output to results matching the optional argument.

Also, limit your range as your example range is 4194304 IPs long. ;) Have people looking for ya with ranges like that.

share|improve this answer
Thanks. This solution is exactly what I need. –  eugene y Feb 12 '10 at 23:26

Are you trying to find any DNS name that resolves to a specific IP; or are you trying to find all DNS names that resolve to an IP. The latter is impossible. The former is easily accomplished on almost any OS with:

set type=ptr

The (reversed-ip) part is what it sounds like. If your IP is, then reversed would be, and the third line would be:
share|improve this answer
That will only work if reverse DNS has been set up and is one of the reasons some people don't set it up. –  John Gardeniers Feb 13 '10 at 2:58

According to ARIN, is owned by AOL. You could try querying AOL's listed DNS servers to see if they have reverse entries for the IP you're interested in. (Go to arin.net and search their whois for that network address.)

share|improve this answer

nmap -sL -R 172.128-191.0-255.0-255

-sL lists the hosts without scanning. -R forces DNS resolution.

share|improve this answer

Your Answer


