mal-toolbox 0.3.5__tar.gz → 0.3.6__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_toolbox-0.3.5/mal_toolbox.egg-info → mal_toolbox-0.3.6}/PKG-INFO +1 -1
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6/mal_toolbox.egg-info}/PKG-INFO +1 -1
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/__init__.py +2 -2
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/model.py +12 -8
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/pyproject.toml +1 -1
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/tests/test_model.py +9 -1
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/AUTHORS +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/LICENSE +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/README.md +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/mal_toolbox.egg-info/SOURCES.txt +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/mal_toolbox.egg-info/dependency_links.txt +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/mal_toolbox.egg-info/entry_points.txt +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/mal_toolbox.egg-info/requires.txt +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/mal_toolbox.egg-info/top_level.txt +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/__main__.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/attackgraph/__init__.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/attackgraph/analyzers/__init__.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/attackgraph/analyzers/apriori.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/attackgraph/attacker.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/attackgraph/attackgraph.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/attackgraph/node.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/attackgraph/query.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/exceptions.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/file_utils.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/ingestors/__init__.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/ingestors/neo4j.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/language/__init__.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/language/compiler/__init__.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/language/compiler/mal_lexer.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/language/compiler/mal_parser.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/language/languagegraph.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/translators/__init__.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/translators/securicad.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/maltoolbox/translators/updater.py +0 -0
- {mal_toolbox-0.3.5 → mal_toolbox-0.3.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mal-toolbox
|
|
3
|
-
Version: 0.3.
|
|
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,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mal-toolbox
|
|
3
|
-
Version: 0.3.
|
|
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,5 +1,5 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# MAL Toolbox v0.3.
|
|
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.
|
|
24
|
+
__version__ = "0.3.6"
|
|
25
25
|
__authors__ = [
|
|
26
26
|
"Andrei Buhaiu",
|
|
27
27
|
"Giuseppe Nebbione",
|
|
@@ -245,7 +245,10 @@ class Model():
|
|
|
245
245
|
)
|
|
246
246
|
|
|
247
247
|
# First remove all of the associated assets
|
|
248
|
-
|
|
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(
|
|
653
|
-
|
|
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
|
-
|
|
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):
|
|
@@ -230,16 +230,23 @@ def test_model_add_asset_duplicate_name(model: Model):
|
|
|
230
230
|
assert len(model.assets) == 2
|
|
231
231
|
|
|
232
232
|
|
|
233
|
-
def
|
|
233
|
+
def test_model_remove_asset_with_association(model: Model):
|
|
234
234
|
"""Remove assets from a model"""
|
|
235
235
|
|
|
236
236
|
# Add two program assets to the model
|
|
237
237
|
asset1 = model.add_asset(asset_type = 'Application')
|
|
238
238
|
asset2 = model.add_asset(asset_type = 'Application')
|
|
239
|
+
asset1.add_associated_assets('hostApp', {asset2})
|
|
239
240
|
|
|
241
|
+
assert asset1.associated_assets == {'hostApp': {asset2}}
|
|
242
|
+
assert asset2.associated_assets == {'appExecutedApps': {asset1}}
|
|
240
243
|
num_assets_before = len(model.assets)
|
|
244
|
+
|
|
241
245
|
model.remove_asset(asset1)
|
|
242
246
|
|
|
247
|
+
assert asset1.associated_assets == {}
|
|
248
|
+
assert asset2.associated_assets == {}
|
|
249
|
+
|
|
243
250
|
# Make sure asset asset1 was deleted, but asset2 still exists
|
|
244
251
|
assert asset1 not in model.assets.values()
|
|
245
252
|
assert asset2 in model.assets.values()
|
|
@@ -362,6 +369,7 @@ def test_model_remove_associated_asset(model: Model):
|
|
|
362
369
|
# removed from assets and model
|
|
363
370
|
asset1.remove_associated_assets(
|
|
364
371
|
fieldname = 'appExecutedApps', assets = {asset2})
|
|
372
|
+
|
|
365
373
|
assert 'appExecutedApps' not in asset1.associated_assets
|
|
366
374
|
assert 'hostApp' not in asset2.associated_assets
|
|
367
375
|
|
|
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
|