From e5160a5fb4cf24e964ccd27d040ea302c0c7f96d Mon Sep 17 00:00:00 2001 From: Shreya Date: Tue, 13 Jul 2021 13:41:02 +0530 Subject: [PATCH] agent: Sort files in ransomware payload's `_find_files()` before returning --- monkey/infection_monkey/ransomware/ransomware_payload.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey/infection_monkey/ransomware/ransomware_payload.py b/monkey/infection_monkey/ransomware/ransomware_payload.py index 9324542ad..f4295f866 100644 --- a/monkey/infection_monkey/ransomware/ransomware_payload.py +++ b/monkey/infection_monkey/ransomware/ransomware_payload.py @@ -70,7 +70,9 @@ class RansomwarePayload: def _find_files(self) -> List[Path]: LOG.info(f"Collecting files in {self._target_dir}") - return select_production_safe_target_files(self._target_dir, self._targeted_file_extensions) + return sorted( + select_production_safe_target_files(self._target_dir, self._targeted_file_extensions) + ) def _encrypt_files(self, file_list: List[Path]) -> List[Tuple[Path, Optional[Exception]]]: LOG.info(f"Encrypting files in {self._target_dir}")