Refactor ransomware configuration option from flattened to a dict that encompasses any ransomware options

This commit is contained in:
VakarisZ 2021-06-22 16:42:09 +03:00
parent 63901bcd26
commit 947a03c9a1
4 changed files with 9 additions and 6 deletions

View File

@ -197,8 +197,7 @@ class Configuration(object):
# ransomware config
###########################
windows_dir_ransom = ""
linux_dir_ransom = ""
ransomware = ""
def get_exploit_user_password_pairs(self):
"""

View File

@ -19,7 +19,7 @@ from infection_monkey.network.HostFinger import HostFinger
from infection_monkey.network.network_scanner import NetworkScanner
from infection_monkey.network.tools import get_interface_to_target, is_running_on_island
from infection_monkey.post_breach.post_breach_handler import PostBreach
from infection_monkey.ransomware import start_ransomware
from infection_monkey.ransomware.ransomware_payload import RansomewarePayload
from infection_monkey.system_info import SystemInfoCollector
from infection_monkey.system_singleton import SystemSingleton
from infection_monkey.telemetry.attack.t1106_telem import T1106Telem
@ -233,7 +233,7 @@ class InfectionMonkey(object):
if not self._keep_running:
break
start_ransomware()
RansomewarePayload(WormConfiguration.ransomware).run_payload()
if (not is_empty) and (WormConfiguration.max_iterations > iteration_index + 1):
time_to_sleep = WormConfiguration.timeout_between_iterations

View File

@ -106,6 +106,10 @@ class ConfigService:
config_json = ConfigService.get_config(is_initial_config, should_decrypt)
flat_config_json = {}
for i in config_json:
if i == "ransomware":
# Don't flatten the ransomware because ransomware payload expects a dictionary #1260
flat_config_json[i] = config_json[i]
continue
for j in config_json[i]:
for k in config_json[i][j]:
if isinstance(config_json[i][j][k], dict):

View File

@ -6,14 +6,14 @@ RANSOMWARE = {
"title": "Directories to encrypt",
"type": "object",
"properties": {
"linux_dir_ransom": {
"linux_dir": {
"title": "Linux encryptable directory",
"type": "string",
"default": "",
"description": "Files in the specified directory will be encrypted "
"using bitflip to simulate ransomware.",
},
"windows_dir_ransom": {
"windows_dir": {
"title": "Windows encryptable directory",
"type": "string",
"default": "",