#1961: os scan set up

This commit is contained in:
Czar.Echavez
2023-10-27 10:17:59 +01:00
parent 091920c6f7
commit 8783574442
4 changed files with 69 additions and 6 deletions

View File

@@ -1,6 +1,9 @@
import pytest
from primaite.simulator.network.hardware.base import Node, NodeOperatingState
from primaite.simulator.system.processes.process import Process
from primaite.simulator.system.services.service import Service
from primaite.simulator.system.software import SoftwareHealthState
@pytest.fixture
@@ -39,3 +42,31 @@ def test_node_shutdown(node):
idx += 1
assert node.operating_state == NodeOperatingState.OFF
def test_node_os_scan(node):
"""Test OS Scanning."""
# add process to node
node.processes["process"] = Process(name="process")
node.processes["process"].health_state_actual = SoftwareHealthState.COMPROMISED
assert node.processes["process"].health_state_visible == SoftwareHealthState.GOOD
# add services to node
service = Service(name="service")
service.health_state_actual = SoftwareHealthState.COMPROMISED
node.install_service(service=service)
# add application to node
# add file to node
# run os scan
node.apply_request(["os", "scan"])
# apply time steps
for i in range(20):
node.apply_timestep(timestep=i)
# should update the state of all items
assert node.processes["process"].health_state_visible == SoftwareHealthState.COMPROMISED
assert service.health_state_visible == SoftwareHealthState.COMPROMISED