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 = [ BRUTE_FORCE = [
{"name": "ex1", "options": {}, "supported_os": ["LINUX"]}, {"name": "ex1", "options": {}},
{ {
"name": "ex2", "name": "ex2",
"options": {"smb_download_timeout": 10}, "options": {"smb_download_timeout": 10},
"supported_os": ["LINUX", "WINDOWS"],
}, },
] ]
VULNERABILITY = [ VULNERABILITY = [
{ {
"name": "ex3", "name": "ex3",
"options": {"smb_download_timeout": 10}, "options": {"smb_download_timeout": 10},
"supported_os": ["WINDOWS"],
}, },
] ]
EXPLOITATION_CONFIGURATION = { EXPLOITATION_CONFIGURATION = {

View File

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

View File

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

View File

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

View File

@ -1,6 +1,5 @@
import pytest import pytest
from common import OperatingSystems
from monkey_island.cc.services.config import ConfigService from monkey_island.cc.services.config import ConfigService
# If tests fail because config path is changed, sync with # 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], "http_ports": [80, 443, 7001, 8008, 8080, 9200],
}, },
"brute_force": [ "brute_force": [
{"name": "MSSQLExploiter", "supported_os": [OperatingSystems.WINDOWS], "options": {}}, {"name": "MSSQLExploiter", "options": {}},
{ {
"name": "PowerShellExploiter", "name": "PowerShellExploiter",
"supported_os": [OperatingSystems.WINDOWS],
"options": {}, "options": {},
}, },
{"name": "SSHExploiter", "supported_os": [OperatingSystems.LINUX], "options": {}}, {"name": "SSHExploiter", "options": {}},
{ {
"name": "SmbExploiter", "name": "SmbExploiter",
"supported_os": [OperatingSystems.WINDOWS],
"options": {"smb_download_timeout": 30}, "options": {"smb_download_timeout": 30},
}, },
{ {
"name": "WmiExploiter", "name": "WmiExploiter",
"supported_os": [OperatingSystems.WINDOWS],
"options": {"smb_download_timeout": 30}, "options": {"smb_download_timeout": 30},
}, },
], ],
"vulnerability": [ "vulnerability": [
{ {
"name": "HadoopExploiter", "name": "HadoopExploiter",
"supported_os": [OperatingSystems.LINUX, OperatingSystems.WINDOWS],
"options": {}, "options": {},
}, },
{ {
"name": "Log4ShellExploiter", "name": "Log4ShellExploiter",
"supported_os": [OperatingSystems.LINUX, OperatingSystems.WINDOWS],
"options": {}, "options": {},
}, },
{ {
"name": "ZerologonExploiter", "name": "ZerologonExploiter",
"supported_os": [OperatingSystems.WINDOWS],
"options": {}, "options": {},
}, },
], ],