UT: Remove `supported_os` for exploiters from all tests

This commit is contained in:
Shreya Malviya 2022-06-22 08:41:11 -07:00
parent fd41d9179e
commit e25eb194a1
5 changed files with 16 additions and 30 deletions

View File

@ -39,18 +39,16 @@ NETWORK_SCAN_CONFIGURATION = {
}
BRUTE_FORCE = [
{"name": "ex1", "options": {}, "supported_os": ["LINUX"]},
{"name": "ex1", "options": {}},
{
"name": "ex2",
"options": {"smb_download_timeout": 10},
"supported_os": ["LINUX", "WINDOWS"],
},
]
VULNERABILITY = [
{
"name": "ex3",
"options": {"smb_download_timeout": 10},
"supported_os": ["WINDOWS"],
},
]
EXPLOITATION_CONFIGURATION = {

View File

@ -47,16 +47,16 @@
"exploiters": {
"options": {},
"brute_force": [
{"name": "MSSQLExploiter", "supported_os": ["windows"], "options": {}},
{"name": "PowerShellExploiter", "supported_os": ["windows"], "options": {}},
{"name": "SmbExploiter", "supported_os": ["windows"], "options": {}},
{"name": "SSHExploiter", "supported_os": ["linux"], "options": {}},
{"name": "WmiExploiter", "supported_os": ["windows"], "options": {}}
{"name": "MSSQLExploiter", "options": {}},
{"name": "PowerShellExploiter", "options": {}},
{"name": "SmbExploiter", "options": {}},
{"name": "SSHExploiter", "options": {}},
{"name": "WmiExploiter", "options": {}}
],
"vulnerability": [
{"name": "HadoopExploiter", "supported_os": ["linux", "windows"], "options": {}},
{"name": "ShellShockExploiter", "supported_os": ["linux"], "options": {}},
{"name": "ZerologonExploiter", "supported_os": ["windows"], "options": {}}
{"name": "HadoopExploiter", "options": {}},
{"name": "ShellShockExploiter", "options": {}},
{"name": "ZerologonExploiter", "options": {}}
]
}
},

View File

@ -23,7 +23,6 @@ from tests.common.example_agent_configuration import (
WINDOWS_FILENAME,
)
from common import OperatingSystems
from common.configuration import (
DEFAULT_AGENT_CONFIGURATION_JSON,
AgentConfiguration,
@ -126,16 +125,12 @@ def test_exploitation_options_configuration_schema():
def test_exploiter_configuration_schema():
name = "bond"
options = {"gun": "Walther PPK", "car": "Aston Martin DB5"}
supported_os = [OperatingSystems.LINUX, OperatingSystems.WINDOWS]
schema = ExploiterConfigurationSchema()
config = schema.load(
{"name": name, "options": options, "supported_os": [os_.name for os_ in supported_os]}
)
config = schema.load({"name": name, "options": options})
assert config.name == name
assert config.options == options
assert config.supported_os == supported_os
def test_exploitation_configuration():

View File

@ -38,12 +38,12 @@ def exploiter_config():
return {
"options": {"dropper_path_linux": "/tmp/monkey"},
"brute_force": [
{"name": "HadoopExploiter", "supported_os": ["windows"], "options": {"timeout": 10}},
{"name": "SSHExploiter", "supported_os": ["linux"], "options": {}},
{"name": "WmiExploiter", "supported_os": ["windows"], "options": {"timeout": 10}},
{"name": "HadoopExploiter", "options": {"timeout": 10}},
{"name": "SSHExploiter", "options": {}},
{"name": "WmiExploiter", "options": {"timeout": 10}},
],
"vulnerability": [
{"name": "ZerologonExploiter", "supported_os": ["windows"], "options": {}},
{"name": "ZerologonExploiter", "options": {}},
],
}

View File

@ -1,6 +1,5 @@
import pytest
from common import OperatingSystems
from monkey_island.cc.services.config import ConfigService
# If tests fail because config path is changed, sync with
@ -172,38 +171,32 @@ def test_format_config_for_agent__exploiters():
"http_ports": [80, 443, 7001, 8008, 8080, 9200],
},
"brute_force": [
{"name": "MSSQLExploiter", "supported_os": [OperatingSystems.WINDOWS], "options": {}},
{"name": "MSSQLExploiter", "options": {}},
{
"name": "PowerShellExploiter",
"supported_os": [OperatingSystems.WINDOWS],
"options": {},
},
{"name": "SSHExploiter", "supported_os": [OperatingSystems.LINUX], "options": {}},
{"name": "SSHExploiter", "options": {}},
{
"name": "SmbExploiter",
"supported_os": [OperatingSystems.WINDOWS],
"options": {"smb_download_timeout": 30},
},
{
"name": "WmiExploiter",
"supported_os": [OperatingSystems.WINDOWS],
"options": {"smb_download_timeout": 30},
},
],
"vulnerability": [
{
"name": "HadoopExploiter",
"supported_os": [OperatingSystems.LINUX, OperatingSystems.WINDOWS],
"options": {},
},
{
"name": "Log4ShellExploiter",
"supported_os": [OperatingSystems.LINUX, OperatingSystems.WINDOWS],
"options": {},
},
{
"name": "ZerologonExploiter",
"supported_os": [OperatingSystems.WINDOWS],
"options": {},
},
],