def search_ip(self,geoloc,scriptsJS): main_thread = threading.currentThread() print "########### Search by IP ###########" ips=[] domaines=self.db.new_domaines.find() thread_pool=[] for domaine in domaines: try: ips.append(domaine['ip']) except KeyError: print domaine i=0 print 'les IPS sont: '+ str(ips) for ip in set(ips): if ip != '0.0.0.0': i+=1 gs=search.search(20,'ip:'+str(ip),scriptsJS[1],self.db_value) gs.start() thread_pool.append(gs) if i % 10 ==0: for t in threading.enumerate(): if t is not main_thread: t.join() for t in thread_pool: t.record() print "########### Search terminated ###########" print "########### Search by network ###########" print "########### Resolve IP ############" networks.resolve(geoloc,self.db_value)
def search_ip(self,geoloc,scriptsJS,ip_range): main_thread = threading.currentThread() print "########### Search by IP ###########" ips=[] domaines=self.db.new_domaines.find() thread_pool=[] cache={} for domaine in domaines: try: ips.append(domaine['ip']) except KeyError: print domaine i=0 print 'les IPS sont: '+ str(ips) ip_to_add=[] if ip_range: ip_to_add=[str(x) for x in IP(ip_range)] ips[len(ips):]=ip_to_add for ip in set(ips): if ip != '0.0.0.0': i+=1 gs=search.search(20,'ip:'+str(ip),scriptsJS[1],self.db_value) gs.start() thread_pool.append(gs) if i % 10 ==0: for t in thread_pool: t.join() for t in thread_pool: t.record() print "########### Search terminated ###########" print "########### Search by network ###########" print "########### Resolve IP ############" networks.resolve(geoloc,self.db_value)
def metasearch(self,criteria,scriptsJS,geoloc): print "########### Meta Search ###########" main_thread = threading.currentThread() thread_pool=[] for criterius in criteria: for script in scriptsJS: gs=search.search(100,criterius,script,self.db_value) gs.start() thread_pool.append(gs) for t in thread_pool: t.join() for t in thread_pool: t.record() print "########### Search terminated ###########" print "########### Resolve IP ############" networks.resolve(geoloc,self.db_value)
def metasearch(self, criteria, scriptsJS, geoloc): print "########### Meta Search ###########" main_thread = threading.currentThread() thread_pool = [] for criterius in criteria: for script in scriptsJS: gs = search.search(100, criterius, script, self.db_value) gs.start() thread_pool.append(gs) for t in thread_pool: t.join() for t in thread_pool: t.record() print "########### Search terminated ###########" print "########### Resolve IP ############" networks.resolve(geoloc, self.db_value)
def search_ip(self, geoloc, scriptsJS, ip_range): main_thread = threading.currentThread() print "########### Search by IP ###########" ips = [] domaines = self.db.new_domaines.find() thread_pool = [] cache = {} for domaine in domaines: try: ips.append(domaine['ip']) except KeyError: print domaine i = 0 print 'les IPS sont: ' + str(ips) ip_to_add = [] if ip_range: ip_to_add = [str(x) for x in IP(ip_range)] ips[len(ips):] = ip_to_add for ip in set(ips): if ip != '0.0.0.0': i += 1 gs = search.search(20, 'ip:' + str(ip), scriptsJS[1], self.db_value) gs.start() thread_pool.append(gs) if i % 10 == 0: for t in thread_pool: t.join() for t in thread_pool: t.record() print "########### Search terminated ###########" print "########### Search by network ###########" print "########### Resolve IP ############" networks.resolve(geoloc, self.db_value)