From 183cfe27f51fea3be8b176f44904c7136e95f927 Mon Sep 17 00:00:00 2001 From: Ondrej Lukas Date: Mon, 23 Feb 2026 15:49:46 +0100 Subject: [PATCH 1/3] Do no track casts --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ec0973af..0d5350f9 100755 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,4 @@ figures/* .vscode/settings.json trajectories/* *.tar.gz +casts/* From 87b6937e86ecfc89bf133b9693ae4cd12715f1a4 Mon Sep 17 00:00:00 2001 From: Ondrej Lukas Date: Mon, 23 Feb 2026 16:24:05 +0100 Subject: [PATCH 2/3] Added tests for block action serialization --- tests/components/test_action.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/components/test_action.py b/tests/components/test_action.py index 5fa036b0..d2169c4d 100644 --- a/tests/components/test_action.py +++ b/tests/components/test_action.py @@ -450,6 +450,23 @@ def test_action_to_dict_quit_game(self): assert action_dict["action_type"] == str(action.type) assert len(action_dict["parameters"]) == 0 + def test_action_to_dict_block_ip(self): + action = Action( + action_type=ActionType.BlockIP, + parameters={ + "target_host": IP("192.168.1.0"), + "source_host": IP("192.168.1.1"), + "blocked_ip": IP("1.1.1.1") + } + ) + action_dict = action.as_dict + new_action = Action.from_dict(action_dict) + assert action == new_action + assert action_dict["action_type"] == str(action.type) + assert action_dict["parameters"]["target_host"] == {'ip': '192.168.1.0'} + assert action_dict["parameters"]["source_host"] == {'ip': '192.168.1.1'} + assert action_dict["parameters"]["blocked_ip"] == {'ip': '1.1.1.1'} + def test_action_type_eq_unsupported(self): """Test ActionType equality with unsupported type""" assert (ActionType.FindData == 123) is False From 4e7f035ea60bb217e18c251080e2f10e45784649 Mon Sep 17 00:00:00 2001 From: Ondrej Lukas Date: Mon, 23 Feb 2026 16:24:25 +0100 Subject: [PATCH 3/3] feat: Add 'blocked_ip' to the list of parameters parsed as IP objects. --- netsecgame/game_components.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netsecgame/game_components.py b/netsecgame/game_components.py index 4b3d3ec1..2dd9eddd 100755 --- a/netsecgame/game_components.py +++ b/netsecgame/game_components.py @@ -448,7 +448,7 @@ def from_dict(cls, data_dict: Dict[str, Any]) -> Action: params: Dict[str, Any] = {} for k, v in data_dict["parameters"].items(): match k: - case "source_host" | "target_host" | "blocked_host": + case "source_host" | "target_host" | "blocked_host" | "blocked_ip": params[k] = IP.from_dict(v) case "target_network": params[k] = Network.from_dict(v)