update more tests to new actions schema
This commit is contained in:
@@ -33,22 +33,22 @@ def test_application_cannot_perform_actions_unless_running(game_and_agent_fixtur
|
||||
browser.close()
|
||||
assert browser.operating_state == ApplicationOperatingState.CLOSED
|
||||
|
||||
action = ("node_application_scan", {"node_id": 0, "application_id": 0})
|
||||
action = ("node_application_scan", {"node_name": "client_1", "application_name": "WebBrowser"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert browser.operating_state == ApplicationOperatingState.CLOSED
|
||||
|
||||
action = ("node_application_close", {"node_id": 0, "application_id": 0})
|
||||
action = ("node_application_close", {"node_name": "client_1", "application_name": "WebBrowser"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert browser.operating_state == ApplicationOperatingState.CLOSED
|
||||
|
||||
action = ("node_application_fix", {"node_id": 0, "application_id": 0})
|
||||
action = ("node_application_fix", {"node_name": "client_1", "application_name": "WebBrowser"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert browser.operating_state == ApplicationOperatingState.CLOSED
|
||||
|
||||
action = ("node_application_execute", {"node_id": 0, "application_id": 0})
|
||||
action = ("node_application_execute", {"node_name": "client_1", "application_name": "WebBrowser"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert browser.operating_state == ApplicationOperatingState.CLOSED
|
||||
|
||||
@@ -47,7 +47,7 @@ def test_c2_beacon_default(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgen
|
||||
|
||||
action = (
|
||||
"node_application_install",
|
||||
{"node_id": 1, "application_name": "C2Beacon"},
|
||||
{"node_name": "server_1", "application_name": "C2Beacon"},
|
||||
)
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
@@ -56,13 +56,11 @@ def test_c2_beacon_default(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgen
|
||||
action = (
|
||||
"configure_c2_beacon",
|
||||
{
|
||||
"node_id": 1,
|
||||
"config": {
|
||||
"c2_server_ip_address": "10.0.1.2",
|
||||
"keep_alive_frequency": 5,
|
||||
"masquerade_protocol": "TCP",
|
||||
"masquerade_port": "HTTP",
|
||||
},
|
||||
"node_name": "server_1",
|
||||
"c2_server_ip_address": "10.0.1.2",
|
||||
"keep_alive_frequency": 5,
|
||||
"masquerade_protocol": "TCP",
|
||||
"masquerade_port": "HTTP",
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -71,7 +69,7 @@ def test_c2_beacon_default(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgen
|
||||
|
||||
action = (
|
||||
"node_application_execute",
|
||||
{"node_id": 1, "application_id": 0},
|
||||
{"node_name": "server_1", "application_name": "C2Beacon"},
|
||||
)
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
@@ -103,14 +101,12 @@ def test_c2_server_ransomware(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyA
|
||||
# C2 Action 1: Installing the RansomwareScript & Database client via Terminal
|
||||
|
||||
action = (
|
||||
"C2_SERVER_TERMINAL_COMMAND",
|
||||
"c2_server_terminal_command",
|
||||
{
|
||||
"node_id": 0,
|
||||
"node_name": "client_1",
|
||||
"ip_address": None,
|
||||
"account": {
|
||||
"username": "admin",
|
||||
"password": "admin",
|
||||
},
|
||||
"username": "admin",
|
||||
"password": "admin",
|
||||
"commands": [
|
||||
["software_manager", "application", "install", "RansomwareScript"],
|
||||
["software_manager", "application", "install", "DatabaseClient"],
|
||||
@@ -124,7 +120,7 @@ def test_c2_server_ransomware(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyA
|
||||
action = (
|
||||
"c2_server_ransomware_configure",
|
||||
{
|
||||
"node_id": 0,
|
||||
"node_name": "client_1",
|
||||
"config": {"server_ip_address": "10.0.2.3", "payload": "ENCRYPT"},
|
||||
},
|
||||
)
|
||||
@@ -143,7 +139,7 @@ def test_c2_server_ransomware(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyA
|
||||
action = (
|
||||
"c2_server_ransomware_launch",
|
||||
{
|
||||
"node_id": 0,
|
||||
"node_name": "client_1",
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -183,15 +179,13 @@ def test_c2_server_data_exfiltration(game_and_agent_fixture: Tuple[PrimaiteGame,
|
||||
action = (
|
||||
"c2_server_data_exfiltrate",
|
||||
{
|
||||
"node_id": 0,
|
||||
"node_name": "client_1",
|
||||
"target_file_name": "database.db",
|
||||
"target_folder_name": "database",
|
||||
"exfiltration_folder_name": "spoils",
|
||||
"target_ip_address": "10.0.2.3",
|
||||
"account": {
|
||||
"username": "admin",
|
||||
"password": "admin",
|
||||
},
|
||||
"username": "admin",
|
||||
"password": "admin",
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
|
||||
@@ -27,7 +27,6 @@ class TestConfigureDatabaseAction:
|
||||
def test_configure_ip_password(self, game_and_agent):
|
||||
game, agent = game_and_agent
|
||||
agent: ControlledAgent
|
||||
agent.action_manager.actions["configure_database_client"] = ConfigureDatabaseClientAction(agent.action_manager)
|
||||
|
||||
# make sure there is a database client on this node
|
||||
client_1 = game.simulation.network.get_node_by_hostname("client_1")
|
||||
@@ -38,10 +37,8 @@ class TestConfigureDatabaseAction:
|
||||
"configure_database_client",
|
||||
{
|
||||
"node_name": "client_1",
|
||||
"model_config": {
|
||||
"server_ip_address": "192.168.1.99",
|
||||
"server_password": "admin123",
|
||||
},
|
||||
"server_ip_address": "192.168.1.99",
|
||||
"server_password": "admin123",
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -53,7 +50,6 @@ class TestConfigureDatabaseAction:
|
||||
def test_configure_ip(self, game_and_agent):
|
||||
game, agent = game_and_agent
|
||||
agent: ControlledAgent
|
||||
agent.action_manager.actions["configure_database_client"] = ConfigureDatabaseClientAction(agent.action_manager)
|
||||
|
||||
# make sure there is a database client on this node
|
||||
client_1 = game.simulation.network.get_node_by_hostname("client_1")
|
||||
@@ -63,10 +59,8 @@ class TestConfigureDatabaseAction:
|
||||
action = (
|
||||
"configure_database_client",
|
||||
{
|
||||
"node_id": 0,
|
||||
"config": {
|
||||
"server_ip_address": "192.168.1.99",
|
||||
},
|
||||
"node_name": "client_1",
|
||||
"server_ip_address": "192.168.1.99",
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -78,7 +72,6 @@ class TestConfigureDatabaseAction:
|
||||
def test_configure_password(self, game_and_agent):
|
||||
game, agent = game_and_agent
|
||||
agent: ControlledAgent
|
||||
agent.action_manager.actions["configure_database_client"] = ConfigureDatabaseClientAction(agent.action_manager)
|
||||
|
||||
# make sure there is a database client on this node
|
||||
client_1 = game.simulation.network.get_node_by_hostname("client_1")
|
||||
@@ -89,10 +82,8 @@ class TestConfigureDatabaseAction:
|
||||
action = (
|
||||
"configure_database_client",
|
||||
{
|
||||
"node_id": 0,
|
||||
"config": {
|
||||
"server_password": "admin123",
|
||||
},
|
||||
"node_name": "client_1",
|
||||
"server_password": "admin123",
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -120,9 +111,6 @@ class TestConfigureRansomwareScriptAction:
|
||||
def test_configure_ip_password(self, game_and_agent, config):
|
||||
game, agent = game_and_agent
|
||||
agent: ControlledAgent
|
||||
agent.action_manager.actions["c2_server_ransomware_configure"] = ConfigureRansomwareScriptAction(
|
||||
agent.action_manager
|
||||
)
|
||||
|
||||
# make sure there is a database client on this node
|
||||
client_1 = game.simulation.network.get_node_by_hostname("client_1")
|
||||
@@ -135,7 +123,7 @@ class TestConfigureRansomwareScriptAction:
|
||||
|
||||
action = (
|
||||
"c2_server_ransomware_configure",
|
||||
{"node_id": 0, "config": config},
|
||||
{"node_name": "client_1", **config},
|
||||
)
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
@@ -151,9 +139,6 @@ class TestConfigureRansomwareScriptAction:
|
||||
def test_invalid_config(self, game_and_agent):
|
||||
game, agent = game_and_agent
|
||||
agent: ControlledAgent
|
||||
agent.action_manager.actions["c2_server_ransomware_configure"] = ConfigureRansomwareScriptAction(
|
||||
agent.action_manager
|
||||
)
|
||||
|
||||
# make sure there is a database client on this node
|
||||
client_1 = game.simulation.network.get_node_by_hostname("client_1")
|
||||
@@ -162,7 +147,7 @@ class TestConfigureRansomwareScriptAction:
|
||||
action = (
|
||||
"c2_server_ransomware_configure",
|
||||
{
|
||||
"node_id": 0,
|
||||
"node_name": "client_1",
|
||||
"config": {"server_password": "admin123", "bad_option": 70},
|
||||
},
|
||||
)
|
||||
@@ -175,7 +160,6 @@ class TestConfigureDoSBot:
|
||||
def test_configure_dos_bot(self, game_and_agent):
|
||||
game, agent = game_and_agent
|
||||
agent: ControlledAgent
|
||||
agent.action_manager.actions["configure_dos_bot"] = ConfigureDoSBotAction(agent.action_manager)
|
||||
|
||||
client_1 = game.simulation.network.get_node_by_hostname("client_1")
|
||||
client_1.software_manager.install(DoSBot)
|
||||
@@ -184,16 +168,14 @@ class TestConfigureDoSBot:
|
||||
action = (
|
||||
"configure_dos_bot",
|
||||
{
|
||||
"node_id": 0,
|
||||
"config": {
|
||||
"target_ip_address": "192.168.1.99",
|
||||
"target_port": "POSTGRES_SERVER",
|
||||
"payload": "HACC",
|
||||
"repeat": False,
|
||||
"port_scan_p_of_success": 0.875,
|
||||
"dos_intensity": 0.75,
|
||||
"max_sessions": 50,
|
||||
},
|
||||
"node_name": "client_1",
|
||||
"target_ip_address": "192.168.1.99",
|
||||
"target_port": "POSTGRES_SERVER",
|
||||
"payload": "HACC",
|
||||
"repeat": False,
|
||||
"port_scan_p_of_success": 0.875,
|
||||
"dos_intensity": 0.75,
|
||||
"max_sessions": 50,
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
|
||||
@@ -34,7 +34,7 @@ def test_create_file(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgent]):
|
||||
|
||||
action = (
|
||||
"node_file_create",
|
||||
{"node_id": 0, "folder_name": random_folder, "file_name": random_file},
|
||||
{"node_name": "client_1", "folder_name": random_folder, "file_name": random_file},
|
||||
)
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
@@ -52,7 +52,7 @@ def test_file_delete_action(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAge
|
||||
|
||||
action = (
|
||||
"node_file_delete",
|
||||
{"node_id": 0, "folder_id": 0, "file_id": 0},
|
||||
{"node_name": "client_1", "folder_name": "downloads", "file_name": "cat.png"},
|
||||
)
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
@@ -73,7 +73,7 @@ def test_file_scan_action(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgent
|
||||
|
||||
action = (
|
||||
"node_file_scan",
|
||||
{"node_id": 0, "folder_id": 0, "file_id": 0},
|
||||
{"node_name": "client_1", "folder_name": "downloads", "file_name": "cat.png"},
|
||||
)
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
@@ -94,7 +94,7 @@ def test_file_repair_action(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAge
|
||||
|
||||
action = (
|
||||
"node_file_repair",
|
||||
{"node_id": 0, "folder_id": 0, "file_id": 0},
|
||||
{"node_name": "client_1", "folder_name": "downloads", "file_name": "cat.png"},
|
||||
)
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
@@ -114,7 +114,7 @@ def test_file_restore_action(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAg
|
||||
|
||||
action = (
|
||||
"node_file_restore",
|
||||
{"node_id": 0, "folder_id": 0, "file_id": 0},
|
||||
{"node_name": "client_1", "folder_name": "downloads", "file_name": "cat.png"},
|
||||
)
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
@@ -133,7 +133,7 @@ def test_file_corrupt_action(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAg
|
||||
|
||||
action = (
|
||||
"node_file_corrupt",
|
||||
{"node_id": 0, "folder_id": 0, "file_id": 0},
|
||||
{"node_name": "client_1", "folder_name": "downloads", "file_name": "cat.png"},
|
||||
)
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
@@ -151,7 +151,7 @@ def test_file_access_action(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAge
|
||||
|
||||
action = (
|
||||
"node_file_access",
|
||||
{"node_id": 0, "folder_name": file.folder_name, "file_name": file.name},
|
||||
{"node_name": "client_1", "folder_name": file.folder_name, "file_name": file.name},
|
||||
)
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
|
||||
@@ -34,7 +34,7 @@ def test_create_folder(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgent]):
|
||||
action = (
|
||||
"node_folder_create",
|
||||
{
|
||||
"node_id": 0,
|
||||
"node_name": "client_1",
|
||||
"folder_name": random_folder,
|
||||
},
|
||||
)
|
||||
@@ -62,8 +62,8 @@ def test_folder_scan_action(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAge
|
||||
action = (
|
||||
"node_folder_scan",
|
||||
{
|
||||
"node_id": 0, # client_1,
|
||||
"folder_id": 0, # downloads
|
||||
"node_name": "client_1", # client_1,
|
||||
"folder_name": "downloads", # downloads
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -89,8 +89,8 @@ def test_folder_repair_action(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyA
|
||||
action = (
|
||||
"node_folder_repair",
|
||||
{
|
||||
"node_id": 0, # client_1,
|
||||
"folder_id": 0, # downloads
|
||||
"node_name": "client_1", # client_1,
|
||||
"folder_name": "downloads", # downloads
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -113,8 +113,8 @@ def test_folder_restore_action(game_and_agent_fixture: Tuple[PrimaiteGame, Proxy
|
||||
action = (
|
||||
"node_folder_restore",
|
||||
{
|
||||
"node_id": 0, # client_1,
|
||||
"folder_id": 0, # downloads
|
||||
"node_name": "client_1", # client_1,
|
||||
"folder_name": "downloads", # downloads
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
|
||||
@@ -31,8 +31,8 @@ def test_nic_cannot_be_turned_off_if_not_on(game_and_agent_fixture: Tuple[Primai
|
||||
action = (
|
||||
"host_nic_disable",
|
||||
{
|
||||
"node_id": 0, # client_1
|
||||
"nic_id": 0, # the only nic (eth-1)
|
||||
"node_name": "client_1", # client_1
|
||||
"nic_num": 1, # the only nic (eth-1)
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -52,8 +52,8 @@ def test_nic_cannot_be_turned_on_if_already_on(game_and_agent_fixture: Tuple[Pri
|
||||
action = (
|
||||
"host_nic_enable",
|
||||
{
|
||||
"node_id": 0, # client_1
|
||||
"nic_id": 0, # the only nic (eth-1)
|
||||
"node_name": "client_1", # client_1
|
||||
"nic_num": 1, # the only nic (eth-1)
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -73,8 +73,8 @@ def test_that_a_nic_can_be_enabled_and_disabled(game_and_agent_fixture: Tuple[Pr
|
||||
action = (
|
||||
"host_nic_disable",
|
||||
{
|
||||
"node_id": 0, # client_1
|
||||
"nic_id": 0, # the only nic (eth-1)
|
||||
"node_name": "client_1", # client_1
|
||||
"nic_num": 1, # the only nic (eth-1)
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -85,8 +85,8 @@ def test_that_a_nic_can_be_enabled_and_disabled(game_and_agent_fixture: Tuple[Pr
|
||||
action = (
|
||||
"host_nic_enable",
|
||||
{
|
||||
"node_id": 0, # client_1
|
||||
"nic_id": 0, # the only nic (eth-1)
|
||||
"node_name": "client_1", # client_1
|
||||
"nic_num": 1, # the only nic (eth-1)
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
|
||||
@@ -29,28 +29,28 @@ def test_node_startup_shutdown(game_and_agent_fixture: Tuple[PrimaiteGame, Proxy
|
||||
assert client_1.operating_state == NodeOperatingState.ON
|
||||
|
||||
# turn it off
|
||||
action = ("node_shutdown", {"node_id": 0})
|
||||
action = ("node_shutdown", {"node_name": "client_1"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
|
||||
assert client_1.operating_state == NodeOperatingState.SHUTTING_DOWN
|
||||
|
||||
for i in range(client_1.shut_down_duration + 1):
|
||||
action = ("do_nothing", {"node_id": 0})
|
||||
action = ("do_nothing", {})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
|
||||
assert client_1.operating_state == NodeOperatingState.OFF
|
||||
|
||||
# turn it on
|
||||
action = ("node_startup", {"node_id": 0})
|
||||
action = ("node_startup", {"node_name": "client_1"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
|
||||
assert client_1.operating_state == NodeOperatingState.BOOTING
|
||||
|
||||
for i in range(client_1.start_up_duration + 1):
|
||||
action = ("do_nothing", {"node_id": 0})
|
||||
action = ("do_nothing", {})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
|
||||
@@ -65,7 +65,7 @@ def test_node_cannot_be_started_up_if_node_is_already_on(game_and_agent_fixture:
|
||||
assert client_1.operating_state == NodeOperatingState.ON
|
||||
|
||||
# turn it on
|
||||
action = ("node_startup", {"node_id": 0})
|
||||
action = ("node_startup", {"node_name": "client_1"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
|
||||
@@ -80,14 +80,14 @@ def test_node_cannot_be_shut_down_if_node_is_already_off(game_and_agent_fixture:
|
||||
client_1.power_off()
|
||||
|
||||
for i in range(client_1.shut_down_duration + 1):
|
||||
action = ("do_nothing", {"node_id": 0})
|
||||
action = ("do_nothing", {})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
|
||||
assert client_1.operating_state == NodeOperatingState.OFF
|
||||
|
||||
# turn it ff
|
||||
action = ("node_shutdown", {"node_id": 0})
|
||||
action = ("node_shutdown", {"node_name": "client_1"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ def test_service_start(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgent]):
|
||||
dns_server.pause()
|
||||
assert dns_server.operating_state == ServiceOperatingState.PAUSED
|
||||
|
||||
action = ("node_service_start", {"node_id": 1, "service_id": 0})
|
||||
action = ("node_service_start", {"node_name": "server_1", "service_name": "DNSServer"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert dns_server.operating_state == ServiceOperatingState.PAUSED
|
||||
@@ -40,7 +40,7 @@ def test_service_start(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgent]):
|
||||
|
||||
assert dns_server.operating_state == ServiceOperatingState.STOPPED
|
||||
|
||||
action = ("node_service_start", {"node_id": 1, "service_id": 0})
|
||||
action = ("node_service_start", {"node_name": "server_1", "service_name": "DNSServer"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
|
||||
@@ -54,7 +54,7 @@ def test_service_resume(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgent])
|
||||
server_1: Server = game.simulation.network.get_node_by_hostname("server_1")
|
||||
dns_server = server_1.software_manager.software.get("DNSServer")
|
||||
|
||||
action = ("node_service_resume", {"node_id": 1, "service_id": 0})
|
||||
action = ("node_service_resume", {"node_name": "server_1", "service_name": "DNSServer"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert dns_server.operating_state == ServiceOperatingState.RUNNING
|
||||
@@ -63,7 +63,7 @@ def test_service_resume(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgent])
|
||||
|
||||
assert dns_server.operating_state == ServiceOperatingState.PAUSED
|
||||
|
||||
action = ("node_service_resume", {"node_id": 1, "service_id": 0})
|
||||
action = ("node_service_resume", {"node_name": "server_1", "service_name": "DNSServer"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
|
||||
@@ -80,27 +80,27 @@ def test_service_cannot_perform_actions_unless_running(game_and_agent_fixture: T
|
||||
dns_server.stop()
|
||||
assert dns_server.operating_state == ServiceOperatingState.STOPPED
|
||||
|
||||
action = ("node_service_scan", {"node_id": 1, "service_id": 0})
|
||||
action = ("node_service_scan", {"node_name": "server_1", "service_name": "DNSServer"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert dns_server.operating_state == ServiceOperatingState.STOPPED
|
||||
|
||||
action = ("node_service_pause", {"node_id": 1, "service_id": 0})
|
||||
action = ("node_service_pause", {"node_name": "server_1", "service_name": "DNSServer"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert dns_server.operating_state == ServiceOperatingState.STOPPED
|
||||
|
||||
action = ("node_service_resume", {"node_id": 1, "service_id": 0})
|
||||
action = ("node_service_resume", {"node_name": "server_1", "service_name": "DNSServer"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert dns_server.operating_state == ServiceOperatingState.STOPPED
|
||||
|
||||
action = ("node_service_restart", {"node_id": 1, "service_id": 0})
|
||||
action = ("node_service_restart", {"node_name": "server_1", "service_name": "DNSServer"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert dns_server.operating_state == ServiceOperatingState.STOPPED
|
||||
|
||||
action = ("node_service_fix", {"node_id": 1, "service_id": 0})
|
||||
action = ("node_service_fix", {"node_name": "server_1", "service_name": "DNSServer"})
|
||||
agent.store_action(action)
|
||||
game.step()
|
||||
assert dns_server.operating_state == ServiceOperatingState.STOPPED
|
||||
|
||||
@@ -36,9 +36,9 @@ def test_remote_login(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgent]):
|
||||
server_1_usm.add_user("user123", "password", is_admin=True)
|
||||
|
||||
action = (
|
||||
"SSH_TO_REMOTE",
|
||||
"node_session_remote_login",
|
||||
{
|
||||
"node_id": 0,
|
||||
"node_name": "client_1",
|
||||
"username": "user123",
|
||||
"password": "password",
|
||||
"remote_ip": str(server_1.network_interface[1].ip_address),
|
||||
@@ -68,9 +68,9 @@ def test_remote_login_wrong_password(game_and_agent_fixture: Tuple[PrimaiteGame,
|
||||
server_1_usm.add_user("user123", "password", is_admin=True)
|
||||
|
||||
action = (
|
||||
"SSH_TO_REMOTE",
|
||||
"node_session_remote_login",
|
||||
{
|
||||
"node_id": 0,
|
||||
"node_name": "client_1",
|
||||
"username": "user123",
|
||||
"password": "wrong_password",
|
||||
"remote_ip": str(server_1.network_interface[1].ip_address),
|
||||
@@ -100,12 +100,13 @@ def test_remote_login_change_password(game_and_agent_fixture: Tuple[PrimaiteGame
|
||||
server_1_um.add_user("user123", "password", is_admin=True)
|
||||
|
||||
action = (
|
||||
"node_accounts_change_password",
|
||||
"node_account_change_password",
|
||||
{
|
||||
"node_id": 1, # server_1
|
||||
"node_name": "server_1", # server_1
|
||||
"username": "user123",
|
||||
"current_password": "password",
|
||||
"new_password": "different_password",
|
||||
"remote_ip": str(server_1.network_interface[1].ip_address),
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -126,9 +127,9 @@ def test_change_password_logs_out_user(game_and_agent_fixture: Tuple[PrimaiteGam
|
||||
|
||||
# Log in remotely
|
||||
action = (
|
||||
"SSH_TO_REMOTE",
|
||||
"node_session_remote_login",
|
||||
{
|
||||
"node_id": 0,
|
||||
"node_name": "client_1",
|
||||
"username": "user123",
|
||||
"password": "password",
|
||||
"remote_ip": str(server_1.network_interface[1].ip_address),
|
||||
@@ -139,12 +140,13 @@ def test_change_password_logs_out_user(game_and_agent_fixture: Tuple[PrimaiteGam
|
||||
|
||||
# Change password
|
||||
action = (
|
||||
"node_accounts_change_password",
|
||||
"node_account_change_password",
|
||||
{
|
||||
"node_id": 1, # server_1
|
||||
"node_name": "server_1", # server_1
|
||||
"username": "user123",
|
||||
"current_password": "password",
|
||||
"new_password": "different_password",
|
||||
"remote_ip": str(server_1.network_interface[1].ip_address),
|
||||
},
|
||||
)
|
||||
agent.store_action(action)
|
||||
@@ -154,7 +156,7 @@ def test_change_password_logs_out_user(game_and_agent_fixture: Tuple[PrimaiteGam
|
||||
action = (
|
||||
"node_send_remote_command",
|
||||
{
|
||||
"node_id": 0,
|
||||
"node_name": "client_1",
|
||||
"remote_ip": str(server_1.network_interface[1].ip_address),
|
||||
"command": ["file_system", "create", "file", "folder123", "doggo.pdf", False],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user