agent: Rename RansomwareBitflipEncryptor -> BitflipEncryptor
This commit is contained in:
parent
1929ea7dae
commit
70480c7011
|
@ -3,7 +3,7 @@ from pathlib import Path
|
||||||
from infection_monkey.utils import bit_manipulators
|
from infection_monkey.utils import bit_manipulators
|
||||||
|
|
||||||
|
|
||||||
class RansomwareBitflipEncryptor:
|
class BitflipEncryptor:
|
||||||
def __init__(self, chunk_size=64):
|
def __init__(self, chunk_size=64):
|
||||||
self._chunk_size = chunk_size
|
self._chunk_size = chunk_size
|
||||||
|
|
|
@ -2,8 +2,8 @@ import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
|
from infection_monkey.ransomware.bitflip_encryptor import BitflipEncryptor
|
||||||
from infection_monkey.ransomware.file_selectors import select_production_safe_target_files
|
from infection_monkey.ransomware.file_selectors import select_production_safe_target_files
|
||||||
from infection_monkey.ransomware.ransomware_bitflip_encryptor import RansomwareBitflipEncryptor
|
|
||||||
from infection_monkey.ransomware.valid_file_extensions import VALID_FILE_EXTENSIONS_FOR_ENCRYPTION
|
from infection_monkey.ransomware.valid_file_extensions import VALID_FILE_EXTENSIONS_FOR_ENCRYPTION
|
||||||
from infection_monkey.utils.environment import is_windows_os
|
from infection_monkey.utils.environment import is_windows_os
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class RansomewarePayload:
|
||||||
self._valid_file_extensions_for_encryption = VALID_FILE_EXTENSIONS_FOR_ENCRYPTION.copy()
|
self._valid_file_extensions_for_encryption = VALID_FILE_EXTENSIONS_FOR_ENCRYPTION.copy()
|
||||||
self._valid_file_extensions_for_encryption.discard(self._new_file_extension)
|
self._valid_file_extensions_for_encryption.discard(self._new_file_extension)
|
||||||
|
|
||||||
self._encryptor = RansomwareBitflipEncryptor(chunk_size=CHUNK_SIZE)
|
self._encryptor = BitflipEncryptor(chunk_size=CHUNK_SIZE)
|
||||||
|
|
||||||
def run_payload(self):
|
def run_payload(self):
|
||||||
file_list = self._find_files()
|
file_list = self._find_files()
|
||||||
|
|
|
@ -7,7 +7,7 @@ from tests.unit_tests.infection_monkey.ransomware.ransomware_target_files import
|
||||||
)
|
)
|
||||||
from tests.utils import hash_file
|
from tests.utils import hash_file
|
||||||
|
|
||||||
from infection_monkey.ransomware.ransomware_bitflip_encryptor import RansomwareBitflipEncryptor
|
from infection_monkey.ransomware.bitflip_encryptor import BitflipEncryptor
|
||||||
|
|
||||||
|
|
||||||
def test_file_encrypted(ransomware_target):
|
def test_file_encrypted(ransomware_target):
|
||||||
|
@ -15,7 +15,7 @@ def test_file_encrypted(ransomware_target):
|
||||||
|
|
||||||
assert hash_file(test_keyboard) == TEST_KEYBOARD_TXT_CLEARTEXT_SHA256
|
assert hash_file(test_keyboard) == TEST_KEYBOARD_TXT_CLEARTEXT_SHA256
|
||||||
|
|
||||||
encryptor = RansomwareBitflipEncryptor(chunk_size=64)
|
encryptor = BitflipEncryptor(chunk_size=64)
|
||||||
encryptor.encrypt_file_in_place(test_keyboard)
|
encryptor.encrypt_file_in_place(test_keyboard)
|
||||||
|
|
||||||
assert hash_file(test_keyboard) == TEST_KEYBOARD_TXT_ENCRYPTED_SHA256
|
assert hash_file(test_keyboard) == TEST_KEYBOARD_TXT_ENCRYPTED_SHA256
|
||||||
|
@ -26,7 +26,7 @@ def test_file_encrypted_in_place(ransomware_target):
|
||||||
|
|
||||||
expected_inode = os.stat(test_keyboard).st_ino
|
expected_inode = os.stat(test_keyboard).st_ino
|
||||||
|
|
||||||
encryptor = RansomwareBitflipEncryptor(chunk_size=64)
|
encryptor = BitflipEncryptor(chunk_size=64)
|
||||||
encryptor.encrypt_file_in_place(test_keyboard)
|
encryptor.encrypt_file_in_place(test_keyboard)
|
||||||
|
|
||||||
actual_inode = os.stat(test_keyboard).st_ino
|
actual_inode = os.stat(test_keyboard).st_ino
|
Loading…
Reference in New Issue