agent: Move get_all_files_in_directory() from ransomware/utils.py to utils/file_utils.py

This commit is contained in:
Shreya 2021-06-22 19:45:50 +05:30
parent c6da73ad79
commit 5f714e0d98
2 changed files with 9 additions and 6 deletions

View File

@ -2,6 +2,7 @@ import os
from typing import List
from infection_monkey.ransomware.valid_file_extensions import VALID_FILE_EXTENSIONS_FOR_ENCRYPTION
from infection_monkey.utils.file_utils import get_all_files_in_directory
def get_files_to_encrypt(dir_path: str) -> List[str]:
@ -13,9 +14,3 @@ def get_files_to_encrypt(dir_path: str) -> List[str]:
files_to_encrypt.append(file)
return files_to_encrypt
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)])
)

View File

@ -0,0 +1,8 @@
import os
from typing import List
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)])
)