Island: Handle AWS info telemetry

This commit is contained in:
Ilija Lazoroski 2022-02-11 17:42:57 +01:00
parent 1f76a42279
commit 412a06fa9b
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,17 @@
import logging
from monkey_island.cc.models.monkey import Monkey
logger = logging.getLogger(__name__)
def process_aws_telemetry(telemetry_json):
relevant_monkey = Monkey.get_single_monkey_by_guid(telemetry_json["monkey_guid"])
if "instance_id" in telemetry_json["data"]:
instance_id = telemetry_json["data"]["instance_id"]
relevant_monkey.aws_instance_id = instance_id
relevant_monkey.save()
logger.debug(
"Updated Monkey {} with aws instance id {}".format(str(relevant_monkey), instance_id)
)

View File

@ -1,6 +1,7 @@
import logging
from common.common_consts.telem_categories import TelemCategoryEnum
from monkey_island.cc.services.telemetry.processing.aws_info import process_aws_telemetry
from monkey_island.cc.services.telemetry.processing.exploit import process_exploit_telemetry
from monkey_island.cc.services.telemetry.processing.post_breach import process_post_breach_telemetry
from monkey_island.cc.services.telemetry.processing.scan import process_scan_telemetry
@ -17,6 +18,7 @@ TELEMETRY_CATEGORY_TO_PROCESSING_FUNC = {
TelemCategoryEnum.SCAN: process_scan_telemetry,
TelemCategoryEnum.SYSTEM_INFO: process_system_info_telemetry,
TelemCategoryEnum.POST_BREACH: process_post_breach_telemetry,
TelemCategoryEnum.AWS_INFO: process_aws_telemetry,
# `lambda *args, **kwargs: None` is a no-op.
TelemCategoryEnum.TRACE: lambda *args, **kwargs: None,
TelemCategoryEnum.ATTACK: lambda *args, **kwargs: None,