Skip to content

Commit

Permalink
Add error handling for when zap is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
sfowl committed Oct 9, 2024
1 parent 2107270 commit e4cfc27
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit e4cfc27

Please sign in to comment.