diff --git a/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py b/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py
index 07491fbfc..88187c410 100644
--- a/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py
+++ b/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py
@@ -7,6 +7,9 @@ from common.utils.code_utils import abstractstatic
from monkey_island.cc.database import mongo
from monkey_island.cc.models.attack.attack_mitigations import AttackMitigations
from monkey_island.cc.services.attack.attack_config import AttackConfig
+from monkey_island.cc.services.config_schema.config_schema_per_attack_technique import (
+ CONFIG_SCHEMA_PER_ATTACK_TECHNIQUE,
+)
logger = logging.getLogger(__name__)
@@ -115,16 +118,43 @@ class AttackTechnique(object, metaclass=abc.ABCMeta):
if status == ScanStatus.DISABLED.value:
return disabled_msg
if status == ScanStatus.UNSCANNED.value:
- unscanned_msg = AttackTechnique._get_unscanned_msg_with_reasons(cls.unscanned_msg)
+ unscanned_msg = cls._get_unscanned_msg_with_reasons(cls.unscanned_msg)
return unscanned_msg
elif status == ScanStatus.SCANNED.value:
return cls.scanned_msg
else:
return cls.used_msg
- @staticmethod
- def _get_unscanned_msg_with_reasons(unscanned_msg):
- ...
+ @classmethod
+ def _get_unscanned_msg_with_reasons(cls, unscanned_msg):
+ reasons = []
+ if len(cls.relevant_systems) == 1:
+ reasons.append(f"- The Monkey did not run on any {cls.relevant_systems[0]} systems.")
+ if cls.tech_id in CONFIG_SCHEMA_PER_ATTACK_TECHNIQUE:
+ reasons.append(
+ "- The following configuration options were disabled:
"
+ f"{cls._get_relevant_config_values()}"
+ )
+
+ if reasons:
+ unscanned_msg = (
+ unscanned_msg.strip(".")
+ + " due to one of the following reasons:\n"
+ + "\n".join(reasons)
+ )
+
+ return unscanned_msg
+
+ @classmethod
+ def _get_relevant_config_values(cls):
+ config_options = ""
+ for config_type in CONFIG_SCHEMA_PER_ATTACK_TECHNIQUE[cls.tech_id]:
+ config_options += (
+ f"- {config_type} — "
+ f"{', '.join(CONFIG_SCHEMA_PER_ATTACK_TECHNIQUE[cls.tech_id][config_type])}
"
+ )
+
+ return config_options
@classmethod
def technique_title(cls):
diff --git a/monkey/monkey_island/cc/services/config_schema/config_schema_per_attack_technique.py b/monkey/monkey_island/cc/services/config_schema/config_schema_per_attack_technique.py
index b97a1bf3e..bcaa5a2af 100644
--- a/monkey/monkey_island/cc/services/config_schema/config_schema_per_attack_technique.py
+++ b/monkey/monkey_island/cc/services/config_schema/config_schema_per_attack_technique.py
@@ -42,3 +42,6 @@ def _add_config_field_to_reverse_schema(
technique[definition_type] = [config_field]
else:
reverse_schema[attack_technique] = {definition_type: [config_field]}
+
+
+CONFIG_SCHEMA_PER_ATTACK_TECHNIQUE = get_config_schema_per_attack_technique()