当前位置:编程学习 > 网站相关 >>

查询IP绑定的国际域名

本文作者:totododo

--------------------------------------------------------------------------------
 

#!/usr/bin/env python
# Detect Domain Parked on IP
# Written by ToToDoDo (QQ:8924007) Email: plone2#yahoo.com.cn
import sys,urllib,re,string

try:
    ip = sys.argv[1]
except:
    print U must supply a IP U want to check
    sys.exit(1)

try:
    urlfile = urllib.urlopen(http://whois.webhosting.info/+ip)
except IOError,msg:
    print "Error:",url,":",msg
    sys.exit(1)

htmlcodes = urlfile.read()
m = re.search(The IP Address entered by you is InValid,htmlcodes)
if  m != None:
    print The IP Address entered by you is InValid!!!

n = re.search(IP Details - N/A.,htmlcodes)
if  m != None:
    print ip,- IP Details - N/A.

if re.search(Domains ...,htmlcodes) or re.search(Total Domains,htmlcodes):
    print "Check Successful!"
    splitcodes = string.join([string.strip(ip),</b> - IP hosts <b>],)
    result1 = re.split(splitcodes,htmlcodes)
    result2 = re.split(</b> Total,result1[1])
    print "Found ",result2[0],"domains on this IP "
    result3 = re.split(<td><a href="http://whois.webhosting.info/,result2[1])
    for x in result3[1:]:
        y = re.split(.">,x)
        print y[0]
else:
    print "Sorry, Error to complete check!"
 
 

补充:综合编程 , 安全编程 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,