Agent: Remove unused return value from RansomwarePayload._encrypt_files

This commit is contained in:
Mike Salvatore 2021-07-14 11:49:37 -04:00
parent 0be919b805
commit fd3cc46e55
1 changed files with 2 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import logging import logging
from pathlib import Path from pathlib import Path
from pprint import pformat from pprint import pformat
from typing import Callable, List, Optional, Tuple from typing import Callable, List
from common.utils.file_utils import InvalidPath, expand_path from common.utils.file_utils import InvalidPath, expand_path
from infection_monkey.telemetry.file_encryption_telem import FileEncryptionTelem from infection_monkey.telemetry.file_encryption_telem import FileEncryptionTelem
@ -66,10 +66,9 @@ class RansomwarePayload:
LOG.info(f"Collecting files in {self._target_dir}") LOG.info(f"Collecting files in {self._target_dir}")
return sorted(self._select_files(self._target_dir)) return sorted(self._select_files(self._target_dir))
def _encrypt_files(self, file_list: List[Path]) -> List[Tuple[Path, Optional[Exception]]]: def _encrypt_files(self, file_list: List[Path]):
LOG.info(f"Encrypting files in {self._target_dir}") LOG.info(f"Encrypting files in {self._target_dir}")
results = []
for filepath in file_list: for filepath in file_list:
try: try:
LOG.debug(f"Encrypting {filepath}") LOG.debug(f"Encrypting {filepath}")
@ -79,8 +78,6 @@ class RansomwarePayload:
LOG.warning(f"Error encrypting {filepath}: {ex}") LOG.warning(f"Error encrypting {filepath}: {ex}")
self._send_telemetry(filepath, False, str(ex)) self._send_telemetry(filepath, False, str(ex))
return results
def _send_telemetry(self, filepath: Path, success: bool, error: str): def _send_telemetry(self, filepath: Path, success: bool, error: str):
encryption_attempt = FileEncryptionTelem(str(filepath), success, error) encryption_attempt = FileEncryptionTelem(str(filepath), success, error)
self._telemetry_messenger.send_telemetry(encryption_attempt) self._telemetry_messenger.send_telemetry(encryption_attempt)