forked from p15670423/monkey
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:
parent
b3710e4772
commit
49654d4dfe
|
@ -65,14 +65,6 @@ class Configuration(object):
|
||||||
|
|
||||||
return result
|
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
|
# monkey config
|
||||||
###########################
|
###########################
|
||||||
|
|
|
@ -10,7 +10,6 @@ import time
|
||||||
from pathlib import WindowsPath
|
from pathlib import WindowsPath
|
||||||
|
|
||||||
from common.utils.attack_utils import UsageEnum
|
from common.utils.attack_utils import UsageEnum
|
||||||
from infection_monkey.config import WormConfiguration
|
|
||||||
from infection_monkey.utils.commands import (
|
from infection_monkey.utils.commands import (
|
||||||
build_monkey_commandline_explicitly,
|
build_monkey_commandline_explicitly,
|
||||||
get_monkey_commandline_linux,
|
get_monkey_commandline_linux,
|
||||||
|
@ -35,6 +34,8 @@ except NameError:
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
MOVEFILE_DELAY_UNTIL_REBOOT = 4
|
MOVEFILE_DELAY_UNTIL_REBOOT = 4
|
||||||
|
DATE_REFERENCE_PATH_WINDOWS = r"%windir%\system32\kernel32.dll"
|
||||||
|
DATE_REFERENCE_PATH_LINUX = "/bin/sh"
|
||||||
|
|
||||||
|
|
||||||
class MonkeyDrops(object):
|
class MonkeyDrops(object):
|
||||||
|
@ -110,27 +111,18 @@ class MonkeyDrops(object):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if WormConfiguration.dropper_set_date:
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
dropper_date_reference_path = os.path.expandvars(
|
dropper_date_reference_path = os.path.expandvars(DATE_REFERENCE_PATH_WINDOWS)
|
||||||
WormConfiguration.dropper_date_reference_path_windows
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
dropper_date_reference_path = WormConfiguration.dropper_date_reference_path_linux
|
dropper_date_reference_path = DATE_REFERENCE_PATH_LINUX
|
||||||
try:
|
try:
|
||||||
ref_stat = os.stat(dropper_date_reference_path)
|
ref_stat = os.stat(dropper_date_reference_path)
|
||||||
|
os.utime(self._config["destination_path"], (ref_stat.st_atime, ref_stat.st_mtime))
|
||||||
except OSError:
|
except OSError:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Cannot set reference date using '%s', file not found",
|
"Cannot set reference date using '%s', file not found",
|
||||||
dropper_date_reference_path,
|
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(
|
monkey_options = build_monkey_commandline_explicitly(
|
||||||
parent=self.opts.parent,
|
parent=self.opts.parent,
|
||||||
|
|
|
@ -144,30 +144,6 @@ INTERNAL = {
|
||||||
"title": "Dropper",
|
"title": "Dropper",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"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": {
|
"dropper_target_path_linux": {
|
||||||
"title": "Dropper target path on Linux",
|
"title": "Dropper target path on Linux",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
|
@ -69,7 +69,6 @@
|
||||||
"windows_command": ""
|
"windows_command": ""
|
||||||
},
|
},
|
||||||
"depth": 2,
|
"depth": 2,
|
||||||
"dropper_set_date": true,
|
|
||||||
"exploit_lm_hash_list": ["DEADBEEF", "FACADE"],
|
"exploit_lm_hash_list": ["DEADBEEF", "FACADE"],
|
||||||
"exploit_ntlm_hash_list": ["BEADED", "ACCEDE", "DECADE"],
|
"exploit_ntlm_hash_list": ["BEADED", "ACCEDE", "DECADE"],
|
||||||
"exploit_password_list": ["p1", "p2", "p3"],
|
"exploit_password_list": ["p1", "p2", "p3"],
|
||||||
|
|
|
@ -21,9 +21,6 @@
|
||||||
"custom_PBA_linux_cmd": "bash test.sh",
|
"custom_PBA_linux_cmd": "bash test.sh",
|
||||||
"custom_PBA_windows_cmd": "powershell test.ps1",
|
"custom_PBA_windows_cmd": "powershell test.ps1",
|
||||||
"depth": 2,
|
"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_linux": "/tmp/monkey",
|
||||||
"dropper_target_path_win_64": "C:\\Windows\\temp\\monkey64.exe",
|
"dropper_target_path_win_64": "C:\\Windows\\temp\\monkey64.exe",
|
||||||
"exploit_lm_hash_list": ["lm_hash_1", "lm_hash_2"],
|
"exploit_lm_hash_list": ["lm_hash_1", "lm_hash_2"],
|
||||||
|
|
|
@ -97,9 +97,6 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dropper": {
|
"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_linux": "/tmp/monkey",
|
||||||
"dropper_target_path_win_64": "C:\\Windows\\temp\\monkey64.exe"
|
"dropper_target_path_win_64": "C:\\Windows\\temp\\monkey64.exe"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue