mal-toolbox 0.3.5__py3-none-any.whl → 0.3.6__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mal-toolbox
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: A collection of tools used to create MAL models and attack graphs.
5
5
  Author-email: Andrei Buhaiu <buhaiu@kth.se>, Joakim Loxdal <loxdal@kth.se>, Nikolaos Kakouros <nkak@kth.se>, Jakob Nyberg <jaknyb@kth.se>, Giuseppe Nebbione <nebbione@kth.se>
6
6
  License: Apache Software License
@@ -1,8 +1,8 @@
1
- maltoolbox/__init__.py,sha256=k-H51l_Zc67HUyRK7pqhKe9LQ_IGX79UtA-eqrZrJI0,2088
1
+ maltoolbox/__init__.py,sha256=IPS2eQ4uAhZ4Axdc_vu-lHK7nXXT_peN_nMQn5Ci_qY,2088
2
2
  maltoolbox/__main__.py,sha256=PSg8vFS8X-klJBJdSzrg0aLh9ykZgbcoSSEy3DTQoQQ,3499
3
3
  maltoolbox/exceptions.py,sha256=0YjPx2v1yYumZ2o7pVZ1s_jS-GAb3Ng979KEFhROSNY,1399
4
4
  maltoolbox/file_utils.py,sha256=tBR8Kjl8IoFzAtYaLNHNALuQrdMT3pD1ZpczHm1pu2g,1875
5
- maltoolbox/model.py,sha256=Gozh0sT7HXCgaQ0PMDdwP9CH_rgXjnmYweo1ei66xvQ,23799
5
+ maltoolbox/model.py,sha256=H7hmnTQVz6Uublih2bPfoQGNLvUjBWRnXUQ6SW6jJc8,24051
6
6
  maltoolbox/attackgraph/__init__.py,sha256=AHDyX6dAkx3mDic2K56v1xche9N6ofDfbaHkKbdJ2qQ,230
7
7
  maltoolbox/attackgraph/attacker.py,sha256=EwlzVinscBKO84QrCvy2W1jxXqTHrrufOovO3t6Xi2A,4113
8
8
  maltoolbox/attackgraph/attackgraph.py,sha256=5ejaqeTF6QNc_75p_jgvC9-33-4J0PaaHUFBi_oQy20,32663
@@ -20,10 +20,10 @@ maltoolbox/language/compiler/mal_parser.py,sha256=sUoaE43l2VKg-Dou30mk2wlVS1FvdO
20
20
  maltoolbox/translators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  maltoolbox/translators/securicad.py,sha256=PJYjieioWN5tE_oKm83dtgV5UkC8EUH9Vsy3-FxBtUo,7017
22
22
  maltoolbox/translators/updater.py,sha256=8bisZnzMWjGaG5tu8jdF-Oq6bPwIjXkVO-_yZDGc6cA,8652
23
- mal_toolbox-0.3.5.dist-info/AUTHORS,sha256=zxLrLe8EY39WtRKlAY4Oorx4Z2_LHV2ApRvDGZgY7xY,127
24
- mal_toolbox-0.3.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
- mal_toolbox-0.3.5.dist-info/METADATA,sha256=GEueck0b9oEH59bosSJlO5lYi5nUQUhKfP3Fc4rVycY,6158
26
- mal_toolbox-0.3.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
27
- mal_toolbox-0.3.5.dist-info/entry_points.txt,sha256=oqby5O6cUP_OHCm70k_iYPA6UlbTBf7se1i3XwdK3uU,56
28
- mal_toolbox-0.3.5.dist-info/top_level.txt,sha256=phqRVLRKGdSUgRY03mcpi2cmbbDo5YGjkV4gkqHFFcM,11
29
- mal_toolbox-0.3.5.dist-info/RECORD,,
23
+ mal_toolbox-0.3.6.dist-info/AUTHORS,sha256=zxLrLe8EY39WtRKlAY4Oorx4Z2_LHV2ApRvDGZgY7xY,127
24
+ mal_toolbox-0.3.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
+ mal_toolbox-0.3.6.dist-info/METADATA,sha256=lJ1tUZbqDf4d808Y4w_WPZcL0jyrgxpi9i4Ljsijipc,6158
26
+ mal_toolbox-0.3.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
27
+ mal_toolbox-0.3.6.dist-info/entry_points.txt,sha256=oqby5O6cUP_OHCm70k_iYPA6UlbTBf7se1i3XwdK3uU,56
28
+ mal_toolbox-0.3.6.dist-info/top_level.txt,sha256=phqRVLRKGdSUgRY03mcpi2cmbbDo5YGjkV4gkqHFFcM,11
29
+ mal_toolbox-0.3.6.dist-info/RECORD,,
maltoolbox/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # MAL Toolbox v0.3.5
2
+ # MAL Toolbox v0.3.6
3
3
  # Copyright 2025, Andrei Buhaiu.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,7 +21,7 @@ MAL-Toolbox Framework
21
21
  """
22
22
 
23
23
  __title__ = "maltoolbox"
24
- __version__ = "0.3.5"
24
+ __version__ = "0.3.6"
25
25
  __authors__ = [
26
26
  "Andrei Buhaiu",
27
27
  "Giuseppe Nebbione",
maltoolbox/model.py CHANGED
@@ -245,7 +245,10 @@ class Model():
245
245
  )
246
246
 
247
247
  # First remove all of the associated assets
248
- for fieldname, assoc_assets in asset.associated_assets.items():
248
+ # We can not remove from the dict while iterating over it
249
+ # so we first have to copy the keys and then remove those assets
250
+ associated_fieldnames = dict(asset.associated_assets)
251
+ for fieldname, assoc_assets in associated_fieldnames.items():
249
252
  asset.remove_associated_assets(fieldname, assoc_assets)
250
253
 
251
254
  # Also remove all of the entry points
@@ -649,17 +652,13 @@ class ModelAsset:
649
652
  other_fieldname, set()
650
653
  ).add(self)
651
654
 
652
- def remove_associated_assets(self, fieldname: str,
653
- assets: set[ModelAsset]):
655
+ def remove_associated_assets(
656
+ self, fieldname: str, assets: set[ModelAsset]):
654
657
  """ Remove the assets provided as a parameter from the set of
655
658
  associated assets dictionary entry corresponding to the fieldname
656
659
  parameter.
657
660
  """
658
- self._associated_assets[fieldname] -= set(assets)
659
- if len(self._associated_assets[fieldname]) == 0:
660
- del self._associated_assets[fieldname]
661
-
662
- # Also remove this asset to the associated assets' dictionaries
661
+ # Remove this asset from its associated assets' dictionaries
663
662
  lg_assoc = self.lg_asset.associations[fieldname]
664
663
  other_fieldname = lg_assoc.get_opposite_fieldname(fieldname)
665
664
  for asset in assets:
@@ -667,6 +666,11 @@ class ModelAsset:
667
666
  if len(asset._associated_assets[other_fieldname]) == 0:
668
667
  del asset._associated_assets[other_fieldname]
669
668
 
669
+ # Remove associated assets from this asset
670
+ self._associated_assets[fieldname] -= set(assets)
671
+ if len(self._associated_assets[fieldname]) == 0:
672
+ del self._associated_assets[fieldname]
673
+
670
674
 
671
675
  @property
672
676
  def associated_assets(self):