def achieve_top_whois_server(self):
        """
        根据顶级域名WHOIS信息注册商列表,获得顶级WHOIS服务器
        """
        if not self.domain:
            return

        PointSplitResult = self.domain.split('.')
        domain_length = len(PointSplitResult)
        top_level_domain = '.' + PointSplitResult[-1]

        if domain_length <= 2:
            if TLDs.has_key(top_level_domain.lower()):
                self.top_whois_server = TLDs[top_level_domain.lower()]
                self.query_domain = self.domain
            else:
                print "没有该顶级域名WHOIS注册商,请联系管理员"
                return

        second_level_domain = '.' + PointSplitResult[-2]
        host = second_level_domain + top_level_domain

        if TLDs.has_key(host.lower().strip()):
            self.top_whois_server = TLDs[host.lower()]
            self.query_domain = PointSplitResult[-3] + host.lower()

        elif TLDs.has_key(top_level_domain.lower()):
            self.top_whois_server = TLDs[top_level_domain.lower()]
            self.query_domain = PointSplitResult[-2] + top_level_domain.lower()

        else:
            print '没有该顶级域名WHOIS注册商,请联系管理员'
            # sys.exit()
            return
示例#2
0
    def achieve_top_whois_server(self):
        
        PointSplitResult = self.domain.split('.')
        

        top_level_domain = '.' + PointSplitResult[-1]

        try:
            second_level_domain = '.' + PointSplitResult[-2]
        except:
            second_level_domain = ''

        host = second_level_domain + top_level_domain 
      
        if TLDs.has_key(host.lower().strip()):
            
            self.top_whois_server = TLDs[host.lower()]
            self.query_domain = PointSplitResult[-3] + host.lower()

        elif TLDs.has_key(top_level_domain.lower()):
            
            self.top_whois_server = TLDs[top_level_domain.lower()]
            self.query_domain = PointSplitResult[-2] + top_level_domain.lower()

        else:
            print 'There is not this whois_server'
            sys.exit()
    def achieve_top_whois_server(self):
        """
        根据顶级域名WHOIS信息注册商列表,获得顶级WHOIS服务器
        Args:
            url: 待查询的网址url
        Return: 
            domain, 网址域名
            top_whois_server, 域名的WHOIS顶级注册商
        Exception:
            1、tld中没有网址的顶级域名,返回空
            2、TLDs中没有域名的WHOIS注册商,返回空
        """

        url = self.url
        scheme = re.compile("https?\:\/\/", re.IGNORECASE) # 添加http头部
        if scheme.match(url) is None:
            url = "http://" + url
        try:
            res = get_tld(url, as_object=True)
            self.domain = res.tld
            domain_suffix = '.' + res.suffix
            top_whois_server = TLDs.get(domain_suffix, '')
            if top_whois_server:
                self.top_whois_server = top_whois_server
            else:
                print 'TLDs字典中没有该顶级域名WHOIS注册商,请联系管理员'
                return
        except:
            print 'tld没有该域名注册商,请联系管理员'
            return 
示例#4
0
    def achieve_top_whois_server(self):
        """
        根据顶级域名WHOIS信息注册商列表,获得顶级WHOIS服务器
        Args:
            url: 待查询的网址url
        Return: 
            domain, 网址域名
            top_whois_server, 域名的WHOIS顶级注册商
        Exception:
            1、tld中没有网址的顶级域名,返回空
            2、TLDs中没有域名的WHOIS注册商,返回空
        """

        url = self.url
        scheme = re.compile("https?\:\/\/", re.IGNORECASE)  # 添加http头部
        if scheme.match(url) is None:
            url = "http://" + url
        try:
            res = get_tld(url, as_object=True)
            self.domain = res.tld
            domain_suffix = '.' + res.suffix
            top_whois_server = TLDs.get(domain_suffix, '')
            if top_whois_server:
                self.top_whois_server = top_whois_server
            else:
                print 'TLDs字典中没有该顶级域名WHOIS注册商,请联系管理员'
                return
        except:
            print 'tld没有该域名注册商,请联系管理员'
            return