Merge pull request #1814 from guardicore/1801-fix-blackbox-tests

1801 fix blackbox tests
This commit is contained in:
Mike Salvatore 2022-03-25 07:18:22 -04:00 committed by GitHub
commit 4e489ad62b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 9 deletions

View File

@ -16,6 +16,6 @@ class PowerShellCredentialsReuse(ConfigTemplate):
"basic_network.scope.depth": 2,
"internal.classes.finger_classes": [],
"internal.network.tcp_scanner.HTTP_PORTS": [],
"internal.network.tcp_scanner.tcp_target_ports": [],
"internal.network.tcp_scanner.tcp_target_ports": [5985, 5986],
}
)

View File

@ -17,7 +17,7 @@ class Tunneling(ConfigTemplate):
"10.2.0.11",
],
"basic_network.scope.depth": 3,
"internal.general.keep_tunnel_open_time": 150,
"internal.general.keep_tunnel_open_time": 20,
"basic.credentials.exploit_password_list": [
"Password1!",
"3Q=(Ge(+&w]*",

View File

@ -1,6 +1,6 @@
import json
import logging
from time import sleep
import time
from typing import Union
from bson import json_util
@ -15,7 +15,7 @@ LOGGER = logging.getLogger(__name__)
def avoid_race_condition(func):
sleep(SLEEP_BETWEEN_REQUESTS_SECONDS)
time.sleep(SLEEP_BETWEEN_REQUESTS_SECONDS)
return func
@ -48,10 +48,15 @@ class MonkeyIslandClient(object):
@avoid_race_condition
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.")
else:
LOGGER.error("Failed to kill all monkeys.")
LOGGER.error(response.status_code)
LOGGER.error(response.content)
assert False
@avoid_race_condition

View File

@ -51,7 +51,7 @@ from envs.monkey_zoo.blackbox.utils.gcp_machine_handlers import (
)
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
LOG_DIR_PATH = "./logs"
logging.basicConfig(level=logging.INFO)
@ -186,12 +186,15 @@ class TestMonkeyBlackbox:
def test_smb_pth(self, island_client):
TestMonkeyBlackbox.run_exploitation_test(island_client, SmbPth, "SMB_PTH")
@pytest.mark.skip(reason="Drupal exploiter is deprecated")
def test_drupal_exploiter(self, island_client):
TestMonkeyBlackbox.run_exploitation_test(island_client, Drupal, "Drupal_exploiter")
@pytest.mark.skip(reason="Struts2 exploiter is deprecated")
def test_struts_exploiter(self, island_client):
TestMonkeyBlackbox.run_exploitation_test(island_client, Struts2, "Struts2_exploiter")
@pytest.mark.skip(reason="Weblogic exploiter is deprecated")
def test_weblogic_exploiter(self, island_client):
TestMonkeyBlackbox.run_exploitation_test(island_client, Weblogic, "Weblogic_exploiter")
@ -212,7 +215,7 @@ class TestMonkeyBlackbox:
def test_tunneling(self, island_client):
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):

View File

@ -6,8 +6,8 @@ from envs.monkey_zoo.blackbox.tests.basic_test import BasicTest
from envs.monkey_zoo.blackbox.utils.test_timer import TestTimer
MAX_TIME_FOR_MONKEYS_TO_DIE = 5 * 60
WAIT_TIME_BETWEEN_REQUESTS = 5
TIME_FOR_MONKEY_PROCESS_TO_FINISH = 10
WAIT_TIME_BETWEEN_REQUESTS = 1
TIME_FOR_MONKEY_PROCESS_TO_FINISH = 5
DELAY_BETWEEN_ANALYSIS = 3
LOGGER = logging.getLogger(__name__)