Esempio n. 1
0
 def target_ip(self):
     print(f"[*] Loaded single target: {self.target_hosts}")
     target_hosts = self.target_hosts.strip()
     FileHelper.create_dir_structure(target_hosts, self.output_directory)
     FileHelper.check_directory(output_directory=self.nmap_directory)
     jobs = []
     p = multiprocessing.Process(target=self.nmap_scan)
     jobs.append(p)
     p.start()
Esempio n. 2
0
    def __init__(self, target_hosts, output_directory, dns_server, quiet,
                 quick, no_udp_service_scan):

        self.target_hosts = target_hosts
        self.output_directory = output_directory
        self.dns_server = dns_server
        self.quiet = quiet
        self.quick = quick
        self.no_udp_service_scan = no_udp_service_scan
        self.nmap_directory = f"{self.output_directory}/{self.target_hosts}/scans"
        FileHelper.create_dir_structure(target_hosts, self.output_directory)
Esempio n. 3
0
    def test_create_dir_structure(self):
        FileHelper.create_dir_structure(ip_address=self.HOST,
                                        output_directory=self.OUTPUT_DIR)
        res_dir = f'{self.OUTPUT_DIR}/{self.HOST}'
        self.assertTrue(os.path.exists(res_dir))
        self.assertTrue(os.path.isdir(res_dir))
        self.assertTrue(os.path.exists(f'{res_dir}/proof.txt'))
        self.assertTrue(os.path.isfile(f'{res_dir}/proof.txt'))
        self.assertTrue(os.path.exists(f'{res_dir}/exploit'))
        self.assertTrue(os.path.isdir(f'{res_dir}/exploit'))
        self.assertTrue(os.path.exists(f'{res_dir}/loot'))
        self.assertTrue(os.path.isdir(f'{res_dir}/loot'))
        self.assertTrue(os.path.exists(f'{res_dir}/scans'))
        self.assertTrue(os.path.isdir(f'{res_dir}/scans'))

        # remove the added directories
        os.remove(f'{res_dir}/proof.txt')
        os.rmdir(f'{res_dir}/exploit/')
        os.rmdir(f'{res_dir}/loot/')
        os.rmdir(f'{res_dir}/scans/')
        os.rmdir(f'{res_dir}/')
Esempio n. 4
0
    def target_file(self):
        targets = FileHelper.load_targets(self.target_hosts,
                                          self.output_directory, self.quiet)
        FileHelper.check_file(targets)

        try:
            target_file = open(targets, 'r')
            print(f"[*] Loaded targets from: {targets}")
        except FileExistsError as err:
            print(f"[!] Unable to load: {targets}")
            raise err

        for ip_address in target_file:
            ip_address = ip_address.strip()
            FileHelper.create_dir_structure(ip_address, self.output_directory)
            nmap_directory = f"{self.output_directory}/{ip_address}/scans"
            FileHelper.check_directory(output_directory=nmap_directory)
            jobs = []
            p = multiprocessing.Process(target=self.nmap_scan)
            jobs.append(p)
            p.start()
        target_file.close()