def _show_options(self, *args, **kwargs): target_opts = ['target', 'port'] module_opts = [opt for opt in self.current_module.options if opt not in target_opts] headers = ("Name", "Current settings", "Description") utils.print_info('\nTarget options:') utils.print_table(headers, *self.get_opts(*target_opts)) if module_opts: utils.print_info('\nModule options:') utils.print_table(headers, *self.get_opts(*module_opts)) utils.print_info()
def run(self): self.result = [] conf.verb = self.verbose nm = port_scan(protocol='TCP', target=self.target, port=self.port) for host in nm.all_hosts(): if nm[host]['tcp'][self.port]['state'] == "open": print_success("Host: %s, port:%s is open" % (host, self.port)) self.get_target_info(host=host, port=self.port) unique_device = [list(x) for x in set(tuple(x) for x in self.result)] unique_device = sorted(unique_device, key=lambda x: (x[5], x[6])) if len(self.result) > 0: print_success("Find %s targets" % len(self.result)) print_table(TABLE_HEADER, *unique_device, **{'max_column_length': 20}) print('\r') else: print_error("Didn't find any target on network %s" % self.target)