This commit is contained in:
Shay Nehmad 2020-02-04 14:39:38 +02:00
parent b8b015e84e
commit b5f8fbe9f0
2 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import logging
import tempfile
from common.cloud.environment_names import Environment
from common.data.system_info_collectors_names import SCOUTSUITE_COLLECTOR
@ -15,12 +16,20 @@ class ScoutSuiteCollector(SystemInfoCollector):
def collect(self) -> dict:
env = get_monkey_environment()
env = "AWS"
if env == Environment.ON_PREMISE.value:
logger.info("Monkey is not on cloud; not running ScoutSuite")
return {}
else:
logger.info(f"Attempting to execute ScoutSuite with {env.lower()}")
scout_suite_results = run(env.lower(), debug=True, quiet=False)
tmp_dir_path = tempfile.mkdtemp()
logger.info(f"Attempting to execute ScoutSuite with {env.lower()}, saving results in {tmp_dir_path}")
scout_suite_results = run(
env.lower(),
debug=True,
quiet=False,
no_browser=True,
report_dir=tmp_dir_path)
return {
"Environment": env,
"Results": scout_suite_results

View File

@ -6,4 +6,4 @@ logger = logging.getLogger(__name__)
def process_scout_suite_telemetry(collector_results, monkey_guid):
# Monkey.get_single_monkey_by_guid(monkey_guid).set_hostname(collector_results["hostname"])
logger.info(f"\n\n{json.dumps(collector_results, indent=2)}\n{monkey_guid}")
logger.info(f"ScoutSuite results:\n{json.dumps(collector_results, indent=2)}")