From 39f07603a7ea1e007aaa9bfb45eb37add127242a Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 15 Aug 2022 17:13:23 +0200 Subject: [PATCH] Agent: Define integer GUID and use it in ssh_handler --- monkey/infection_monkey/config.py | 1 + .../credential_collectors/ssh_collector/ssh_handler.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/monkey/infection_monkey/config.py b/monkey/infection_monkey/config.py index a4c39ee13..40cbbb739 100644 --- a/monkey/infection_monkey/config.py +++ b/monkey/infection_monkey/config.py @@ -2,3 +2,4 @@ import uuid # TODO: Find a better place for this GUID = str(uuid.getnode()) +IGUID = uuid.getnode() diff --git a/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_handler.py b/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_handler.py index a48424304..0ee4d2346 100644 --- a/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_handler.py +++ b/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_handler.py @@ -1,14 +1,14 @@ import glob import logging import os -import time -import uuid +from time import time from typing import Dict, Iterable from common.credentials import Credentials, SSHKeypair, Username from common.event_queue import IEventQueue from common.events import CredentialsStolenEvent from common.utils.attack_utils import ScanStatus +from infection_monkey.config import IGUID from infection_monkey.telemetry.attack.t1005_telem import T1005Telem from infection_monkey.telemetry.attack.t1145_telem import T1145Telem from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger @@ -136,9 +136,9 @@ def _get_ssh_files( def _publish_credentials_stolen_event(collected_credentials: Credentials, event_queue: IEventQueue): credentials_stolen_event = CredentialsStolenEvent( - source=uuid.getnode(), + source=IGUID, target=None, - timestamp=time.time(), + timestamp=time(), tags=frozenset({SSH_CREDENTIAL_COLLECTOR_TAG, "T1005", "T1145"}), stolen_credentials=[collected_credentials], )