url text not null comment 'url', ip varchar(40) not null comment 'ip', recursion int not null comment 'digui', Crawler int not null comment 'pachong', cms text null comment 'shibiecms', dns int not null comment 'yuchuansong' )charset utf8 engine = innodb; """ % (url_tables) ); try: u_resolver=dns.resolver.Resolver() ip = u_resolver.query(url,'A') if ip[0] : url_ip = ip[0]; except Exception,e: url_ip = "0.0.0.0"; hound_db.Domain_storage(url_tables,url,url_ip); #入库 sql = "select count(*) from %s where dns != 0 and url = '%s' " % (url_tables,url); if hound_db.query(sql) == 0 : print ' Current domain: '+url+"-->Detecting vulnerabilities!"; ydns = function.ydns(url); #检测域传输 if ydns: sql2 = "update %s set recursion = 1 , dns = 1 where url = '%s'" % (url_tables,url); hound_db.increase(sql2); time.sleep(0.3) for yuming in ydns: y_ip = function.ip(yuming); hound_db.Domain_storage(url_tables,yuming,y_ip) else:
this.is_url(h_url, url) time.sleep(4) def is_url(self, url, tables): try: ip = socket.gethostbyname(url) simple.walk = simple.walk + 1 except Exception, e: #请求超时 说明没有 simple.walk = simple.walk + 1 ip = False if ip: #如果域名存在的话 url2 = url.replace('http://', '') tables = tables.replace('.', '_') db_plus.Domain_storage(tables, url2, ip) #入裤 ########################################################################### ##########################递归 循环判断域名是否存在 如果存在就入库##################### def recursion_h_get_blast_text(self, url, lis, tables): #循环判断域名是否存在 如果存在就入库 this = simple() for x in range(len(lis)): h_url = lis[x][0] + "." + url this.recursion_is_url(h_url, tables)
def h_get_isurl(self,tables,url): #接口获取到的域名 然后判断域名是否存在 如果存在就如裤 try: while not q.empty(): time.sleep(0.1); url = url.replace('http://','').replace('https://',''); i_resolver=dns.resolver.Resolver() i_resolver.nameservers=core.default_dns; ip = i_resolver.query(url,'A') if ip[0] : ip = ip[0]; except Exception,e: #请求超时 说明没有 ip = False; if ip and not core.Blacklist_ip.count(ip) : #如果域名存在的话 w.put(url) db_plus.Domain_storage(tables,url,ip); #入裤 print '\033[1;33;1m Successful storage ^_^. \033[0m'; w.get() ##########################循环判断域名是否存在 如果存在就入库##################### # url,字典 def h_get_blast_text(self,url,lis,tables): #循环判断域名是否存在 如果存在就入库 this = simple(); for x in range(len(lis)): simple.walk = simple.walk +1;
return '' def h_get_isurl(self, tables, url): #接口获取到的域名 然后判断域名是否存在 如果存在就如裤 try: url = url.replace('http://', '').replace('https://', '') i_resolver = dns.resolver.Resolver() i_resolver.nameservers = core.default_dns ip = i_resolver.query(url, 'A') if ip[0]: ip = ip[0] except Exception, e: #请求超时 说明没有 print e, Exception ip = False if ip and not core.Blacklist_ip.count(ip): #如果域名存在的话 db_plus.Domain_storage(tables.replace('.', '_'), url, ip) #入裤 print '\033[1;33;1m Successful storage ^_^. \033[0m' ##########################循环判断域名是否存在 如果存在就入库##################### # url,字典 def h_get_blast_text(self, url, lis): #循环判断域名是否存在 如果存在就入库 this = simple() for x in range(len(lis)): simple.walk = simple.walk + 1 h_url = lis[x][0] + "." + url this.is_url(h_url, url) time.sleep(0.5)