forked from p34709852/monkey
agent: Rename `self.should_encrypt` to `self.encryption_enabled` in ransomware payload
This commit is contained in:
parent
392ece29a0
commit
619695d5bc
|
@ -21,8 +21,8 @@ README_DEST = "README.txt"
|
||||||
|
|
||||||
class RansomwarePayload:
|
class RansomwarePayload:
|
||||||
def __init__(self, config: dict, telemetry_messenger: ITelemetryMessenger):
|
def __init__(self, config: dict, telemetry_messenger: ITelemetryMessenger):
|
||||||
self.should_encrypt = config["encryption"]["should_encrypt"]
|
self.encryption_enabled = config["encryption"]["enabled"]
|
||||||
LOG.info(f"Encryption routine for ransomware simulation enabled: {self.should_encrypt}")
|
LOG.info(f"Encryption routine for ransomware simulation enabled: {self.encryption_enabled}")
|
||||||
|
|
||||||
target_directories = config["encryption"]["directories"]
|
target_directories = config["encryption"]["directories"]
|
||||||
LOG.info(
|
LOG.info(
|
||||||
|
@ -47,7 +47,7 @@ class RansomwarePayload:
|
||||||
self._telemetry_messenger = telemetry_messenger
|
self._telemetry_messenger = telemetry_messenger
|
||||||
|
|
||||||
def run_payload(self):
|
def run_payload(self):
|
||||||
if self.should_encrypt:
|
if self.encryption_enabled:
|
||||||
LOG.info("Running ransomware payload")
|
LOG.info("Running ransomware payload")
|
||||||
file_list = self._find_files()
|
file_list = self._find_files()
|
||||||
self._encrypt_files(file_list)
|
self._encrypt_files(file_list)
|
||||||
|
|
|
@ -6,7 +6,7 @@ RANSOMWARE = {
|
||||||
"title": "Encryption",
|
"title": "Encryption",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"should_encrypt": {
|
"enabled": {
|
||||||
"title": "Encrypt files",
|
"title": "Encrypt files",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": True,
|
"default": True,
|
||||||
|
|
|
@ -33,7 +33,7 @@ def with_extension(filename):
|
||||||
def ransomware_payload_config(ransomware_target):
|
def ransomware_payload_config(ransomware_target):
|
||||||
return {
|
return {
|
||||||
"encryption": {
|
"encryption": {
|
||||||
"should_encrypt": True,
|
"enabled": True,
|
||||||
"directories": {
|
"directories": {
|
||||||
"linux_dir": str(ransomware_target),
|
"linux_dir": str(ransomware_target),
|
||||||
"windows_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(
|
def test_encryption_skipped_if_configured_false(
|
||||||
ransomware_payload_config, ransomware_target, telemetry_messenger_spy
|
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 = RansomwarePayload(ransomware_payload_config, telemetry_messenger_spy)
|
||||||
ransomware_payload.run_payload()
|
ransomware_payload.run_payload()
|
||||||
|
|
Loading…
Reference in New Issue