From 70480c7011a3e2ea45ee6ce3710903f877078912 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 23 Jun 2021 11:05:34 -0400 Subject: [PATCH] agent: Rename RansomwareBitflipEncryptor -> BitflipEncryptor --- ...ransomware_bitflip_encryptor.py => bitflip_encryptor.py} | 2 +- monkey/infection_monkey/ransomware/ransomware_payload.py | 4 ++-- ...mware_bitflip_encryptor.py => test_bitflip_encryptor.py} | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) rename monkey/infection_monkey/ransomware/{ransomware_bitflip_encryptor.py => bitflip_encryptor.py} (94%) rename monkey/tests/unit_tests/infection_monkey/ransomware/{test_ransomware_bitflip_encryptor.py => test_bitflip_encryptor.py} (80%) diff --git a/monkey/infection_monkey/ransomware/ransomware_bitflip_encryptor.py b/monkey/infection_monkey/ransomware/bitflip_encryptor.py similarity index 94% rename from monkey/infection_monkey/ransomware/ransomware_bitflip_encryptor.py rename to monkey/infection_monkey/ransomware/bitflip_encryptor.py index 4c297d4cb..b31f8a409 100644 --- a/monkey/infection_monkey/ransomware/ransomware_bitflip_encryptor.py +++ b/monkey/infection_monkey/ransomware/bitflip_encryptor.py @@ -3,7 +3,7 @@ from pathlib import Path from infection_monkey.utils import bit_manipulators -class RansomwareBitflipEncryptor: +class BitflipEncryptor: def __init__(self, chunk_size=64): self._chunk_size = chunk_size diff --git a/monkey/infection_monkey/ransomware/ransomware_payload.py b/monkey/infection_monkey/ransomware/ransomware_payload.py index edb2e76a4..460b0fb4c 100644 --- a/monkey/infection_monkey/ransomware/ransomware_payload.py +++ b/monkey/infection_monkey/ransomware/ransomware_payload.py @@ -2,8 +2,8 @@ import logging from pathlib import Path 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.ransomware_bitflip_encryptor import RansomwareBitflipEncryptor from infection_monkey.ransomware.valid_file_extensions import VALID_FILE_EXTENSIONS_FOR_ENCRYPTION 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.discard(self._new_file_extension) - self._encryptor = RansomwareBitflipEncryptor(chunk_size=CHUNK_SIZE) + self._encryptor = BitflipEncryptor(chunk_size=CHUNK_SIZE) def run_payload(self): file_list = self._find_files() diff --git a/monkey/tests/unit_tests/infection_monkey/ransomware/test_ransomware_bitflip_encryptor.py b/monkey/tests/unit_tests/infection_monkey/ransomware/test_bitflip_encryptor.py similarity index 80% rename from monkey/tests/unit_tests/infection_monkey/ransomware/test_ransomware_bitflip_encryptor.py rename to monkey/tests/unit_tests/infection_monkey/ransomware/test_bitflip_encryptor.py index 5dd584778..86066c518 100644 --- a/monkey/tests/unit_tests/infection_monkey/ransomware/test_ransomware_bitflip_encryptor.py +++ b/monkey/tests/unit_tests/infection_monkey/ransomware/test_bitflip_encryptor.py @@ -7,7 +7,7 @@ from tests.unit_tests.infection_monkey.ransomware.ransomware_target_files import ) 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): @@ -15,7 +15,7 @@ def test_file_encrypted(ransomware_target): 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) 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 - encryptor = RansomwareBitflipEncryptor(chunk_size=64) + encryptor = BitflipEncryptor(chunk_size=64) encryptor.encrypt_file_in_place(test_keyboard) actual_inode = os.stat(test_keyboard).st_ino