mal-toolbox 1.1.0__tar.gz → 1.1.2__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.
Files changed (42) hide show
  1. {mal_toolbox-1.1.0/mal_toolbox.egg-info → mal_toolbox-1.1.2}/PKG-INFO +26 -2
  2. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/README.md +23 -1
  3. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2/mal_toolbox.egg-info}/PKG-INFO +26 -2
  4. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/mal_toolbox.egg-info/SOURCES.txt +1 -1
  5. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/mal_toolbox.egg-info/requires.txt +2 -0
  6. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/__init__.py +6 -7
  7. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/__main__.py +17 -9
  8. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/attackgraph/__init__.py +2 -3
  9. mal_toolbox-1.1.2/maltoolbox/attackgraph/attackgraph.py +716 -0
  10. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/attackgraph/node.py +14 -19
  11. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/exceptions.py +7 -10
  12. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/file_utils.py +10 -4
  13. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/language/__init__.py +1 -1
  14. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/language/compiler/__init__.py +4 -4
  15. mal_toolbox-1.1.2/maltoolbox/language/compiler/mal_lexer.py +232 -0
  16. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/language/compiler/mal_parser.py +784 -1136
  17. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/language/languagegraph.py +491 -636
  18. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/model.py +85 -77
  19. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/patternfinder/attackgraph_patterns.py +17 -8
  20. mal_toolbox-1.1.2/maltoolbox/translators/__init__.py +8 -0
  21. mal_toolbox-1.1.2/maltoolbox/translators/networkx.py +42 -0
  22. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/translators/updater.py +18 -25
  23. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/visualization/__init__.py +4 -4
  24. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/visualization/draw_io_utils.py +6 -5
  25. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/visualization/graphviz_utils.py +4 -2
  26. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/visualization/neo4j_utils.py +13 -14
  27. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/visualization/utils.py +2 -3
  28. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/pyproject.toml +42 -1
  29. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/tests/test_model.py +87 -99
  30. mal_toolbox-1.1.0/maltoolbox/attackgraph/attackgraph.py +0 -699
  31. mal_toolbox-1.1.0/maltoolbox/language/compiler/mal_lexer.py +0 -232
  32. mal_toolbox-1.1.0/maltoolbox/translators/__init__.py +0 -0
  33. mal_toolbox-1.1.0/maltoolbox/translators/securicad.py +0 -179
  34. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/AUTHORS +0 -0
  35. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/LICENSE +0 -0
  36. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/mal_toolbox.egg-info/dependency_links.txt +0 -0
  37. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/mal_toolbox.egg-info/entry_points.txt +0 -0
  38. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/mal_toolbox.egg-info/top_level.txt +0 -0
  39. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/attackgraph/analyzers/__init__.py +0 -0
  40. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/patternfinder/__init__.py +0 -0
  41. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/maltoolbox/py.typed +0 -0
  42. {mal_toolbox-1.1.0 → mal_toolbox-1.1.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mal-toolbox
3
- Version: 1.1.0
3
+ Version: 1.1.2
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
@@ -23,6 +23,8 @@ Requires-Dist: antlr4-tools
23
23
  Requires-Dist: antlr4-python3-runtime
24
24
  Requires-Dist: docopt
25
25
  Requires-Dist: PyYAML
26
+ Requires-Dist: py2neo
27
+ Requires-Dist: networkx
26
28
  Provides-Extra: dev
27
29
  Requires-Dist: pytest; extra == "dev"
28
30
  Dynamic: license-file
@@ -177,8 +179,30 @@ attack_graph = AttackGraph(lang_graph, model)
177
179
  ```
178
180
 
179
181
 
182
+ ## Contributing
183
+
184
+ # CI Pipeline
185
+
186
+ Checks are made with:
187
+
188
+ - `mypy`
189
+ - `ruff`
190
+ - `pytest`
191
+
192
+ Make sure pipeline passes before PR is marked "Ready for review".
193
+
180
194
  # Tests
181
195
  There are unit tests inside of ./tests.
182
- Before running the tests, make sure to install the requirements in ./tests/requirements.txt with `python -m pip install -r ./tests/requirements.txt`.
183
196
 
184
197
  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>`.
198
+
199
+ # Making a release
200
+
201
+ 1. Make a PR with one commit that updates the version number in `pyproject.toml` and `maltoolbox/__init__.py`.
202
+ Follow [Semantic versioning](https://semver.org/).
203
+
204
+ 2. Get the PR reviewed and merged to `main`.
205
+
206
+ 3. Tag the latest commit on `main` with the new version number.
207
+
208
+ 4. Push the tag.
@@ -148,8 +148,30 @@ attack_graph = AttackGraph(lang_graph, model)
148
148
  ```
149
149
 
150
150
 
151
+ ## Contributing
152
+
153
+ # CI Pipeline
154
+
155
+ Checks are made with:
156
+
157
+ - `mypy`
158
+ - `ruff`
159
+ - `pytest`
160
+
161
+ Make sure pipeline passes before PR is marked "Ready for review".
162
+
151
163
  # Tests
152
164
  There are unit tests inside of ./tests.
153
- Before running the tests, make sure to install the requirements in ./tests/requirements.txt with `python -m pip install -r ./tests/requirements.txt`.
154
165
 
155
166
  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>`.
167
+
168
+ # Making a release
169
+
170
+ 1. Make a PR with one commit that updates the version number in `pyproject.toml` and `maltoolbox/__init__.py`.
171
+ Follow [Semantic versioning](https://semver.org/).
172
+
173
+ 2. Get the PR reviewed and merged to `main`.
174
+
175
+ 3. Tag the latest commit on `main` with the new version number.
176
+
177
+ 4. Push the tag.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mal-toolbox
3
- Version: 1.1.0
3
+ Version: 1.1.2
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
@@ -23,6 +23,8 @@ Requires-Dist: antlr4-tools
23
23
  Requires-Dist: antlr4-python3-runtime
24
24
  Requires-Dist: docopt
25
25
  Requires-Dist: PyYAML
26
+ Requires-Dist: py2neo
27
+ Requires-Dist: networkx
26
28
  Provides-Extra: dev
27
29
  Requires-Dist: pytest; extra == "dev"
28
30
  Dynamic: license-file
@@ -177,8 +179,30 @@ attack_graph = AttackGraph(lang_graph, model)
177
179
  ```
178
180
 
179
181
 
182
+ ## Contributing
183
+
184
+ # CI Pipeline
185
+
186
+ Checks are made with:
187
+
188
+ - `mypy`
189
+ - `ruff`
190
+ - `pytest`
191
+
192
+ Make sure pipeline passes before PR is marked "Ready for review".
193
+
180
194
  # Tests
181
195
  There are unit tests inside of ./tests.
182
- Before running the tests, make sure to install the requirements in ./tests/requirements.txt with `python -m pip install -r ./tests/requirements.txt`.
183
196
 
184
197
  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>`.
198
+
199
+ # Making a release
200
+
201
+ 1. Make a PR with one commit that updates the version number in `pyproject.toml` and `maltoolbox/__init__.py`.
202
+ Follow [Semantic versioning](https://semver.org/).
203
+
204
+ 2. Get the PR reviewed and merged to `main`.
205
+
206
+ 3. Tag the latest commit on `main` with the new version number.
207
+
208
+ 4. Push the tag.
@@ -26,7 +26,7 @@ maltoolbox/language/compiler/mal_parser.py
26
26
  maltoolbox/patternfinder/__init__.py
27
27
  maltoolbox/patternfinder/attackgraph_patterns.py
28
28
  maltoolbox/translators/__init__.py
29
- maltoolbox/translators/securicad.py
29
+ maltoolbox/translators/networkx.py
30
30
  maltoolbox/translators/updater.py
31
31
  maltoolbox/visualization/__init__.py
32
32
  maltoolbox/visualization/draw_io_utils.py
@@ -3,6 +3,8 @@ antlr4-tools
3
3
  antlr4-python3-runtime
4
4
  docopt
5
5
  PyYAML
6
+ py2neo
7
+ networkx
6
8
 
7
9
  [dev]
8
10
  pytest
@@ -1,5 +1,4 @@
1
- # -*- encoding: utf-8 -*-
2
- # MAL Toolbox v1.1.0
1
+ # MAL Toolbox v1.1.2
3
2
  # Copyright 2025, Andrei Buhaiu.
4
3
  #
5
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,12 +15,11 @@
16
15
  #
17
16
 
18
17
 
19
- """
20
- MAL-Toolbox Framework
18
+ """MAL-Toolbox Framework
21
19
  """
22
20
 
23
21
  __title__ = "maltoolbox"
24
- __version__ = "1.1.0"
22
+ __version__ = "1.1.2"
25
23
  __authors__ = [
26
24
  "Andrei Buhaiu",
27
25
  "Giuseppe Nebbione",
@@ -34,11 +32,12 @@ __docformat__ = "restructuredtext en"
34
32
 
35
33
  __all__ = ()
36
34
 
37
- import os
38
- import yaml
39
35
  import logging
36
+ import os
40
37
  from typing import Any
41
38
 
39
+ import yaml
40
+
42
41
  config: dict[str, Any] = {
43
42
  "logging": {
44
43
  "log_level": logging.INFO,
@@ -1,5 +1,4 @@
1
- """
2
- Command-line interface for MAL toolbox operations
1
+ """Command-line interface for MAL toolbox operations
3
2
 
4
3
  Usage:
5
4
  maltoolbox compile <lang_file> <output_file>
@@ -8,6 +7,7 @@ Usage:
8
7
  maltoolbox visualize-model [--neo4j] [--graphviz] [-drawio] <model_file> <lang_file>
9
8
 
10
9
  Arguments:
10
+ ---------
11
11
  <model_file> Path to JSON instance model file.
12
12
  <lang_file> Path to .mar or .mal file containing MAL spec.
13
13
  <output_file> Path to write the result of the compilation (yml/json).
@@ -19,30 +19,34 @@ Options:
19
19
  -d --drawio Export draw.io file
20
20
 
21
21
  Notes:
22
+ -----
22
23
  - <lang_file> can be either a .mar file (generated by the older MAL
23
24
  compiler) or a .mal file containing the DSL written in MAL.
25
+
24
26
  """
25
27
 
26
- import logging
27
28
  import json
29
+ import logging
30
+
28
31
  import docopt
29
32
 
30
33
  from . import log_configs, neo4j_configs
31
- from .attackgraph import create_attack_graph, AttackGraph
34
+ from .attackgraph import AttackGraph, create_attack_graph
32
35
  from .language.compiler import MalCompiler
33
36
  from .language.languagegraph import LanguageGraph
37
+ from .model import Model
34
38
  from .translators.updater import load_model_from_older_version
35
39
  from .visualization import (
36
- render_model,
37
- render_attack_graph,
38
- ingest_model_neo4j,
40
+ create_drawio_file_with_images,
39
41
  ingest_attack_graph_neo4j,
40
- create_drawio_file_with_images
42
+ ingest_model_neo4j,
43
+ render_attack_graph,
44
+ render_model,
41
45
  )
42
- from .model import Model
43
46
 
44
47
  logger = logging.getLogger(__name__)
45
48
 
49
+
46
50
  def generate_attack_graph(
47
51
  model_file: str,
48
52
  lang_file: str
@@ -50,8 +54,10 @@ def generate_attack_graph(
50
54
  """Create an attack graph
51
55
 
52
56
  Args:
57
+ ----
53
58
  model_file - path to the model file
54
59
  lang_file - path to the language file
60
+
55
61
  """
56
62
  attack_graph = create_attack_graph(lang_file, model_file)
57
63
  if log_configs['attackgraph_file']:
@@ -60,6 +66,7 @@ def generate_attack_graph(
60
66
  )
61
67
  return attack_graph
62
68
 
69
+
63
70
  def compile(lang_file: str, output_file: str) -> None:
64
71
  """Compile language and dump into output file"""
65
72
  compiler = MalCompiler()
@@ -107,5 +114,6 @@ def main():
107
114
  if args['--drawio']:
108
115
  create_drawio_file_with_images(model)
109
116
 
117
+
110
118
  if __name__ == "__main__":
111
119
  main()
@@ -1,5 +1,4 @@
1
- """
2
- Contains tools used to generate attack graphs from MAL instance
1
+ """Contains tools used to generate attack graphs from MAL instance
3
2
  models and analyze attack graphs.
4
3
  """
5
4
 
@@ -7,8 +6,8 @@ from .attackgraph import AttackGraph, create_attack_graph
7
6
  from .node import AttackGraphNode
8
7
 
9
8
  __all__ = [
10
- "Attacker",
11
9
  "AttackGraph",
12
10
  "AttackGraphNode",
11
+ "Attacker",
13
12
  "create_attack_graph"
14
13
  ]