Update scoutsuite_collector.py

This commit is contained in:
Shay Nehmad 2020-01-27 14:28:57 +02:00
parent 87f90b36f0
commit a26b9114ef
1 changed files with 9 additions and 2 deletions

View File

@ -1,16 +1,23 @@
import logging
from common.cloud.environment_names import Environment
from common.data.system_info_collectors_names import SCOUTSUITE_COLLECTOR
from infection_monkey.system_info.system_info_collector import SystemInfoCollector
from infection_monkey.system_info.collectors.scoutsuite.ScoutSuite.__main__ import run
from system_info.collectors.environment_collector import get_monkey_environment
logger = logging.getLogger(__name__)
class HostnameCollector(SystemInfoCollector):
class ScoutSuiteCollector(SystemInfoCollector):
def __init__(self):
super().__init__(name=SCOUTSUITE_COLLECTOR)
def collect(self) -> dict:
env = get_monkey_environment()
if env == Environment.ON_PREMISE.value:
logger.info("Monkey is not on cloud; not running ScoutSuite")
else:
logger.info(f"Attempting to execute ScoutSuite with {env.lower()}")
run(env.lower(), debug=True, quiet=False)
return {}