def next_ip_pool(): try: global iter ip = iptools.next(iter) return str(ip) except StopIteration: return "end"
def send(self): # send to scanner all ip on cidr if self.ip is not None: # todo add print configuration of scan ips = self.ip.__iter__() while True: try: ip = iptools.next(ips) if ip in ip_private: if not self.skip_private: self.scanner(ip) else: if self.verbose: console.ip_skipped(ip) else: self.scanner(ip) except StopIteration: print("All send to scanner !") break # send to scanner all ip get by shodan elif self.shodan is not None: for ip in scan.get_from_shodan(self.shodan): self.scanner(ip) # open given file given with ip list and send it to scanner elif self.ipfile is not None: try: with open(self.ipfile) as f: for line in f.readlines(): self.scanner(line.replace("\n", "")) except FileNotFoundError: console.error("File " + self.ipfile + " not found :/")
def next_ip(self): try: self.current_ip = iptools.next(self.ip_range_list) return str(self.current_ip) except StopIteration: return 0