mal-toolbox 1.2.1__py3-none-any.whl → 2.1.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.
Files changed (37) hide show
  1. {mal_toolbox-1.2.1.dist-info → mal_toolbox-2.1.0.dist-info}/METADATA +8 -75
  2. mal_toolbox-2.1.0.dist-info/RECORD +51 -0
  3. {mal_toolbox-1.2.1.dist-info → mal_toolbox-2.1.0.dist-info}/WHEEL +1 -1
  4. maltoolbox/__init__.py +2 -2
  5. maltoolbox/attackgraph/__init__.py +2 -2
  6. maltoolbox/attackgraph/attackgraph.py +121 -549
  7. maltoolbox/attackgraph/factories.py +68 -0
  8. maltoolbox/attackgraph/file_utils.py +0 -0
  9. maltoolbox/attackgraph/generate.py +338 -0
  10. maltoolbox/attackgraph/node.py +1 -0
  11. maltoolbox/attackgraph/node_getters.py +36 -0
  12. maltoolbox/attackgraph/ttcs.py +28 -0
  13. maltoolbox/language/__init__.py +2 -2
  14. maltoolbox/language/compiler/__init__.py +4 -499
  15. maltoolbox/language/compiler/distributions.py +158 -0
  16. maltoolbox/language/compiler/exceptions.py +37 -0
  17. maltoolbox/language/compiler/lang.py +5 -0
  18. maltoolbox/language/compiler/mal_analyzer.py +920 -0
  19. maltoolbox/language/compiler/mal_compiler.py +1071 -0
  20. maltoolbox/language/detector.py +43 -0
  21. maltoolbox/language/expression_chain.py +218 -0
  22. maltoolbox/language/language_graph_asset.py +180 -0
  23. maltoolbox/language/language_graph_assoc.py +147 -0
  24. maltoolbox/language/language_graph_attack_step.py +129 -0
  25. maltoolbox/language/language_graph_builder.py +282 -0
  26. maltoolbox/language/language_graph_loaders.py +7 -0
  27. maltoolbox/language/language_graph_lookup.py +140 -0
  28. maltoolbox/language/language_graph_serialization.py +5 -0
  29. maltoolbox/language/languagegraph.py +244 -1536
  30. maltoolbox/language/step_expression_processor.py +491 -0
  31. mal_toolbox-1.2.1.dist-info/RECORD +0 -33
  32. maltoolbox/language/compiler/mal_lexer.py +0 -232
  33. maltoolbox/language/compiler/mal_parser.py +0 -3159
  34. {mal_toolbox-1.2.1.dist-info → mal_toolbox-2.1.0.dist-info}/entry_points.txt +0 -0
  35. {mal_toolbox-1.2.1.dist-info → mal_toolbox-2.1.0.dist-info}/licenses/AUTHORS +0 -0
  36. {mal_toolbox-1.2.1.dist-info → mal_toolbox-2.1.0.dist-info}/licenses/LICENSE +0 -0
  37. {mal_toolbox-1.2.1.dist-info → mal_toolbox-2.1.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mal-toolbox
3
- Version: 1.2.1
3
+ Version: 2.1.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 Wiki](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/).
@@ -0,0 +1,51 @@
1
+ mal_toolbox-2.1.0.dist-info/licenses/AUTHORS,sha256=zxLrLe8EY39WtRKlAY4Oorx4Z2_LHV2ApRvDGZgY7xY,127
2
+ mal_toolbox-2.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
+ maltoolbox/__init__.py,sha256=633r0iOfwJkbLRn94tZ_Mp4Qj601Gtczk3kwYIIElkI,2132
4
+ maltoolbox/__main__.py,sha256=aAm6NcZ-HtPmY9hfFlGNnTs5rydoI6NAc88RgXt1G9U,3515
5
+ maltoolbox/exceptions.py,sha256=4rwqzu8Cgj0ShjUoCXP2yik-bJaqYqj6Y-0tqxHy4vs,1316
6
+ maltoolbox/file_utils.py,sha256=IXA0cvyopjRFGGKqRPkRQ0RJOtKzq_XF13aHgcz-TFc,1911
7
+ maltoolbox/model.py,sha256=bqYPYNW8MxuS2wUef51z6yjaA5F13YXbeicM2qaYUd4,18138
8
+ maltoolbox/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ maltoolbox/str_utils.py,sha256=zZXHOFfXguhpQQJ5nyGe1VGWchOkanQUc8viV7nhQho,639
10
+ maltoolbox/attackgraph/__init__.py,sha256=IbTP8bsp7NLSJEJfvpRZDEtqc5bhALSQ_yUvZhquw7c,303
11
+ maltoolbox/attackgraph/attackgraph.py,sha256=4gSPyZZkke1IET3Sqn483kvFSZQEikKsnGkduTOf984,11917
12
+ maltoolbox/attackgraph/factories.py,sha256=w-XDyAvd2rr27dPryWlPRJG8zufxMc4eeZiKnDkq0c4,2006
13
+ maltoolbox/attackgraph/file_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ maltoolbox/attackgraph/generate.py,sha256=RKDhWBUyW_y4qLo2On26BVo5fuSgmZsoiR1OWm5H1tc,10684
15
+ maltoolbox/attackgraph/node.py,sha256=aUlXbkwjcIxwEDWC1fAZl3343mF_Y1rxxF72ncNJcGY,4245
16
+ maltoolbox/attackgraph/node_getters.py,sha256=GTOKMG9K95R5eb0-9mbOhylLKf1z0P_2A4OOwgybCFQ,1121
17
+ maltoolbox/attackgraph/ttcs.py,sha256=9yFRgPeOEJddCY4ZDElr-qn7X8IfRR-_T5Z4_X4zD8Y,977
18
+ maltoolbox/attackgraph/analyzers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ maltoolbox/language/__init__.py,sha256=GSRlkongctp5C97Ad1tT2F1qVOR1TSONVG_BkJhaAi4,504
20
+ maltoolbox/language/detector.py,sha256=Hdf_WpEPPVz4pgfDU7JIaJjxO4xHqWPe7HZ2oifCNHI,1117
21
+ maltoolbox/language/expression_chain.py,sha256=F5X_JBiafMrUGiGgkwl9-YETPr-X2pb3Q9YMjgTn3F4,8437
22
+ maltoolbox/language/language_graph_asset.py,sha256=hwBMQJYaCPpdrhfpmXDXb4134FZX-4YK6AyG0QS0WPw,6146
23
+ maltoolbox/language/language_graph_assoc.py,sha256=_QkkvhGgkKA0vAzgQcpCL64nLExB2cBgOmeD9rR9YQU,4759
24
+ maltoolbox/language/language_graph_attack_step.py,sha256=93WpoRhg2xcvIP_HB83VmdHyBW1Fcz0OasEkiou7QD4,4470
25
+ maltoolbox/language/language_graph_builder.py,sha256=rRSPASReQmhDDLLP6k_VTGYuF0L3Tqyv-zUvOT3oxoA,11301
26
+ maltoolbox/language/language_graph_loaders.py,sha256=QUEspU7rFIUhQNHm2qzDRsGYFTUXXFx12v33-LxqYsA,57
27
+ maltoolbox/language/language_graph_lookup.py,sha256=mT7LZ-uteOM9h56M8uQQ4fOk6qfC8fpn6mNjazYVccs,4321
28
+ maltoolbox/language/language_graph_serialization.py,sha256=PKmv2u6fGAULhFlAs6IFjv6ZWXeBQ-upxigl3oJSeyg,55
29
+ maltoolbox/language/languagegraph.py,sha256=Pyf_21nAwOr1KXdDiXReQiWenpRDBLcl0Co0aaofjFk,18377
30
+ maltoolbox/language/step_expression_processor.py,sha256=tpnGvbi6cYLWJZ7GwIvINn35jV5PhERVqb7SJiogRA4,15144
31
+ maltoolbox/language/compiler/__init__.py,sha256=KCtjWlWY1qmDoTOOufZ0Y1b1zcH_W0IlsTLvTZAfS9w,72
32
+ maltoolbox/language/compiler/distributions.py,sha256=i6SqskJy3y7fn9VS6c1aiNIm09Yxc5-cAZ09lz9ZwCk,5979
33
+ maltoolbox/language/compiler/exceptions.py,sha256=nLXxo0JGmreKAMCJIjiODvB0pJ5q24twKSc3dRo81yY,740
34
+ maltoolbox/language/compiler/lang.py,sha256=WHCU-3SFChr69LFFTle-qlnGov0-tc3tnMLwyYRficA,148
35
+ maltoolbox/language/compiler/mal_analyzer.py,sha256=PJL-ubW4Ehif92QYz9fCNr3dPV6EAMt10VqAjbHWKRI,40837
36
+ maltoolbox/language/compiler/mal_compiler.py,sha256=DQlUBomAIL1YY9S_qpIFNor9qCvoYUxihro3ksuxQIE,36961
37
+ maltoolbox/patternfinder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ maltoolbox/patternfinder/attackgraph_patterns.py,sha256=jw6BlQHXLmiWm9xajLHbUZUWVQGM2qAgMHOs0Yo2YsE,5168
39
+ maltoolbox/translators/__init__.py,sha256=7qbhjeu--s2A-O_031a7xzSq794iQlrrUxM8gE1LxH4,201
40
+ maltoolbox/translators/networkx.py,sha256=v1JQAqO7st6-ktx5P3oy93DsL2SEUPly_3zcALv08o8,1352
41
+ maltoolbox/translators/updater.py,sha256=mFmTT2GHCw6nsoHe_ChnvAHd5j6UxKnvAqLFDSziqC4,8566
42
+ maltoolbox/visualization/__init__.py,sha256=7rrGclkGdP6LrxpfSh1esYFG_MnvnVruuEdUJI-DX-g,350
43
+ maltoolbox/visualization/draw_io_utils.py,sha256=CgsD0HEFpxZ6ZIWtUZtMekdPB2Irtmvhz0TNEm7x1ig,14378
44
+ maltoolbox/visualization/graphviz_utils.py,sha256=87B2pxRMrlmm2RHu0JM7nQRHWZD0Yt3zCmEwl8xUXdU,4709
45
+ maltoolbox/visualization/neo4j_utils.py,sha256=R2Qm2gC5GDpfiPhhB3oymuBI2W580SRXGVtQuFRYiIA,3496
46
+ maltoolbox/visualization/utils.py,sha256=EZWsxukO5hbRwGFW9GM9ZemKT-nYg-VMCup-SsntaQM,1480
47
+ mal_toolbox-2.1.0.dist-info/METADATA,sha256=Mr8XKYTU74YKQJ-rzFw8xOvZYkDq6wy4oTIXRuiCqTU,4623
48
+ mal_toolbox-2.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
49
+ mal_toolbox-2.1.0.dist-info/entry_points.txt,sha256=oqby5O6cUP_OHCm70k_iYPA6UlbTBf7se1i3XwdK3uU,56
50
+ mal_toolbox-2.1.0.dist-info/top_level.txt,sha256=phqRVLRKGdSUgRY03mcpi2cmbbDo5YGjkV4gkqHFFcM,11
51
+ mal_toolbox-2.1.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
maltoolbox/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- # MAL Toolbox v1.2.1
1
+ # MAL Toolbox v2.1.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.1"
22
+ __version__ = "2.1.0"
23
23
  __authors__ = [
24
24
  "Andrei Buhaiu",
25
25
  "Giuseppe Nebbione",
@@ -2,12 +2,12 @@
2
2
  models and analyze attack graphs.
3
3
  """
4
4
 
5
- from .attackgraph import AttackGraph, create_attack_graph
5
+ from .attackgraph import AttackGraph
6
+ from .factories import create_attack_graph
6
7
  from .node import AttackGraphNode
7
8
 
8
9
  __all__ = [
9
10
  "AttackGraph",
10
11
  "AttackGraphNode",
11
- "Attacker",
12
12
  "create_attack_graph"
13
13
  ]