Agent: Change post breach telem to use name from data argument

This commit is contained in:
vakarisz 2022-03-29 10:18:37 +03:00 committed by VakarisZ
parent 3c853b6625
commit 936b9ead05
2 changed files with 7 additions and 12 deletions

View File

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

View File

@ -8,21 +8,16 @@ from infection_monkey.utils.environment import is_windows_os
class PostBreachTelem(BaseTelem): class PostBreachTelem(BaseTelem):
def __init__(self, name: str, post_breach_data: PostBreachData) -> None:
""" telem_category = TelemCategoryEnum.POST_BREACH
Default post breach telemetry constructor
:param name: Name of post breach action def __init__(self, post_breach_data: PostBreachData) -> None:
:param command: Command used as PBA
:param result: Result of PBA
"""
super(PostBreachTelem, self).__init__() super(PostBreachTelem, self).__init__()
self.name = name self.name = post_breach_data.display_name
self.command = post_breach_data.command self.command = post_breach_data.command
self.result = post_breach_data.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
def get_data(self) -> Dict: def get_data(self) -> Dict:
return { return {
"command": self.command, "command": self.command,