def handle(url,tables,domain): url_2 = urlparse(url); url = url.replace('http://','').replace('https://',''); if url_2.netloc != "": #判断是否有netloc; if re.search(".%s" % (domain) ,url_2.netloc) != None: #如果相关域名存在的话 print '\033[1;38;1m Get a 1 related domain name %s \033[0m' % (url.split('/')[0]); try: simple().h_get_isurl(tables,url.split('/')[0]); except Exception,e: print Exception,e;
def blast_url(self, url, t, lis, tables): progress = sys.stdout #lis = DB().query_all("select lis from lis"); #字典数据 total = len(lis) #获取字典总数 blast_i = [] #获取线程是否结束 fenliang = total / t #总数除以线程 得到每份数量 kaishi = 0 jiewei = fenliang self.simple = simple() print '\033[1;36;1m Is finishing the dictionary, ready to send all requests \r \033[0m' function.Loop_acquisition_IP() #爆破之前 先获取黑名单IP while True: list2 = lis[kaishi:jiewei] #获取成员份量 t = threading.Thread(target=self.simple.h_get_blast_text, args=[url, list2, tables]) #判断是否存在域名 如果有就入库 表名是url的值 t.start() blast_i.append(t) if jiewei > total: break kaishi = kaishi + fenliang jiewei = jiewei + fenliang time.sleep(0.02) print '\033[1;36;1m All requests are sent, waiting for a response. √ \r \033[0m' inhour = 5 for x in xrange(5): progress.write('\033[1;36;1m Still need to wait %i \r \033[0m' % inhour) progress.flush() inhour = inhour - 1 time.sleep(1) print '\r \n' print '\033[1;36;1m Need a little time ..... \r\n \033[0m' print '\n ' for xx in blast_i: while True: if not xx.isAlive(): break else: progress.write( "\033[1;32;1m mdomain: %s ----total: %i , ----Already request:%i \r \033[0m" % (url, total, simple.walk)) progress.flush() time.sleep(0.12) print ' \n \n The whole process is completed. ^_^' print '\n Wait for all requests to end! ' print '\033[1;36;1m oK,Sorting data √ \033[0m'
def blast_url(self, url, t, lis): progress = sys.stdout #lis = DB().query_all("select lis from lis"); #字典数据 total = len(lis) #获取字典总数 blast_i = [] #获取线程是否结束 fenliang = total / t #总数除以线程 得到每份数量 kaishi = 0 jiewei = fenliang self.simple = simple() print '\033[1;36;1m Is finishing the dictionary, ready to send all requests \r \033[0m' while True: list2 = lis[kaishi:jiewei] #获取成员份量 t = threading.Thread(target=self.simple.h_get_blast_text, args=[url, list2]) #判断是否存在域名 如果有就入库 表名是url的值 t.start() blast_i.append(t) if jiewei > total: break kaishi = kaishi + fenliang jiewei = jiewei + fenliang time.sleep(0.02) print '\033[1;36;1m All requests are sent, waiting for a response. √ \r \033[0m' inhour = 7 for x in xrange(7): progress.write('\033[1;36;1m Still need to wait %i \r \033[0m' % inhour) progress.flush() inhour = inhour - 1 time.sleep(1) print '\r \n' print '\033[1;36;1m Need a little time ..... \r\n \033[0m' print '\n ' while True: progress.write( "\033[1;32;1m mm^mdomain: %s ----total: %i , ----Already request:%i \r \033[0m" % (url, total, simple.walk)) progress.flush() if simple.walk + 80 >= total: print ' \n \n Send request: %i' % (total) print '\n Wait for all requests to end! ' break time.sleep(0.2) for tt in blast_i: tt.join() #等待所有线程结束 print '\r \n' print '\033[1;36;1m oK,Sorting data √ \033[0m'
def blast_url(self,url,t,lis,tables): progress = sys.stdout; #lis = DB().query_all("select lis from lis"); #字典数据 total = len(lis) #获取字典总数 blast_i = []; #获取线程是否结束 fenliang = total / t; #总数除以线程 得到每份数量 kaishi = 0; jiewei = fenliang; self.simple = simple(); print '\033[1;36;1m Is finishing the dictionary, ready to send all requests \r \033[0m'; function.Loop_acquisition_IP(); #爆破之前 先获取黑名单IP while True: list2 = lis[kaishi:jiewei]; #获取成员份量 t = threading.Thread(target=self.simple.h_get_blast_text,args=[url,list2,tables]); #判断是否存在域名 如果有就入库 表名是url的值 t.start(); blast_i.append(t) if jiewei > total: break; kaishi = kaishi + fenliang; jiewei = jiewei + fenliang; time.sleep(0.02); print '\033[1;36;1m All requests are sent, waiting for a response. √ \r \033[0m' inhour = 5; for x in xrange(5): progress.write('\033[1;36;1m Still need to wait %i \r \033[0m' % inhour); progress.flush(); inhour = inhour - 1; time.sleep(1); print '\r \n'; print '\033[1;36;1m Need a little time ..... \r\n \033[0m' print '\n ' for xx in blast_i: while True: if not xx.isAlive(): break; else: progress.write("\033[1;32;1m mdomain: %s ----total: %i , ----Already request:%i \r \033[0m" % (url,total,simple.walk) ); progress.flush(); time.sleep(0.12); print ' \n \n The whole process is completed. ^_^' print '\n Wait for all requests to end! ' print '\033[1;36;1m oK,Sorting data √ \033[0m';
def blast_url(self,url,t,lis): progress = sys.stdout; #lis = DB().query_all("select lis from lis"); #字典数据 total = len(lis) #获取字典总数 blast_i = []; #获取线程是否结束 fenliang = total / t; #总数除以线程 得到每份数量 kaishi = 0; jiewei = fenliang; self.simple = simple(); print '\033[1;36;1m Is finishing the dictionary, ready to send all requests \r \033[0m' while True: list2 = lis[kaishi:jiewei]; #获取成员份量 t = threading.Thread(target=self.simple.h_get_blast_text,args=[url,list2]); #判断是否存在域名 如果有就入库 表名是url的值 t.start(); blast_i.append(t) if jiewei > total: break; kaishi = kaishi + fenliang; jiewei = jiewei + fenliang; time.sleep(0.02); print '\033[1;36;1m All requests are sent, waiting for a response. √ \r \033[0m' inhour = 7; for x in xrange(7): progress.write('\033[1;36;1m Still need to wait %i \r \033[0m' % inhour); progress.flush(); inhour = inhour - 1; time.sleep(1); print '\r \n'; print '\033[1;36;1m Need a little time ..... \r\n \033[0m' print '\n ' while True: progress.write("\033[1;32;1m mdomain: %s ----total: %i , ----Already request:%i \r \033[0m" % (url,total,simple.walk) ); progress.flush(); if simple.walk+1800 >= total: print ' \n \n Send request: %i' % (total) print '\n Wait for all requests to end! ' break; time.sleep(0.2); for tt in blast_i: tt.join(); #等待所有线程结束 print '\r \n' print '\033[1;36;1m oK,Sorting data √ \033[0m';
def recursion_blast_url(self, tables, t, lis, url_list): progress = sys.stdout tables = tables.replace('.', '_') total = len(lis) #请求总数 fenliang = total / t #总数除以线程 得到每份数量 kaishi = 0 jiewei = fenliang self.simple = simple() now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") for recursion_url in url_list: print " URL:" + recursion_url[ 0] + "-->\033[1;32;1m Send out all the requests Current time: %s \r \033[0m" % ( datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) while True: list2 = lis[kaishi:jiewei] #获取成员份量 t = threading.Thread( target=self.simple.recursion_h_get_blast_text, args=[recursion_url[0], list2, tables]) #判断是否存在域名 如果有就入库 表名是url的值 t.start() blast.xiancheng.append(t) if jiewei > total: kaishi = 0 jiewei = fenliang break else: kaishi = kaishi + fenliang jiewei = jiewei + fenliang time.sleep(0.02) sql = "update %s set recursion = 1 where url = '%s'" % ( tables, recursion_url[0]) DB().increase(sql) for tt in blast.xiancheng: tt.join() #等待所有线程结束 print "\033[1;32;1m <--Above the domain name to send complete 0o(^_^)o0 Current time: %s \033[0m \r\n" % ( datetime.datetime.now().strftime("%Y-%m-%d %H:%M"))
def recursion_blast_url(self,tables,t,lis,url_list): progress = sys.stdout; tables = tables.replace('.','_'); total = len(lis); #请求总数 fenliang = total / t; #总数除以线程 得到每份数量 kaishi = 0; jiewei = fenliang; self.simple = simple(); for recursion_url in url_list: print " URL:"+recursion_url[0]+"-->\033[1;32;1m Send out all the requests \r \033[0m" while True: list2 = lis[kaishi:jiewei]; #获取成员份量 t = threading.Thread(target=self.simple.recursion_h_get_blast_text,args=[recursion_url[0],list2,tables]); #判断是否存在域名 如果有就入库 表名是url的值 t.start(); blast.xiancheng.append(t); if jiewei > total: kaishi = 0; jiewei = fenliang break; else: kaishi = kaishi + fenliang; jiewei = jiewei + fenliang; time.sleep(0.02); sql = "update %s set recursion = 1 where url = '%s'" % (tables,recursion_url[0]); DB().increase(sql); for tt in blast.xiancheng: tt.join(); #等待所有线程结束 print "\033[1;32;1m Above the domain name to send complete 0o(^_^)o0\r \033[0m <--"
sql = "select count(*) from %s where recursion != 0 and url = '%s' " % (url_tables,url); if hound_db.query(sql) == 0 : blast.blast_url(url,thread,lis,url_tables); #爆破域名 并且等待结束 sql = "update %s set recursion = 1 where url = '%s'" % (url_tables,url); hound_db.increase(sql); for black_ip in core.Blacklist_ip: sql = "delete from %s where ip = '%s' " % (url_tables,black_ip); hound_db.increase(sql); time.sleep(0.3); if Interface == 'good': #如果调用接口 '''调用接口查询''' i_lis = call_interface.jiekou1(url); #获取接口输出的域名 if len(i_lis) > 1:#如果获取到的域名超过一个的话 is_url = simple(); #new 对象 print '\033[1;32;1m Call interface to get the domain name...√ \033[0m'; time.sleep(1); print '\033[1;32;1m A total of %i domain names \033[0m' % (len(i_lis)); print '\033[1;32;1m May consume a little time -_- \033[0m' t1 = threading.Thread(); t2 = threading.Thread(); t3 = threading.Thread(); t4 = threading.Thread(); t5 = threading.Thread(); t6 = threading.Thread(); t7 = threading.Thread(); t8 = threading.Thread(); t9 = threading.Thread(); t10 = threading.Thread();
blast.blast_url(url, thread, lis, url_tables) #爆破域名 并且等待结束 sql = "update %s set recursion = 1 where url = '%s'" % (url_tables, url) hound_db.increase(sql) for black_ip in core.Blacklist_ip: sql = "delete from %s where ip = '%s' " % (url_tables, black_ip) hound_db.increase(sql) time.sleep(0.3) if Interface == 'good': #如果调用接口 '''调用接口查询''' i_lis = call_interface.jiekou1(url) #获取接口输出的域名 if len(i_lis) > 1: #如果获取到的域名超过一个的话 is_url = simple() #new 对象 print '\033[1;32;1m Call interface to get the domain name...√ \033[0m' time.sleep(1) print '\033[1;32;1m A total of %i domain names \033[0m' % ( len(i_lis)) print '\033[1;32;1m May consume a little time -_- \033[0m' t1 = threading.Thread() t2 = threading.Thread() t3 = threading.Thread() t4 = threading.Thread() t5 = threading.Thread() t6 = threading.Thread() t7 = threading.Thread() t8 = threading.Thread() t9 = threading.Thread()