Agent: Change PostBreachTelemetry to accept post breach data

This commit is contained in:
vakarisz 2022-03-28 14:32:14 +03:00 committed by VakarisZ
parent 299a261387
commit 3c853b6625
2 changed files with 6 additions and 5 deletions

View File

@ -198,8 +198,8 @@ class AutomatedMaster(IMaster):
name = pba[0] name = pba[0]
options = pba[1] options = pba[1]
display_name, command, result = self._puppet.run_pba(name, options) display_name, result = self._puppet.run_pba(name, options)
self._telemetry_messenger.send_telemetry(PostBreachTelem(display_name, command, result)) self._telemetry_messenger.send_telemetry(PostBreachTelem(display_name, result))
def _can_propagate(self) -> bool: def _can_propagate(self) -> bool:
return True return True

View File

@ -2,12 +2,13 @@ import socket
from typing import Dict, Tuple from typing import Dict, Tuple
from common.common_consts.telem_categories import TelemCategoryEnum from common.common_consts.telem_categories import TelemCategoryEnum
from infection_monkey.i_puppet import PostBreachData
from infection_monkey.telemetry.base_telem import BaseTelem from infection_monkey.telemetry.base_telem import BaseTelem
from infection_monkey.utils.environment import is_windows_os from infection_monkey.utils.environment import is_windows_os
class PostBreachTelem(BaseTelem): class PostBreachTelem(BaseTelem):
def __init__(self, name: str, command: str, result: str) -> None: def __init__(self, name: str, post_breach_data: PostBreachData) -> None:
""" """
Default post breach telemetry constructor Default post breach telemetry constructor
:param name: Name of post breach action :param name: Name of post breach action
@ -16,8 +17,8 @@ class PostBreachTelem(BaseTelem):
""" """
super(PostBreachTelem, self).__init__() super(PostBreachTelem, self).__init__()
self.name = name self.name = name
self.command = command self.command = post_breach_data.command
self.result = result self.result = post_breach_data.result
self.hostname, self.ip = PostBreachTelem._get_hostname_and_ip() self.hostname, self.ip = PostBreachTelem._get_hostname_and_ip()
telem_category = TelemCategoryEnum.POST_BREACH telem_category = TelemCategoryEnum.POST_BREACH