Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions AIDojoCoordinator/scenarios/scenario_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
active_services=[],
passive_services=[
cyst_cfg.PassiveServiceConfig(
name="microsoft-ds",
name="445/tcp, microsoft-ds",
owner="Local system",
version="10.0.19041",
local=False,
Expand Down Expand Up @@ -69,7 +69,7 @@
]
),
cyst_cfg.PassiveServiceConfig(
name="ms-wbt-server",
name="3389/tcp, ms-wbt-server",
owner="Local system",
version="10.0.19041",
local=False,
Expand Down Expand Up @@ -133,7 +133,7 @@
active_services=[],
passive_services=[
cyst_cfg.PassiveServiceConfig(
name="ssh",
name="22/tcp, ssh",
owner="openssh",
version="8.1.0",
local=False,
Expand All @@ -159,7 +159,7 @@
)]
),
cyst_cfg.PassiveServiceConfig(
name="postgresql",
name="5432/tcp, postgresql",
owner="postgresql",
version="14.3.0",
private_data=[
Expand Down Expand Up @@ -199,7 +199,7 @@
active_services=[],
passive_services=[
cyst_cfg.PassiveServiceConfig(
name="http",
name="80/tcp, http",
owner="lighttpd",
version="1.4.54",
local=False,
Expand All @@ -216,7 +216,7 @@
access_schemes=[]
),
cyst_cfg.PassiveServiceConfig(
name="ssh",
name="22/tcp, ssh",
owner="openssh",
version="8.1.0",
local=False,
Expand Down Expand Up @@ -266,7 +266,7 @@
active_services=[],
passive_services=[
cyst_cfg.PassiveServiceConfig(
name="ssh",
name="22/tcp, ssh",
owner="openssh",
version="8.1.0",
local=False,
Expand Down Expand Up @@ -311,7 +311,7 @@
active_services=[],
passive_services=[
cyst_cfg.PassiveServiceConfig(
name="ssh",
name="22/tcp, ssh",
owner="openssh",
version="8.1.0",
local=False,
Expand Down Expand Up @@ -367,7 +367,7 @@
],
passive_services=[
cyst_cfg.PassiveServiceConfig(
name="ms-wbt-server",
name="3389/tcp, ms-wbt-server",
owner="Local system",
version="10.0.19041",
local=False,
Expand Down Expand Up @@ -424,7 +424,7 @@
active_services=[],
passive_services=[
cyst_cfg.PassiveServiceConfig(
name="ms-wbt-server",
name="3389/tcp, ms-wbt-server",
owner="Local system",
version="10.0.19041",
local=False,
Expand Down Expand Up @@ -481,7 +481,7 @@
active_services=[],
passive_services=[
cyst_cfg.PassiveServiceConfig(
name="ssh",
name="22/tcp, ssh",
owner="openssh",
version="8.1.0",
local=False,
Expand Down Expand Up @@ -536,7 +536,7 @@
active_services=[],
passive_services=[
cyst_cfg.PassiveServiceConfig(
name="ssh",
name="22/tcp, ssh",
owner="openssh",
version="8.1.0",
local=False,
Expand Down Expand Up @@ -754,7 +754,7 @@
ExploitConfig(
services=[
VulnerableServiceConfig(
service="microsoft-ds",
service="445/tcp, microsoft-ds",
min_version="10.0. 19041",
max_version="10.0.19041"
)
Expand Down
14 changes: 12 additions & 2 deletions AIDojoCoordinator/utils/log_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ def calculate_episode_lengths(step_sequence):
Given the list with step numbers calculate
the length of each episode and return a list of episode lengths.
"""
if not step_sequence:
return []

episode_lengths = []
for i in range(1, len(step_sequence)):
if step_seq[i] == 0:
if step_sequence[i] == 0:
# If the step is zero then it's a new episode
# Take the last value as episode length
episode_lengths.append(step_sequence[i - 1] + 1)
# For the last episode take the latest step value
episode_lengths.append(step_sequence[-1] + 1)
if step_sequence: # Only append if we have steps
episode_lengths.append(step_sequence[-1] + 1)
return episode_lengths

def reached_limit(current_step, max_steps, invalid_steps):
Expand Down Expand Up @@ -131,6 +135,12 @@ def reached_limit(current_step, max_steps, invalid_steps):
print(f"Episodes: {len(episode_starts)}")
print(f"Wins: {total_wins}")
print(f"Detections: {total_detected}")

# Add validation for when no episodes were found
if len(episode_starts) == 0:
print("No episodes found in the log file.")
exit(0)

print(f"Win rate: {100*total_wins/len(episode_starts):.3f}%")
print(f"Detection rate: {100*total_detected/len(episode_starts):.3f}%")
print(f"Average return: {np.mean(rewards):.3f} +- {np.std(rewards):.3f}")
Expand Down