agent: Rename `self.should_encrypt` to `self.encryption_enabled` in ransomware payload

This commit is contained in:
Shreya 2021-06-30 13:34:38 +05:30
parent 392ece29a0
commit 619695d5bc
3 changed files with 6 additions and 6 deletions

View File

@ -21,8 +21,8 @@ README_DEST = "README.txt"
class RansomwarePayload:
def __init__(self, config: dict, telemetry_messenger: ITelemetryMessenger):
self.should_encrypt = config["encryption"]["should_encrypt"]
LOG.info(f"Encryption routine for ransomware simulation enabled: {self.should_encrypt}")
self.encryption_enabled = config["encryption"]["enabled"]
LOG.info(f"Encryption routine for ransomware simulation enabled: {self.encryption_enabled}")
target_directories = config["encryption"]["directories"]
LOG.info(
@ -47,7 +47,7 @@ class RansomwarePayload:
self._telemetry_messenger = telemetry_messenger
def run_payload(self):
if self.should_encrypt:
if self.encryption_enabled:
LOG.info("Running ransomware payload")
file_list = self._find_files()
self._encrypt_files(file_list)

View File

@ -6,7 +6,7 @@ RANSOMWARE = {
"title": "Encryption",
"type": "object",
"properties": {
"should_encrypt": {
"enabled": {
"title": "Encrypt files",
"type": "boolean",
"default": True,

View File

@ -33,7 +33,7 @@ def with_extension(filename):
def ransomware_payload_config(ransomware_target):
return {
"encryption": {
"should_encrypt": True,
"enabled": True,
"directories": {
"linux_dir": str(ransomware_target),
"windows_dir": str(ransomware_target),
@ -136,7 +136,7 @@ def test_skip_already_encrypted_file(ransomware_target, ransomware_payload):
def test_encryption_skipped_if_configured_false(
ransomware_payload_config, ransomware_target, telemetry_messenger_spy
):
ransomware_payload_config["encryption"]["should_encrypt"] = False
ransomware_payload_config["encryption"]["enabled"] = False
ransomware_payload = RansomwarePayload(ransomware_payload_config, telemetry_messenger_spy)
ransomware_payload.run_payload()