Merge pull request #1814 from guardicore/1801-fix-blackbox-tests
1801 fix blackbox tests
This commit is contained in:
commit
4e489ad62b
|
@ -16,6 +16,6 @@ class PowerShellCredentialsReuse(ConfigTemplate):
|
||||||
"basic_network.scope.depth": 2,
|
"basic_network.scope.depth": 2,
|
||||||
"internal.classes.finger_classes": [],
|
"internal.classes.finger_classes": [],
|
||||||
"internal.network.tcp_scanner.HTTP_PORTS": [],
|
"internal.network.tcp_scanner.HTTP_PORTS": [],
|
||||||
"internal.network.tcp_scanner.tcp_target_ports": [],
|
"internal.network.tcp_scanner.tcp_target_ports": [5985, 5986],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Tunneling(ConfigTemplate):
|
||||||
"10.2.0.11",
|
"10.2.0.11",
|
||||||
],
|
],
|
||||||
"basic_network.scope.depth": 3,
|
"basic_network.scope.depth": 3,
|
||||||
"internal.general.keep_tunnel_open_time": 150,
|
"internal.general.keep_tunnel_open_time": 20,
|
||||||
"basic.credentials.exploit_password_list": [
|
"basic.credentials.exploit_password_list": [
|
||||||
"Password1!",
|
"Password1!",
|
||||||
"3Q=(Ge(+&w]*",
|
"3Q=(Ge(+&w]*",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from time import sleep
|
import time
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from bson import json_util
|
from bson import json_util
|
||||||
|
@ -15,7 +15,7 @@ LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def avoid_race_condition(func):
|
def avoid_race_condition(func):
|
||||||
sleep(SLEEP_BETWEEN_REQUESTS_SECONDS)
|
time.sleep(SLEEP_BETWEEN_REQUESTS_SECONDS)
|
||||||
return func
|
return func
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,10 +48,15 @@ class MonkeyIslandClient(object):
|
||||||
|
|
||||||
@avoid_race_condition
|
@avoid_race_condition
|
||||||
def kill_all_monkeys(self):
|
def kill_all_monkeys(self):
|
||||||
if self.requests.get("api", {"action": "killall"}).ok:
|
response = self.requests.post_json(
|
||||||
|
"api/monkey_control/stop-all-agents", data={"kill_time": time.time()}
|
||||||
|
)
|
||||||
|
if response.ok:
|
||||||
LOGGER.info("Killing all monkeys after the test.")
|
LOGGER.info("Killing all monkeys after the test.")
|
||||||
else:
|
else:
|
||||||
LOGGER.error("Failed to kill all monkeys.")
|
LOGGER.error("Failed to kill all monkeys.")
|
||||||
|
LOGGER.error(response.status_code)
|
||||||
|
LOGGER.error(response.content)
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
@avoid_race_condition
|
@avoid_race_condition
|
||||||
|
|
|
@ -51,7 +51,7 @@ from envs.monkey_zoo.blackbox.utils.gcp_machine_handlers import (
|
||||||
)
|
)
|
||||||
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
||||||
|
|
||||||
DEFAULT_TIMEOUT_SECONDS = 5 * 60
|
DEFAULT_TIMEOUT_SECONDS = 2 * 60
|
||||||
MACHINE_BOOTUP_WAIT_SECONDS = 30
|
MACHINE_BOOTUP_WAIT_SECONDS = 30
|
||||||
LOG_DIR_PATH = "./logs"
|
LOG_DIR_PATH = "./logs"
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
@ -186,12 +186,15 @@ class TestMonkeyBlackbox:
|
||||||
def test_smb_pth(self, island_client):
|
def test_smb_pth(self, island_client):
|
||||||
TestMonkeyBlackbox.run_exploitation_test(island_client, SmbPth, "SMB_PTH")
|
TestMonkeyBlackbox.run_exploitation_test(island_client, SmbPth, "SMB_PTH")
|
||||||
|
|
||||||
|
@pytest.mark.skip(reason="Drupal exploiter is deprecated")
|
||||||
def test_drupal_exploiter(self, island_client):
|
def test_drupal_exploiter(self, island_client):
|
||||||
TestMonkeyBlackbox.run_exploitation_test(island_client, Drupal, "Drupal_exploiter")
|
TestMonkeyBlackbox.run_exploitation_test(island_client, Drupal, "Drupal_exploiter")
|
||||||
|
|
||||||
|
@pytest.mark.skip(reason="Struts2 exploiter is deprecated")
|
||||||
def test_struts_exploiter(self, island_client):
|
def test_struts_exploiter(self, island_client):
|
||||||
TestMonkeyBlackbox.run_exploitation_test(island_client, Struts2, "Struts2_exploiter")
|
TestMonkeyBlackbox.run_exploitation_test(island_client, Struts2, "Struts2_exploiter")
|
||||||
|
|
||||||
|
@pytest.mark.skip(reason="Weblogic exploiter is deprecated")
|
||||||
def test_weblogic_exploiter(self, island_client):
|
def test_weblogic_exploiter(self, island_client):
|
||||||
TestMonkeyBlackbox.run_exploitation_test(island_client, Weblogic, "Weblogic_exploiter")
|
TestMonkeyBlackbox.run_exploitation_test(island_client, Weblogic, "Weblogic_exploiter")
|
||||||
|
|
||||||
|
@ -212,7 +215,7 @@ class TestMonkeyBlackbox:
|
||||||
|
|
||||||
def test_tunneling(self, island_client):
|
def test_tunneling(self, island_client):
|
||||||
TestMonkeyBlackbox.run_exploitation_test(
|
TestMonkeyBlackbox.run_exploitation_test(
|
||||||
island_client, Tunneling, "Tunneling_exploiter", 15 * 60
|
island_client, Tunneling, "Tunneling_exploiter", 3 * 60
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_wmi_and_mimikatz_exploiters(self, island_client):
|
def test_wmi_and_mimikatz_exploiters(self, island_client):
|
||||||
|
|
|
@ -6,8 +6,8 @@ from envs.monkey_zoo.blackbox.tests.basic_test import BasicTest
|
||||||
from envs.monkey_zoo.blackbox.utils.test_timer import TestTimer
|
from envs.monkey_zoo.blackbox.utils.test_timer import TestTimer
|
||||||
|
|
||||||
MAX_TIME_FOR_MONKEYS_TO_DIE = 5 * 60
|
MAX_TIME_FOR_MONKEYS_TO_DIE = 5 * 60
|
||||||
WAIT_TIME_BETWEEN_REQUESTS = 5
|
WAIT_TIME_BETWEEN_REQUESTS = 1
|
||||||
TIME_FOR_MONKEY_PROCESS_TO_FINISH = 10
|
TIME_FOR_MONKEY_PROCESS_TO_FINISH = 5
|
||||||
DELAY_BETWEEN_ANALYSIS = 3
|
DELAY_BETWEEN_ANALYSIS = 3
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue