diff --git a/scanners/generic/generic.py b/scanners/generic/generic.py index 6347e5fe..ef7c5274 100644 --- a/scanners/generic/generic.py +++ b/scanners/generic/generic.py @@ -65,7 +65,7 @@ def postprocess(self): logging.info(f"Extracting report, storing in {self.results_dir}") result = self.my_conf("results") try: - os.makedirs(self.results_dir) + os.makedirs(self.results_dir, exist_ok=True) if os.path.isdir(result): shutil.copytree(result, self.results_dir, dirs_exist_ok=True) else: diff --git a/scanners/zap/zap.py b/scanners/zap/zap.py index 41eb0a69..2e93b6e4 100644 --- a/scanners/zap/zap.py +++ b/scanners/zap/zap.py @@ -90,7 +90,7 @@ def postprocess(self): logging.debug(f"reports_dir: {reports_dir}") logging.info(f"Extracting report, storing in {self.results_dir}") - shutil.copytree(reports_dir, self.results_dir) + shutil.copytree(reports_dir, self.results_dir, dirs_exist_ok=True) logging.info("Saving the session as evidence") with tarfile.open(f"{self.results_dir}/session.tar.gz", "w:gz") as tar: