forked from p34709852/monkey
Zoo: Reformat powershell cached credentials test
This commit is contained in:
parent
689e6ac532
commit
07c08ac0b6
|
@ -7,6 +7,8 @@ from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemp
|
||||||
class PowerShell(ConfigTemplate):
|
class PowerShell(ConfigTemplate):
|
||||||
config_values = copy(BaseTemplate.config_values)
|
config_values = copy(BaseTemplate.config_values)
|
||||||
|
|
||||||
|
# TODO: Remove .\\ from exploit user list when DC name is added,
|
||||||
|
# for more context see https://github.com/guardicore/monkey/issues/1486
|
||||||
config_values.update(
|
config_values.update(
|
||||||
{
|
{
|
||||||
"basic.exploiters.exploiter_classes": ["PowerShellExploiter"],
|
"basic.exploiters.exploiter_classes": ["PowerShellExploiter"],
|
||||||
|
@ -17,7 +19,7 @@ class PowerShell(ConfigTemplate):
|
||||||
"10.2.3.48",
|
"10.2.3.48",
|
||||||
],
|
],
|
||||||
"basic.credentials.exploit_password_list": ["Passw0rd!"],
|
"basic.credentials.exploit_password_list": ["Passw0rd!"],
|
||||||
"basic_network.scope.depth": 2, # TODO: Remove .\\ when DC name is added
|
"basic_network.scope.depth": 2,
|
||||||
"basic.credentials.exploit_user_list": ["m0nk3y", "m0nk3y-user", ".\\m0nk3y"],
|
"basic.credentials.exploit_user_list": ["m0nk3y", "m0nk3y-user", ".\\m0nk3y"],
|
||||||
"internal.classes.finger_classes": ["PingScanner"],
|
"internal.classes.finger_classes": ["PingScanner"],
|
||||||
"internal.network.tcp_scanner.HTTP_PORTS": [],
|
"internal.network.tcp_scanner.HTTP_PORTS": [],
|
||||||
|
@ -27,20 +29,3 @@ class PowerShell(ConfigTemplate):
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PowerShell_Cached(ConfigTemplate):
|
|
||||||
config_values = copy(BaseTemplate.config_values)
|
|
||||||
|
|
||||||
config_values.update(
|
|
||||||
{
|
|
||||||
"basic.exploiters.exploiter_classes": ["PowerShellExploiter"],
|
|
||||||
"basic_network.scope.subnet_scan_list": [
|
|
||||||
"10.2.3.46",
|
|
||||||
],
|
|
||||||
"basic_network.scope.depth": 2,
|
|
||||||
"internal.classes.finger_classes": ["PingScanner"],
|
|
||||||
"internal.network.tcp_scanner.HTTP_PORTS": [],
|
|
||||||
"internal.network.tcp_scanner.tcp_target_ports": [],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
from copy import copy
|
||||||
|
|
||||||
|
from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate
|
||||||
|
from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate
|
||||||
|
|
||||||
|
|
||||||
|
class PowerShellCachedCredentials(ConfigTemplate):
|
||||||
|
config_values = copy(BaseTemplate.config_values)
|
||||||
|
|
||||||
|
config_values.update(
|
||||||
|
{
|
||||||
|
"basic.exploiters.exploiter_classes": ["PowerShellExploiter"],
|
||||||
|
"basic_network.scope.subnet_scan_list": [
|
||||||
|
"10.2.3.46",
|
||||||
|
],
|
||||||
|
"basic_network.scope.depth": 2,
|
||||||
|
"internal.classes.finger_classes": ["PingScanner"],
|
||||||
|
"internal.network.tcp_scanner.HTTP_PORTS": [],
|
||||||
|
"internal.network.tcp_scanner.tcp_target_ports": [],
|
||||||
|
}
|
||||||
|
)
|
|
@ -58,17 +58,17 @@ def pytest_runtest_setup(item):
|
||||||
"Skipping performance test because " "--run-performance-tests flag isn't specified."
|
"Skipping performance test because " "--run-performance-tests flag isn't specified."
|
||||||
)
|
)
|
||||||
|
|
||||||
if item.config.getoption("--os"):
|
if not item.config.getoption("--os"):
|
||||||
os = [mark.args[0] for mark in item.iter_markers(name="os")]
|
|
||||||
if os:
|
|
||||||
if item.config.getoption("--os") not in os:
|
|
||||||
pytest.skip(
|
|
||||||
f"Skipping OS specific test. Run in {os[0]} if "
|
|
||||||
f"you want this test to be executed."
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
pytest.skip(
|
pytest.skip(
|
||||||
"Skipping OS specific test because"
|
"Skipping OS specific test because"
|
||||||
"--os flag isn't specified."
|
"--os flag isn't specified."
|
||||||
" Specify --os with windows or linux as options."
|
" Specify --os with windows or linux as options."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
os = [mark.args[0] for mark in item.iter_markers(name="os")]
|
||||||
|
|
||||||
|
if os and item.config.getoption("--os") not in os:
|
||||||
|
pytest.skip(
|
||||||
|
f'Skipping OS specific test. Run with "--os={os[0]}" if '
|
||||||
|
f"you want this test to be executed."
|
||||||
|
)
|
||||||
|
|
|
@ -13,7 +13,10 @@ from envs.monkey_zoo.blackbox.config_templates.elastic import Elastic
|
||||||
from envs.monkey_zoo.blackbox.config_templates.hadoop import Hadoop
|
from envs.monkey_zoo.blackbox.config_templates.hadoop import Hadoop
|
||||||
from envs.monkey_zoo.blackbox.config_templates.mssql import Mssql
|
from envs.monkey_zoo.blackbox.config_templates.mssql import Mssql
|
||||||
from envs.monkey_zoo.blackbox.config_templates.performance import Performance
|
from envs.monkey_zoo.blackbox.config_templates.performance import Performance
|
||||||
from envs.monkey_zoo.blackbox.config_templates.powershell import PowerShell, PowerShell_Cached
|
from envs.monkey_zoo.blackbox.config_templates.powershell import PowerShell
|
||||||
|
from envs.monkey_zoo.blackbox.config_templates.powershell_cached_credentials import (
|
||||||
|
PowerShellCachedCredentials,
|
||||||
|
)
|
||||||
from envs.monkey_zoo.blackbox.config_templates.shellshock import ShellShock
|
from envs.monkey_zoo.blackbox.config_templates.shellshock import ShellShock
|
||||||
from envs.monkey_zoo.blackbox.config_templates.smb_mimikatz import SmbMimikatz
|
from envs.monkey_zoo.blackbox.config_templates.smb_mimikatz import SmbMimikatz
|
||||||
from envs.monkey_zoo.blackbox.config_templates.smb_pth import SmbPth
|
from envs.monkey_zoo.blackbox.config_templates.smb_pth import SmbPth
|
||||||
|
@ -53,7 +56,6 @@ LOG_DIR_PATH = "./logs"
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
WINDOWS = "windows"
|
WINDOWS = "windows"
|
||||||
LINUX = "linux"
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True, scope="session")
|
@pytest.fixture(autouse=True, scope="session")
|
||||||
|
@ -171,7 +173,9 @@ class TestMonkeyBlackbox:
|
||||||
@pytest.mark.os(WINDOWS)
|
@pytest.mark.os(WINDOWS)
|
||||||
def test_powershell_exploiter_cached_credentials(self, island_client):
|
def test_powershell_exploiter_cached_credentials(self, island_client):
|
||||||
TestMonkeyBlackbox.run_exploitation_test(
|
TestMonkeyBlackbox.run_exploitation_test(
|
||||||
island_client, PowerShell_Cached, "PowerShell_Remoting_exploiter_cached_credentials"
|
island_client,
|
||||||
|
PowerShellCachedCredentials,
|
||||||
|
"PowerShell_Remoting_exploiter_cached_credentials",
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_smb_and_mimikatz_exploiters(self, island_client):
|
def test_smb_and_mimikatz_exploiters(self, island_client):
|
||||||
|
|
|
@ -205,6 +205,4 @@ environment # unused variable (monkey/monkey_island/cc/models/monkey.py:59)
|
||||||
_.environment # unused attribute (monkey/monkey_island/cc/services/telemetry/processing/system_info_collectors/environment.py:10)
|
_.environment # unused attribute (monkey/monkey_island/cc/services/telemetry/processing/system_info_collectors/environment.py:10)
|
||||||
_.instance_name # unused attribute (monkey/common/cloud/azure/azure_instance.py:35)
|
_.instance_name # unused attribute (monkey/common/cloud/azure/azure_instance.py:35)
|
||||||
_.instance_name # unused attribute (monkey/common/cloud/azure/azure_instance.py:64)
|
_.instance_name # unused attribute (monkey/common/cloud/azure/azure_instance.py:64)
|
||||||
# TODO: Remove this when adding LINUX specific bb test
|
|
||||||
LINUX # unused variable (envs/monkey_zoo/blackbox/test_blackbox.py:56)
|
|
||||||
GCPHandler # unused function (envs/monkey_zoo/blackbox/test_blackbox.py:57)
|
GCPHandler # unused function (envs/monkey_zoo/blackbox/test_blackbox.py:57)
|
||||||
|
|
Loading…
Reference in New Issue