mal-simulator 3.3.0__tar.gz → 3.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mal_simulator-3.3.0/mal_simulator.egg-info → mal_simulator-3.3.1}/PKG-INFO +1 -1
- {mal_simulator-3.3.0 → mal_simulator-3.3.1/mal_simulator.egg-info}/PKG-INFO +1 -1
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/__init__.py +2 -2
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/dyna_mal_simulator/process_assoc_traversal.py +6 -3
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/attack_surface.py +5 -3
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/scenario/scenario.py +2 -3
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/pyproject.toml +6 -1
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/tests/test_dyna_mal_simulator.py +36 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/AUTHORS +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/LICENSE +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/README.md +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/mal_simulator.egg-info/SOURCES.txt +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/mal_simulator.egg-info/dependency_links.txt +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/mal_simulator.egg-info/entry_points.txt +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/mal_simulator.egg-info/requires.txt +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/mal_simulator.egg-info/top_level.txt +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/__main__.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/config/__init__.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/config/agent_settings.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/config/agent_settings_factories.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/config/node_property_rule.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/config/sim_settings.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/dyna_mal_simulator/__init__.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/dyna_mal_simulator/attacker_step.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/dyna_mal_simulator/defender_step.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/dyna_mal_simulator/graph_state.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/dyna_mal_simulator/model_effects.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/dyna_mal_simulator/model_state.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/dyna_mal_simulator/simulator.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/dyna_mal_simulator/simulator_state.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/envs/__init__.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/envs/base_classes.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/envs/graph/__init__.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/envs/graph/graph_env.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/envs/graph/mal_spaces.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/envs/graph/serialization.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/envs/graph/utils.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/envs/graph/wrapper.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/__init__.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/agent_state.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/agent_states.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/attacker_state.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/attacker_state_factories.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/attacker_step.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/defender_state.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/defender_state_factories.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/defender_step.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/defense_surface.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/event_logger.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/false_alerts.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/graph_processing.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/graph_state.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/graph_utils.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/node_getters.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/observability.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/reset_agent.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/rewards.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/run_simulation.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/simulator.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/simulator_state.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/simulator_static_data.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/state_query.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/ttc_utils.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/__init__.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/attackers/__init__.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/attackers/searchers.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/attackers/shortest_path.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/attackers/ttc_soft_min.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/decision_agent.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/defenders/__init__.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/defenders/heuristic_agent.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/keyboard_input.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/passive_agent.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/random_agent.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/policies/utils/path_finding.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/scenario/__init__.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/types.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/visualization/malsim_gui_client.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/setup.cfg +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/tests/test_attacker.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/tests/test_attacker_settings.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/tests/test_defender.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/tests/test_event_logger.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/tests/test_graph_processing.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/tests/test_main.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/tests/test_mal_simulator.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/tests/test_scenario.py +0 -0
- {mal_simulator-3.3.0 → mal_simulator-3.3.1}/tests/test_ttc_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mal-simulator
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.1
|
|
4
4
|
Summary: A MAL compliant simulator.
|
|
5
5
|
Author-email: Andrei Buhaiu <buhaiu@kth.se>, Joakim Loxdal <loxdal@kth.se>, Jakob Nyberg <jaknyb@kth.se>, Nikolaos Kakouros <nkak@kth.se>, Sandor Berglund <sandorb@kth.se>
|
|
6
6
|
License: Apache Software License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mal-simulator
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.1
|
|
4
4
|
Summary: A MAL compliant simulator.
|
|
5
5
|
Author-email: Andrei Buhaiu <buhaiu@kth.se>, Joakim Loxdal <loxdal@kth.se>, Jakob Nyberg <jaknyb@kth.se>, Nikolaos Kakouros <nkak@kth.se>, Sandor Berglund <sandorb@kth.se>
|
|
6
6
|
License: Apache Software License
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# MAL Simulator v3.3.
|
|
1
|
+
# MAL Simulator v3.3.1
|
|
2
2
|
# Copyright 2025, Andrei Buhaiu.
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -26,7 +26,7 @@ from malsim.scenario import Scenario
|
|
|
26
26
|
from malsim.config import AttackerSettings, DefenderSettings
|
|
27
27
|
|
|
28
28
|
__title__ = 'malsim'
|
|
29
|
-
__version__ = '3.3.
|
|
29
|
+
__version__ = '3.3.1'
|
|
30
30
|
__authors__ = [
|
|
31
31
|
'Andrei Buhaiu',
|
|
32
32
|
'Joakim Loxdal',
|
{mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/dyna_mal_simulator/process_assoc_traversal.py
RENAMED
|
@@ -288,9 +288,12 @@ def parse_removal(
|
|
|
288
288
|
f'Node {node.name} does not have a model asset, '
|
|
289
289
|
'so cannot traverse to self.'
|
|
290
290
|
)
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
if asset == node.model_asset:
|
|
292
|
+
removals.add((asset, assoc_traversal.field_name, node.model_asset))
|
|
293
|
+
else:
|
|
294
|
+
for field_name, assed_assets in asset.associated_assets.items():
|
|
295
|
+
if node.model_asset in assed_assets:
|
|
296
|
+
removals.add((asset, field_name, node.model_asset))
|
|
294
297
|
|
|
295
298
|
removal_candidates = asset.associated_assets.get(
|
|
296
299
|
assoc_traversal.field_name, set()
|
|
@@ -30,9 +30,11 @@ def get_effects_of_attack_step(
|
|
|
30
30
|
while potential_effects:
|
|
31
31
|
effect = potential_effects.popleft()
|
|
32
32
|
has_visited = performed | set(effects)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
|
|
34
|
+
if (
|
|
35
|
+
effect not in has_visited
|
|
36
|
+
or not sim_state.settings.attack_surface.skip_compromised
|
|
37
|
+
) and node_is_traversable(sim_state, has_visited, effect):
|
|
36
38
|
effects.add(effect)
|
|
37
39
|
potential_effects += (
|
|
38
40
|
n for n in effect.children if n.causal_mode == 'effect'
|
|
@@ -213,9 +213,8 @@ def _validate_scenario_dict(scenario_dict: dict[str, Any]) -> None:
|
|
|
213
213
|
raise RuntimeError(
|
|
214
214
|
f"Only one of '{key_or_keys}' is allowed in scenario file"
|
|
215
215
|
)
|
|
216
|
-
elif isinstance(key_or_keys, str):
|
|
217
|
-
|
|
218
|
-
raise RuntimeError(f"Setting '{key_or_keys}' required in scenario file")
|
|
216
|
+
elif isinstance(key_or_keys, str) and key_or_keys not in scenario_dict:
|
|
217
|
+
raise RuntimeError(f"Setting '{key_or_keys}' required in scenario file")
|
|
219
218
|
|
|
220
219
|
|
|
221
220
|
def path_relative_to_file_dir(rel_path: str, file: TextIO) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mal-simulator"
|
|
3
|
-
version = "3.3.
|
|
3
|
+
version = "3.3.1"
|
|
4
4
|
authors = [
|
|
5
5
|
{ name="Andrei Buhaiu", email="buhaiu@kth.se" },
|
|
6
6
|
{ name="Joakim Loxdal", email="loxdal@kth.se" },
|
|
@@ -62,6 +62,11 @@ include = ["malsim*"]
|
|
|
62
62
|
|
|
63
63
|
[tool.pytest.ini_options]
|
|
64
64
|
pythonpath = ['.']
|
|
65
|
+
filterwarnings = [
|
|
66
|
+
"ignore:.*Overriding environment.*",
|
|
67
|
+
"ignore:.*to numpy array.*"
|
|
68
|
+
]
|
|
69
|
+
markers = ["integration: deselected during CI"]
|
|
65
70
|
|
|
66
71
|
[tool.mypy]
|
|
67
72
|
strict = true
|
|
@@ -1046,3 +1046,39 @@ def test_no_memory_growth_over_repeated_simulations() -> None:
|
|
|
1046
1046
|
'after repeatedly running independent simulations - this suggests a '
|
|
1047
1047
|
'memory leak in DynaMalSimulator'
|
|
1048
1048
|
)
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
def test_repeated_effects() -> None:
|
|
1052
|
+
"""Check that when a dynamic effect is performed on an effect,
|
|
1053
|
+
that this happens repeatedly when skip_compromised = false
|
|
1054
|
+
"""
|
|
1055
|
+
top = 'tests/testdata/scenarios/dynamal_example_scenarios/basic/'
|
|
1056
|
+
scenario_file_path = top + 'repeat_effect_scenario.yml'
|
|
1057
|
+
scenario = Scenario.load_from_file(scenario_file_path)
|
|
1058
|
+
sim = DynaMalSimulator.from_scenario(scenario)
|
|
1059
|
+
sim.reset()
|
|
1060
|
+
|
|
1061
|
+
n = 5
|
|
1062
|
+
for i in range(1, n):
|
|
1063
|
+
if sim.sim_state.attack_graph.model is not None:
|
|
1064
|
+
assert len(sim.sim_state.attack_graph.model.assets) == i
|
|
1065
|
+
sim.step({'Attacker': ['root:add']})
|
|
1066
|
+
|
|
1067
|
+
if sim.sim_state.attack_graph.model is not None:
|
|
1068
|
+
assert len(sim.sim_state.attack_graph.model.assets) == n
|
|
1069
|
+
|
|
1070
|
+
|
|
1071
|
+
def test_remove_self() -> None:
|
|
1072
|
+
"""Check that R> self / self works"""
|
|
1073
|
+
top = 'tests/testdata/scenarios/dynamal_example_scenarios/basic/'
|
|
1074
|
+
scenario_file_path = top + 'remove_self_scenario.yml'
|
|
1075
|
+
scenario = Scenario.load_from_file(scenario_file_path)
|
|
1076
|
+
sim = DynaMalSimulator.from_scenario(scenario)
|
|
1077
|
+
sim.reset()
|
|
1078
|
+
|
|
1079
|
+
if sim.sim_state.attack_graph.model is not None:
|
|
1080
|
+
assert len(sim.sim_state.attack_graph.model.assets) == 1
|
|
1081
|
+
|
|
1082
|
+
sim.step({'Attacker': ['root:removeSelf']})
|
|
1083
|
+
if sim.sim_state.attack_graph.model is not None:
|
|
1084
|
+
assert len(sim.sim_state.attack_graph.model.assets) == 0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/attacker_state_factories.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mal_simulator-3.3.0 → mal_simulator-3.3.1}/malsim/mal_simulator/defender_state_factories.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|