Island: Pass agent configuration to telemetry processing function in Telemetry resource

This commit is contained in:
Shreya Malviya 2022-07-14 14:16:19 +05:30
parent 093e6fa3a6
commit c70627c74b
2 changed files with 4 additions and 2 deletions

View File

@ -63,7 +63,8 @@ class Telemetry(AbstractResource):
monkey = NodeService.get_monkey_by_guid(telemetry_json["monkey_guid"])
NodeService.update_monkey_modify_time(monkey["_id"])
process_telemetry(telemetry_json)
agent_configuration = self._agent_configuration_repository.get_configuration()
process_telemetry(telemetry_json, agent_configuration)
# API Spec: RESTful way is to return an identifier of the updated/newly created resource
return {}, 201

View File

@ -1,6 +1,7 @@
import logging
from common.common_consts.telem_categories import TelemCategoryEnum
from common.configuration import AgentConfiguration
from monkey_island.cc.models.telemetries import save_telemetry
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
@ -29,7 +30,7 @@ TELEMETRY_CATEGORY_TO_PROCESSING_FUNC = {
UNSAVED_TELEMETRIES = [TelemCategoryEnum.CREDENTIALS]
def process_telemetry(telemetry_json):
def process_telemetry(telemetry_json, agent_configuration: AgentConfiguration):
try:
telem_category = telemetry_json.get("telem_category")
if telem_category in TELEMETRY_CATEGORY_TO_PROCESSING_FUNC: