diff --git a/README.md b/README.md index 1492c6c..c70bc5c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Automated Reconnaissance Pipeline -![version](https://img.shields.io/badge/version-0.7.2-informational?style=for-the-badge) +![version](https://img.shields.io/badge/version-0.7.3-informational?style=for-the-badge) ![python](https://img.shields.io/badge/python-3.7-informational?style=for-the-badge) ![luigi](https://img.shields.io/badge/luigi-2.8.11-yellowgreen?style=for-the-badge) ![cmd2](https://img.shields.io/badge/cmd2-0.9.23-yellowgreen?style=for-the-badge) diff --git a/recon-pipeline.py b/recon-pipeline.py index 4c68237..35c740d 100755 --- a/recon-pipeline.py +++ b/recon-pipeline.py @@ -9,7 +9,7 @@ import threading import subprocess from pathlib import Path -__version__ = "0.7.2" +__version__ = "0.7.3" # fix up the PYTHONPATH so we can simply execute the shell from wherever in the filesystem os.environ["PYTHONPATH"] = f"{os.environ.get('PYTHONPATH')}:{str(Path(__file__).parent.resolve())}" diff --git a/recon/nmap.py b/recon/nmap.py index 45a097c..7de71c7 100644 --- a/recon/nmap.py +++ b/recon/nmap.py @@ -110,7 +110,7 @@ class ThreadedNmapScan(luigi.Task): tmp_cmd[2] = "-sT" if protocol == "tcp" else "-sU" # arg to -oA, will drop into subdir off curdir - tmp_cmd[9] = ",".join(ports) + tmp_cmd[10] = ",".join(ports) tmp_cmd.append(f"{self.output().path}/nmap.{target}-{protocol}") tmp_cmd.append(target) # target as final arg to nmap @@ -121,6 +121,7 @@ class ThreadedNmapScan(luigi.Task): Path(self.output().path).mkdir(parents=True, exist_ok=True) with concurrent.futures.ThreadPoolExecutor(max_workers=self.threads) as executor: + executor.map(subprocess.run, commands) diff --git a/recon/targets.py b/recon/targets.py index 19b8a65..f885462 100644 --- a/recon/targets.py +++ b/recon/targets.py @@ -32,9 +32,11 @@ class TargetList(luigi.ExternalTask): Returns: luigi.local_target.LocalTarget """ - print(f"debug-epi: targets {self.results_dir}") + self.results_dir = Path(self.results_dir) + self.target_file = Path(self.target_file) + try: - with open(str(self.target_file)) as f: + with open(self.target_file) as f: first_line = f.readline() ipaddress.ip_interface(first_line.strip()) # is it a valid ip/network? except OSError as e: @@ -43,15 +45,16 @@ class TargetList(luigi.ExternalTask): except ValueError as e: # exception thrown by ip_interface; domain name assumed logging.debug(e) - with_suffix = f"{self.target_file}.domains" + with_suffix = self.target_file.with_suffix(".domains") else: # no exception thrown; ip address found - with_suffix = f"{self.target_file}.ips" + with_suffix = self.target_file.with_suffix(".ips") - Path(str(self.results_dir)).mkdir(parents=True, exist_ok=True) + self.results_dir.mkdir(parents=True, exist_ok=True) - with_suffix = f"{self.results_dir}/{with_suffix}" + with_suffix = (Path(self.results_dir) / with_suffix).resolve() # copy file with new extension - shutil.copy(str(self.target_file), with_suffix) + shutil.copy(self.target_file, with_suffix) + return luigi.LocalTarget(with_suffix)