Island, Agent: Move dropper option from WormConfiguration to consts

* Remove dropper_set_date, dropper_date_reference_path_windows
  dropper_date_reference_path_linux from internal config in the Island
* Remove all references to these options from data for tests
This commit is contained in:
Ilija Lazoroski 2022-05-30 15:14:58 +02:00
parent b3710e4772
commit 49654d4dfe
6 changed files with 7 additions and 54 deletions

View File

@ -65,14 +65,6 @@ class Configuration(object):
return result
###########################
# dropper config
###########################
dropper_set_date = True
dropper_date_reference_path_windows = r"%windir%\system32\kernel32.dll"
dropper_date_reference_path_linux = "/bin/sh"
###########################
# monkey config
###########################

View File

@ -10,7 +10,6 @@ import time
from pathlib import WindowsPath
from common.utils.attack_utils import UsageEnum
from infection_monkey.config import WormConfiguration
from infection_monkey.utils.commands import (
build_monkey_commandline_explicitly,
get_monkey_commandline_linux,
@ -35,6 +34,8 @@ except NameError:
logger = logging.getLogger(__name__)
MOVEFILE_DELAY_UNTIL_REBOOT = 4
DATE_REFERENCE_PATH_WINDOWS = r"%windir%\system32\kernel32.dll"
DATE_REFERENCE_PATH_LINUX = "/bin/sh"
class MonkeyDrops(object):
@ -110,27 +111,18 @@ class MonkeyDrops(object):
return False
if WormConfiguration.dropper_set_date:
if sys.platform == "win32":
dropper_date_reference_path = os.path.expandvars(
WormConfiguration.dropper_date_reference_path_windows
)
else:
dropper_date_reference_path = WormConfiguration.dropper_date_reference_path_linux
if sys.platform == "win32":
dropper_date_reference_path = os.path.expandvars(DATE_REFERENCE_PATH_WINDOWS)
else:
dropper_date_reference_path = DATE_REFERENCE_PATH_LINUX
try:
ref_stat = os.stat(dropper_date_reference_path)
os.utime(self._config["destination_path"], (ref_stat.st_atime, ref_stat.st_mtime))
except OSError:
logger.warning(
"Cannot set reference date using '%s', file not found",
dropper_date_reference_path,
)
else:
try:
os.utime(
self._config["destination_path"], (ref_stat.st_atime, ref_stat.st_mtime)
)
except OSError:
logger.warning("Cannot set reference date to destination file")
monkey_options = build_monkey_commandline_explicitly(
parent=self.opts.parent,

View File

@ -144,30 +144,6 @@ INTERNAL = {
"title": "Dropper",
"type": "object",
"properties": {
"dropper_set_date": {
"title": "Dropper sets date",
"type": "boolean",
"default": True,
"description": "Determines whether the dropper should set the monkey's file "
"date to be the same as"
" another file",
},
"dropper_date_reference_path_windows": {
"title": "Dropper date reference path (Windows)",
"type": "string",
"default": "%windir%\\system32\\kernel32.dll",
"description": "Determines which file the dropper should copy the date from if "
"it's configured to do"
" so on Windows (use fullpath)",
},
"dropper_date_reference_path_linux": {
"title": "Dropper date reference path (Linux)",
"type": "string",
"default": "/bin/sh",
"description": "Determines which file the dropper should copy the date from if "
"it's configured to do"
" so on Linux (use fullpath)",
},
"dropper_target_path_linux": {
"title": "Dropper target path on Linux",
"type": "string",

View File

@ -69,7 +69,6 @@
"windows_command": ""
},
"depth": 2,
"dropper_set_date": true,
"exploit_lm_hash_list": ["DEADBEEF", "FACADE"],
"exploit_ntlm_hash_list": ["BEADED", "ACCEDE", "DECADE"],
"exploit_password_list": ["p1", "p2", "p3"],

View File

@ -21,9 +21,6 @@
"custom_PBA_linux_cmd": "bash test.sh",
"custom_PBA_windows_cmd": "powershell test.ps1",
"depth": 2,
"dropper_date_reference_path_linux": "/bin/sh",
"dropper_date_reference_path_windows": "%windir%\\system32\\kernel32.dll",
"dropper_set_date": true,
"dropper_target_path_linux": "/tmp/monkey",
"dropper_target_path_win_64": "C:\\Windows\\temp\\monkey64.exe",
"exploit_lm_hash_list": ["lm_hash_1", "lm_hash_2"],

View File

@ -97,9 +97,6 @@
]
},
"dropper": {
"dropper_set_date": true,
"dropper_date_reference_path_windows": "%windir%\\system32\\kernel32.dll",
"dropper_date_reference_path_linux": "/bin/sh",
"dropper_target_path_linux": "/tmp/monkey",
"dropper_target_path_win_64": "C:\\Windows\\temp\\monkey64.exe"
},