mal-toolbox 1.0.3__tar.gz → 1.0.4__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-1.0.3/mal_toolbox.egg-info → mal_toolbox-1.0.4}/PKG-INFO +1 -1
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4/mal_toolbox.egg-info}/PKG-INFO +1 -1
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/__init__.py +2 -2
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/language/languagegraph.py +2 -127
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/pyproject.toml +1 -1
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/AUTHORS +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/LICENSE +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/README.md +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/mal_toolbox.egg-info/SOURCES.txt +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/mal_toolbox.egg-info/dependency_links.txt +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/mal_toolbox.egg-info/entry_points.txt +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/mal_toolbox.egg-info/requires.txt +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/mal_toolbox.egg-info/top_level.txt +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/__main__.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/attackgraph/__init__.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/attackgraph/analyzers/__init__.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/attackgraph/attackgraph.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/attackgraph/node.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/exceptions.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/file_utils.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/language/__init__.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/language/compiler/__init__.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/language/compiler/mal_lexer.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/language/compiler/mal_parser.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/model.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/patternfinder/__init__.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/patternfinder/attackgraph_patterns.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/py.typed +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/translators/__init__.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/translators/securicad.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/translators/updater.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/visualization/__init__.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/maltoolbox/visualization/graphviz_utils.py +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/setup.cfg +0 -0
- {mal_toolbox-1.0.3 → mal_toolbox-1.0.4}/tests/test_model.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mal-toolbox
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
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.4
|
|
2
2
|
Name: mal-toolbox
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
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 v1.0.
|
|
2
|
+
# MAL Toolbox v1.0.4
|
|
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__ = "1.0.
|
|
24
|
+
__version__ = "1.0.4"
|
|
25
25
|
__authors__ = [
|
|
26
26
|
"Andrei Buhaiu",
|
|
27
27
|
"Giuseppe Nebbione",
|
|
@@ -26,131 +26,6 @@ from ..exceptions import (
|
|
|
26
26
|
|
|
27
27
|
logger = logging.getLogger(__name__)
|
|
28
28
|
|
|
29
|
-
predef_ttcs: dict[str, dict] = {
|
|
30
|
-
'EasyAndUncertain':
|
|
31
|
-
{
|
|
32
|
-
'arguments': [0.5],
|
|
33
|
-
'name': 'Bernoulli',
|
|
34
|
-
'type': 'function'
|
|
35
|
-
},
|
|
36
|
-
'HardAndUncertain':
|
|
37
|
-
{
|
|
38
|
-
'lhs':
|
|
39
|
-
{
|
|
40
|
-
'arguments': [0.1],
|
|
41
|
-
'name': 'Exponential',
|
|
42
|
-
'type': 'function'
|
|
43
|
-
},
|
|
44
|
-
'rhs':
|
|
45
|
-
{
|
|
46
|
-
'arguments': [0.5],
|
|
47
|
-
'name': 'Bernoulli',
|
|
48
|
-
'type': 'function'
|
|
49
|
-
},
|
|
50
|
-
'type': 'multiplication'
|
|
51
|
-
},
|
|
52
|
-
'VeryHardAndUncertain':
|
|
53
|
-
{
|
|
54
|
-
'lhs':
|
|
55
|
-
{
|
|
56
|
-
'arguments': [0.01],
|
|
57
|
-
'name': 'Exponential',
|
|
58
|
-
'type': 'function'
|
|
59
|
-
},
|
|
60
|
-
'rhs':
|
|
61
|
-
{
|
|
62
|
-
'arguments': [0.5],
|
|
63
|
-
'name': 'Bernoulli',
|
|
64
|
-
'type': 'function'
|
|
65
|
-
},
|
|
66
|
-
'type': 'multiplication'
|
|
67
|
-
},
|
|
68
|
-
'EasyAndCertain':
|
|
69
|
-
{
|
|
70
|
-
'arguments': [1.0],
|
|
71
|
-
'name': 'Exponential',
|
|
72
|
-
'type': 'function'
|
|
73
|
-
},
|
|
74
|
-
'HardAndCertain':
|
|
75
|
-
{
|
|
76
|
-
'arguments': [0.1],
|
|
77
|
-
'name': 'Exponential',
|
|
78
|
-
'type': 'function'
|
|
79
|
-
},
|
|
80
|
-
'VeryHardAndCertain':
|
|
81
|
-
{
|
|
82
|
-
'arguments': [0.01],
|
|
83
|
-
'name': 'Exponential',
|
|
84
|
-
'type': 'function'
|
|
85
|
-
},
|
|
86
|
-
'Enabled':
|
|
87
|
-
{
|
|
88
|
-
'arguments': [1.0],
|
|
89
|
-
'name': 'Bernoulli',
|
|
90
|
-
'type': 'function'
|
|
91
|
-
},
|
|
92
|
-
'Instant':
|
|
93
|
-
{
|
|
94
|
-
'arguments': [1.0],
|
|
95
|
-
'name': 'Bernoulli',
|
|
96
|
-
'type': 'function'
|
|
97
|
-
},
|
|
98
|
-
'Disabled':
|
|
99
|
-
{
|
|
100
|
-
'arguments': [0.0],
|
|
101
|
-
'name': 'Bernoulli',
|
|
102
|
-
'type': 'function'
|
|
103
|
-
},
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
def get_ttc_distribution(
|
|
107
|
-
step_dict: dict,
|
|
108
|
-
defense_default_ttc = None,
|
|
109
|
-
attack_default_ttc = None
|
|
110
|
-
) -> Optional[dict]:
|
|
111
|
-
"""Convert step TTC to a TTC distribution if needed
|
|
112
|
-
|
|
113
|
-
- If no TTC is set, set return default TTC.
|
|
114
|
-
- If the TTC provided is a predefined name replace it with the
|
|
115
|
-
probability distribution it corresponds to.
|
|
116
|
-
- Otherwise return the TTC distribution as is.
|
|
117
|
-
|
|
118
|
-
Arguments:
|
|
119
|
-
step_dict - A dict with the attack step data
|
|
120
|
-
defense_default_ttc - the value to give a defense ttc if none is set
|
|
121
|
-
attack_default_ttc - the value to give an attack ttc if none is set
|
|
122
|
-
|
|
123
|
-
Returns:
|
|
124
|
-
A dict with the steps TTC distribution, or None if the step is not
|
|
125
|
-
a defense or attack step
|
|
126
|
-
"""
|
|
127
|
-
|
|
128
|
-
if defense_default_ttc is None:
|
|
129
|
-
defense_default_ttc = predef_ttcs['Disabled'].copy()
|
|
130
|
-
if attack_default_ttc is None:
|
|
131
|
-
attack_default_ttc = predef_ttcs['Instant'].copy()
|
|
132
|
-
|
|
133
|
-
step_ttc = step_dict['ttc']
|
|
134
|
-
|
|
135
|
-
if step_dict['type'] == 'defense':
|
|
136
|
-
if step_ttc is None:
|
|
137
|
-
# No step ttc set in language for defense
|
|
138
|
-
step_ttc = defense_default_ttc
|
|
139
|
-
elif step_dict['type'] in ('or', 'and'):
|
|
140
|
-
if step_ttc is None:
|
|
141
|
-
# No step ttc set in language for attack
|
|
142
|
-
step_ttc = attack_default_ttc
|
|
143
|
-
else:
|
|
144
|
-
# No TTC for other step types
|
|
145
|
-
return None
|
|
146
|
-
|
|
147
|
-
if 'name' in step_ttc and step_ttc['name'] in predef_ttcs:
|
|
148
|
-
# Predefined step ttc set in language, fetch from dict
|
|
149
|
-
step_ttc = predef_ttcs[step_ttc['name']].copy()
|
|
150
|
-
|
|
151
|
-
return step_ttc
|
|
152
|
-
|
|
153
|
-
|
|
154
29
|
|
|
155
30
|
def disaggregate_attack_step_full_name(
|
|
156
31
|
attack_step_full_name: str) -> list[str]:
|
|
@@ -998,7 +873,7 @@ class LanguageGraph():
|
|
|
998
873
|
name = attack_step_dict['name'],
|
|
999
874
|
type = attack_step_dict['type'],
|
|
1000
875
|
asset = asset,
|
|
1001
|
-
ttc =
|
|
876
|
+
ttc = attack_step_dict['ttc'],
|
|
1002
877
|
overrides = attack_step_dict['overrides'],
|
|
1003
878
|
own_children = {},
|
|
1004
879
|
own_parents = {},
|
|
@@ -1716,7 +1591,7 @@ class LanguageGraph():
|
|
|
1716
1591
|
name = attack_step_attribs['name'],
|
|
1717
1592
|
type = attack_step_attribs['type'],
|
|
1718
1593
|
asset = asset,
|
|
1719
|
-
ttc =
|
|
1594
|
+
ttc = attack_step_attribs['ttc'],
|
|
1720
1595
|
overrides = (
|
|
1721
1596
|
attack_step_attribs['reaches']['overrides']
|
|
1722
1597
|
if attack_step_attribs['reaches'] else False
|
|
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
|