Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error handling for when zap is not installed #223

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scanners/zap/zap_none.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import os
import platform
import pprint
import shutil
import subprocess
import sys
from shutil import disk_usage

from .zap import MODULE_DIR
Expand Down Expand Up @@ -277,7 +279,12 @@ def _check_plugin_status(self):
"""
logging.info("Zap: verifying the viability of ZAP")

command = [self.my_conf("container.parameters.executable")]
cmd = self.my_conf("container.parameters.executable")
if shutil.which(cmd) is None:
logging.error(f"{cmd} not found in PATH, is ZAP installed?")
sys.exit(1)

command = [cmd]
command.extend(self._get_standard_options())
command.extend(["-dir", self.container_home_dir])
command.append("-cmd")
Expand Down
Loading