Agent: Define integer GUID and use it in ssh_handler

This commit is contained in:
Ilija Lazoroski 2022-08-15 17:13:23 +02:00
parent b22ccdb942
commit 39f07603a7
2 changed files with 5 additions and 4 deletions

View File

@ -2,3 +2,4 @@ import uuid
# TODO: Find a better place for this # TODO: Find a better place for this
GUID = str(uuid.getnode()) GUID = str(uuid.getnode())
IGUID = uuid.getnode()

View File

@ -1,14 +1,14 @@
import glob import glob
import logging import logging
import os import os
import time from time import time
import uuid
from typing import Dict, Iterable from typing import Dict, Iterable
from common.credentials import Credentials, SSHKeypair, Username from common.credentials import Credentials, SSHKeypair, Username
from common.event_queue import IEventQueue from common.event_queue import IEventQueue
from common.events import CredentialsStolenEvent from common.events import CredentialsStolenEvent
from common.utils.attack_utils import ScanStatus 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.t1005_telem import T1005Telem
from infection_monkey.telemetry.attack.t1145_telem import T1145Telem from infection_monkey.telemetry.attack.t1145_telem import T1145Telem
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger 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): def _publish_credentials_stolen_event(collected_credentials: Credentials, event_queue: IEventQueue):
credentials_stolen_event = CredentialsStolenEvent( credentials_stolen_event = CredentialsStolenEvent(
source=uuid.getnode(), source=IGUID,
target=None, target=None,
timestamp=time.time(), timestamp=time(),
tags=frozenset({SSH_CREDENTIAL_COLLECTOR_TAG, "T1005", "T1145"}), tags=frozenset({SSH_CREDENTIAL_COLLECTOR_TAG, "T1005", "T1145"}),
stolen_credentials=[collected_credentials], stolen_credentials=[collected_credentials],
) )