1def retDomains(ip):
2 # find parked domains by ip from Hurricane Electric, can use other source
3 # may be duplicate with get_parked(data)
4 domains = []
5 try:
6 url = "http://bgp.he.net/ip/" + ip + "#_dns"
7 userAgent = [('User-agent','Mozilla/5.0 (X11; U; '+\
8 'Linux 2.4.2-2 i586; en-US; m18) Gecko/20010131 Netscape6/6.01')]
9 browser = mechanize.Browser()
10 browser.addheaders = userAgent
11 page = browser.open(url)
12 html = page.read()
13 link_finder = re.compile('href="(.*?)"')
14 links = link_finder.findall(html)
15 for i in range (0, len(links)):
16 if links[i].find('/dns/') == 0:
17 domains.append(links[i][5:])
18 return domains
19 except:
20 return domains