def get_domain_type(domain): ''' type: 1 --- iqiyi.com (subdomain) #对整个根域名下的域名扫描 2 --- 210.187.192.1 (ip) #对C段扫描 3 --- www.iqiyi.com (rootdomain) #对单个域名扫描 ''' if is_vaild_ip(domain): return SCANNER_TYPE[0] elif is_vaild_url(domain): format_domain = Domain.url_format(domain) root_domain = Domain.get_root_domain(format_domain) if root_domain == '': #这里可以判断为内网域名(这里就不能用接口查询子域名了) if format_domain != domain: return SCANNER_TYPE[2] else: return SCANNER_TYPE[3] if root_domain != domain: return SCANNER_TYPE[2] else: return SCANNER_TYPE[1]
def get_domain_crange(domain): ''' 获取对应域名下的C段IP :param domain: :return: ''' bAliveResult = Domain.is_domain_alive(domain) if bAliveResult[0]: return getCrangeIP(bAliveResult[1]) else: return None