mal-toolbox 1.2.0__py3-none-any.whl → 2.0.0__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.4
2
2
  Name: mal-toolbox
3
- Version: 1.2.0
3
+ Version: 2.0.0
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>, Sandor Berglund <sandor@kth.se>
6
6
  License: Apache Software License
@@ -25,6 +25,8 @@ Requires-Dist: docopt
25
25
  Requires-Dist: PyYAML
26
26
  Requires-Dist: py2neo
27
27
  Requires-Dist: networkx
28
+ Requires-Dist: tree-sitter-mal~=1.0.0
29
+ Requires-Dist: tree-sitter
28
30
  Provides-Extra: dev
29
31
  Requires-Dist: pytest; extra == "dev"
30
32
  Dynamic: license-file
@@ -36,37 +38,9 @@ MAL ([Meta Attack Language](https://mal-lang.org/)) models and attack graphs.
36
38
 
37
39
  Attack graphs can be used to run simulations in [MAL Simulator](https://github.com/mal-lang/mal-simulator) or run your own custom analysis on.
38
40
 
39
- - [MAL Toolbox Documentation](https://mal-lang.org/mal-toolbox/index.html)
41
+ - [MAL Toolbox Documentation](https://github.com/mal-lang/mal-toolbox/wiki)
40
42
  - [MAL Toolbox tutorial](https://github.com/mal-lang/mal-toolbox-tutorial)
41
43
 
42
- ## The Language Module
43
-
44
- The language module provides various tools to process MAL languages.
45
-
46
- ## The Model Module
47
-
48
- With a MAL language a Model (a MAL instance model) can be created either
49
- from a model file or empty.
50
-
51
- The model class will store all of the relevant information to the MAL
52
- instance model, most importantly the assets and their associations.
53
-
54
- Model objects can be used to generate attack graphs with the AttackGraph module.
55
-
56
- ## The Attack Graph Module
57
-
58
- The attack graph module contains tools used to generate attack graphs from
59
- existing MAL instance models and analyse MAL attack graphs. The function used
60
- to generate the attack graph is `generate_graph` and it requires the instance
61
- model and language specification. The resulting attack graph will contain
62
- nodes for each of the attack steps. The structure of the attack node data
63
- class can be seen in `attackgraph/node.py` file. Of note are the lists of
64
- children and parents which allow for easy reference to the other attack step
65
- nodes related and the asset field which will contain the object in the model
66
- instance to which this attack step belongs to, if this information is
67
- available.
68
-
69
-
70
44
  # Usage
71
45
 
72
46
  ## Installation
@@ -147,50 +121,9 @@ Notes:
147
121
  compiler) or a .mal file containing the DSL written in MAL.```
148
122
  ```
149
123
 
150
- ## Code examples / Tutorial
151
-
152
- To find more code examples and tutorials, visit the
153
- [MAL Toolbox Tutorial](https://github.com/mal-lang/mal-toolbox-tutorial/tree/main) repository.
154
-
155
- ### Load a language
156
- ```python
157
-
158
- from maltoolbox.language import LanguageGraph
159
-
160
- # Will load the MAL language (.mal/.mar) or a saved language graph (yml/json)
161
- lang_graph = LanguageGraph.load_from_file(lang_file_path)
162
-
163
- ```
164
-
165
- ### Generate a model
166
- ```python
167
- from maltoolbox.model import Model
168
-
169
- # Create an empty model
170
- instance_model = Model("Example Model", lang_graph)
171
-
172
- # Create and add assets of type supported by the MAL language
173
- asset1 = instance_model.add_asset('Application', 'Application1')
174
- asset2 = instance_model.add_asset('Application', 'Application2')
175
-
176
- # Create association between the assets
177
- asset1.add_associated_assets('appExecutedApps', asset2)
178
- ```
179
-
180
- ## Generate an attack graph
181
-
182
- ```python
183
-
184
- from maltoolbox.attackgraph import AttackGraph
185
-
186
- attack_graph = AttackGraph(lang_graph, model)
187
-
188
- ```
189
-
190
-
191
- ## Contributing
124
+ # Contributing
192
125
 
193
- # CI Pipeline
126
+ ## CI Pipeline
194
127
 
195
128
  Checks are made with:
196
129
 
@@ -200,12 +133,12 @@ Checks are made with:
200
133
 
201
134
  Make sure pipeline passes before PR is marked "Ready for review".
202
135
 
203
- # Tests
136
+ ## Tests
204
137
  There are unit tests inside of ./tests.
205
138
 
206
139
  To run all tests, use the `pytest` command. To run just a specific file or test function use `pytest tests/<filename>` or `pytest -k <function_name>`.
207
140
 
208
- # Making a release
141
+ ## Making a release
209
142
 
210
143
  1. Make a PR with one commit that updates the version number in `pyproject.toml` and `maltoolbox/__init__.py`.
211
144
  Follow [Semantic versioning](https://semver.org/).
@@ -1,6 +1,6 @@
1
- mal_toolbox-1.2.0.dist-info/licenses/AUTHORS,sha256=zxLrLe8EY39WtRKlAY4Oorx4Z2_LHV2ApRvDGZgY7xY,127
2
- mal_toolbox-1.2.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
- maltoolbox/__init__.py,sha256=477nzX87CW6thDBJ4BfSLW2xzvpqIHKL0llR7bJxXds,2132
1
+ mal_toolbox-2.0.0.dist-info/licenses/AUTHORS,sha256=zxLrLe8EY39WtRKlAY4Oorx4Z2_LHV2ApRvDGZgY7xY,127
2
+ mal_toolbox-2.0.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
+ maltoolbox/__init__.py,sha256=gxg271599Ua9ptG6IVi2BevMf_0lFpf8iuWi3m5-wrA,2132
4
4
  maltoolbox/__main__.py,sha256=aAm6NcZ-HtPmY9hfFlGNnTs5rydoI6NAc88RgXt1G9U,3515
5
5
  maltoolbox/exceptions.py,sha256=4rwqzu8Cgj0ShjUoCXP2yik-bJaqYqj6Y-0tqxHy4vs,1316
6
6
  maltoolbox/file_utils.py,sha256=IXA0cvyopjRFGGKqRPkRQ0RJOtKzq_XF13aHgcz-TFc,1911
@@ -9,13 +9,16 @@ maltoolbox/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  maltoolbox/str_utils.py,sha256=zZXHOFfXguhpQQJ5nyGe1VGWchOkanQUc8viV7nhQho,639
10
10
  maltoolbox/attackgraph/__init__.py,sha256=l7dJ7jOqpcj7PdsOKZt1NuXlPyjd6vZYvcXlj8Kq09w,297
11
11
  maltoolbox/attackgraph/attackgraph.py,sha256=WBRwnVmQqwpjp3x_kSR8HH49MnlRIhF6tZ_r7nqTAJw,27162
12
- maltoolbox/attackgraph/node.py,sha256=7NAdEl40w6KMt_gKK1mP4SRAmmyCQGSTMaD-GHMNXHk,4186
12
+ maltoolbox/attackgraph/node.py,sha256=aUlXbkwjcIxwEDWC1fAZl3343mF_Y1rxxF72ncNJcGY,4245
13
13
  maltoolbox/attackgraph/analyzers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  maltoolbox/language/__init__.py,sha256=RTTfhnCYa5PRGJCgDAWLpLLAzNCvNMn91UHNiOXszbg,490
15
- maltoolbox/language/languagegraph.py,sha256=Tjqk5zv_37ghmepx8KBHPTH8tRlboaYcW836MiUS1d8,65140
16
- maltoolbox/language/compiler/__init__.py,sha256=Rbdeco6SWHyFw-VJfpxLRSZO3UMjJxPGenMR8OujVpA,15846
17
- maltoolbox/language/compiler/mal_lexer.py,sha256=TQvzEW7yCN0iY6Js5O6wCDFxSAE0_LAX4JVy96TnLro,14808
18
- maltoolbox/language/compiler/mal_parser.py,sha256=bVfYWRZyyhU-s2tJI-D_YwbVQkl3AHzdrD6LWM0BQbI,116108
15
+ maltoolbox/language/languagegraph.py,sha256=DyNc2ev2492rBifrb5Ql_jfZ4-2rz0KTAmBt75R2FSc,65326
16
+ maltoolbox/language/compiler/__init__.py,sha256=KCtjWlWY1qmDoTOOufZ0Y1b1zcH_W0IlsTLvTZAfS9w,72
17
+ maltoolbox/language/compiler/distributions.py,sha256=i6SqskJy3y7fn9VS6c1aiNIm09Yxc5-cAZ09lz9ZwCk,5979
18
+ maltoolbox/language/compiler/exceptions.py,sha256=nLXxo0JGmreKAMCJIjiODvB0pJ5q24twKSc3dRo81yY,740
19
+ maltoolbox/language/compiler/lang.py,sha256=WHCU-3SFChr69LFFTle-qlnGov0-tc3tnMLwyYRficA,148
20
+ maltoolbox/language/compiler/mal_analyzer.py,sha256=PJL-ubW4Ehif92QYz9fCNr3dPV6EAMt10VqAjbHWKRI,40837
21
+ maltoolbox/language/compiler/mal_compiler.py,sha256=jD5l20106fQyrGK7msrvUFPnzm4iyDhWdgh47ee4GW8,36881
19
22
  maltoolbox/patternfinder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
23
  maltoolbox/patternfinder/attackgraph_patterns.py,sha256=jw6BlQHXLmiWm9xajLHbUZUWVQGM2qAgMHOs0Yo2YsE,5168
21
24
  maltoolbox/translators/__init__.py,sha256=7qbhjeu--s2A-O_031a7xzSq794iQlrrUxM8gE1LxH4,201
@@ -23,11 +26,11 @@ maltoolbox/translators/networkx.py,sha256=v1JQAqO7st6-ktx5P3oy93DsL2SEUPly_3zcAL
23
26
  maltoolbox/translators/updater.py,sha256=mFmTT2GHCw6nsoHe_ChnvAHd5j6UxKnvAqLFDSziqC4,8566
24
27
  maltoolbox/visualization/__init__.py,sha256=7rrGclkGdP6LrxpfSh1esYFG_MnvnVruuEdUJI-DX-g,350
25
28
  maltoolbox/visualization/draw_io_utils.py,sha256=CgsD0HEFpxZ6ZIWtUZtMekdPB2Irtmvhz0TNEm7x1ig,14378
26
- maltoolbox/visualization/graphviz_utils.py,sha256=gA5WGnukZiis5RXIXtWyCy0QMFeSPucZMnFJSbbM8Xc,4687
29
+ maltoolbox/visualization/graphviz_utils.py,sha256=87B2pxRMrlmm2RHu0JM7nQRHWZD0Yt3zCmEwl8xUXdU,4709
27
30
  maltoolbox/visualization/neo4j_utils.py,sha256=R2Qm2gC5GDpfiPhhB3oymuBI2W580SRXGVtQuFRYiIA,3496
28
31
  maltoolbox/visualization/utils.py,sha256=EZWsxukO5hbRwGFW9GM9ZemKT-nYg-VMCup-SsntaQM,1480
29
- mal_toolbox-1.2.0.dist-info/METADATA,sha256=b2NVXhY7knTCzoQrNpJXrHAIChJir16tQBFt2v4rjJk,6696
30
- mal_toolbox-1.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
- mal_toolbox-1.2.0.dist-info/entry_points.txt,sha256=oqby5O6cUP_OHCm70k_iYPA6UlbTBf7se1i3XwdK3uU,56
32
- mal_toolbox-1.2.0.dist-info/top_level.txt,sha256=phqRVLRKGdSUgRY03mcpi2cmbbDo5YGjkV4gkqHFFcM,11
33
- mal_toolbox-1.2.0.dist-info/RECORD,,
32
+ mal_toolbox-2.0.0.dist-info/METADATA,sha256=jBkfjs3GBtO0pvOQYVBMpNt9z8nHgvMyjKaA7DxT_Wo,4632
33
+ mal_toolbox-2.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
+ mal_toolbox-2.0.0.dist-info/entry_points.txt,sha256=oqby5O6cUP_OHCm70k_iYPA6UlbTBf7se1i3XwdK3uU,56
35
+ mal_toolbox-2.0.0.dist-info/top_level.txt,sha256=phqRVLRKGdSUgRY03mcpi2cmbbDo5YGjkV4gkqHFFcM,11
36
+ mal_toolbox-2.0.0.dist-info/RECORD,,
maltoolbox/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- # MAL Toolbox v1.2.0
1
+ # MAL Toolbox v2.0.0
2
2
  # Copyright 2025, Andrei Buhaiu.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,7 +19,7 @@
19
19
  """
20
20
 
21
21
  __title__ = "maltoolbox"
22
- __version__ = "1.2.0"
22
+ __version__ = "2.0.0"
23
23
  __authors__ = [
24
24
  "Andrei Buhaiu",
25
25
  "Giuseppe Nebbione",
@@ -28,6 +28,7 @@ class AttackGraphNode:
28
28
  self.lg_attack_step = lg_attack_step
29
29
  self.name = lg_attack_step.name
30
30
  self.type = lg_attack_step.type
31
+ self.causal_mode = self.lg_attack_step.causal_mode
31
32
  self.ttc = ttc_dist if ttc_dist is not None else lg_attack_step.ttc
32
33
  self.tags = lg_attack_step.tags
33
34
  self.detectors = lg_attack_step.detectors