From 3192355f5a61c1e7074e05efe88a01383423ba65 Mon Sep 17 00:00:00 2001 From: Shreya Date: Tue, 22 Jun 2021 12:47:38 +0530 Subject: [PATCH] agent: ransomware: Return list instead of filter object when getting files in directory --- monkey/infection_monkey/ransomware/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/monkey/infection_monkey/ransomware/utils.py b/monkey/infection_monkey/ransomware/utils.py index d9cc7d5ce..2fd0052fb 100644 --- a/monkey/infection_monkey/ransomware/utils.py +++ b/monkey/infection_monkey/ransomware/utils.py @@ -1,5 +1,5 @@ import os -from typing import Iterator, List +from typing import List VALID_FILE_EXTENSIONS_FOR_ENCRYPTION = { ".3ds", @@ -90,5 +90,7 @@ def get_files_to_encrypt(dir_path: str) -> List[str]: return files_to_encrypt -def get_all_files_in_directory(dir_path: str) -> Iterator: - return filter(os.path.isfile, [os.path.join(dir_path, item) for item in os.listdir(dir_path)]) +def get_all_files_in_directory(dir_path: str) -> List: + return list( + filter(os.path.isfile, [os.path.join(dir_path, item) for item in os.listdir(dir_path)]) + )