mal-toolbox 0.3.2__py3-none-any.whl → 0.3.4__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.2
2
2
  Name: mal-toolbox
3
- Version: 0.3.2
3
+ Version: 0.3.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,4 +1,4 @@
1
- maltoolbox/__init__.py,sha256=vx87VNBoaH04yj1qjSU_ZKIhOFj9Zyf_04HJBNWkLEg,2088
1
+ maltoolbox/__init__.py,sha256=hZCoM58rmBiJvbjPRpzNVFgNlhml32Pq7NB0fb0kIKs,2088
2
2
  maltoolbox/__main__.py,sha256=PSg8vFS8X-klJBJdSzrg0aLh9ykZgbcoSSEy3DTQoQQ,3499
3
3
  maltoolbox/exceptions.py,sha256=0YjPx2v1yYumZ2o7pVZ1s_jS-GAb3Ng979KEFhROSNY,1399
4
4
  maltoolbox/file_utils.py,sha256=tBR8Kjl8IoFzAtYaLNHNALuQrdMT3pD1ZpczHm1pu2g,1875
@@ -7,23 +7,23 @@ maltoolbox/attackgraph/__init__.py,sha256=AHDyX6dAkx3mDic2K56v1xche9N6ofDfbaHkKb
7
7
  maltoolbox/attackgraph/attacker.py,sha256=dKMAcOwlNM3LL8qh1tBJuzjFxlTNG-QI2st1LzP8Ofc,4030
8
8
  maltoolbox/attackgraph/attackgraph.py,sha256=5ejaqeTF6QNc_75p_jgvC9-33-4J0PaaHUFBi_oQy20,32663
9
9
  maltoolbox/attackgraph/node.py,sha256=Ec67_u_8qf_MgCHaUg4wIbZFC013GWxbIsC8EjoguzE,6465
10
- maltoolbox/attackgraph/query.py,sha256=s66EQcHlldn7XLCWxZ2FRjZTgk8o3V0mD4LnRaImdCw,6836
10
+ maltoolbox/attackgraph/query.py,sha256=TPr0yDK_ZpRWO4BVTZ64_ATNjLnrglU3Jh1QGkhLeE0,7441
11
11
  maltoolbox/attackgraph/analyzers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  maltoolbox/attackgraph/analyzers/apriori.py,sha256=pLTZBJDOMbmMQpHQ7V-hocvaNvtFnjklr3TJ0sdEakc,8986
13
13
  maltoolbox/ingestors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- maltoolbox/ingestors/neo4j.py,sha256=gjQQqk0HVI8ojIqwS1ymt7-_ZvDOTNi8AcczDAlvsGs,8310
14
+ maltoolbox/ingestors/neo4j.py,sha256=W3AH3nymRQHI9N65HsSyyeQKcETPXmY_SLKc-iB4sBI,8328
15
15
  maltoolbox/language/__init__.py,sha256=9p5nvVqDCKEhXbDMIz1MtwZ9GN7x1jmUUXbpjEwuqnw,269
16
- maltoolbox/language/languagegraph.py,sha256=npP1lX1EE1rqqKNr9qTb4Jylvdn5JYApNyJhjwSebJs,67785
16
+ maltoolbox/language/languagegraph.py,sha256=eBPTyoDpfc01ONEj321-RmIJV3DfVenYfHdVu0TiITo,67856
17
17
  maltoolbox/language/compiler/__init__.py,sha256=JQyAgDwJh1pU7AmuOhd1-d2b2PYXpgMVPtxnav8QHVc,15872
18
18
  maltoolbox/language/compiler/mal_lexer.py,sha256=BeifykDAt4PloRASOaLzBgWF35ev_zgD8lXMIsSHykc,12063
19
19
  maltoolbox/language/compiler/mal_parser.py,sha256=sUoaE43l2VKg-Dou30mk2wlVS1FvdOREwHNIyFe4IkY,114699
20
20
  maltoolbox/translators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  maltoolbox/translators/securicad.py,sha256=PJYjieioWN5tE_oKm83dtgV5UkC8EUH9Vsy3-FxBtUo,7017
22
22
  maltoolbox/translators/updater.py,sha256=8bisZnzMWjGaG5tu8jdF-Oq6bPwIjXkVO-_yZDGc6cA,8652
23
- mal_toolbox-0.3.2.dist-info/AUTHORS,sha256=zxLrLe8EY39WtRKlAY4Oorx4Z2_LHV2ApRvDGZgY7xY,127
24
- mal_toolbox-0.3.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
- mal_toolbox-0.3.2.dist-info/METADATA,sha256=zapHEbzodvqPAbblBrCnrEm2buIGWPFGQXtdwUoib1E,6158
26
- mal_toolbox-0.3.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
27
- mal_toolbox-0.3.2.dist-info/entry_points.txt,sha256=oqby5O6cUP_OHCm70k_iYPA6UlbTBf7se1i3XwdK3uU,56
28
- mal_toolbox-0.3.2.dist-info/top_level.txt,sha256=phqRVLRKGdSUgRY03mcpi2cmbbDo5YGjkV4gkqHFFcM,11
29
- mal_toolbox-0.3.2.dist-info/RECORD,,
23
+ mal_toolbox-0.3.4.dist-info/AUTHORS,sha256=zxLrLe8EY39WtRKlAY4Oorx4Z2_LHV2ApRvDGZgY7xY,127
24
+ mal_toolbox-0.3.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
+ mal_toolbox-0.3.4.dist-info/METADATA,sha256=bP52aB2aNCsIIBk6J4_tPhUI0B5q_xm44sNI-TSaUtU,6158
26
+ mal_toolbox-0.3.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
27
+ mal_toolbox-0.3.4.dist-info/entry_points.txt,sha256=oqby5O6cUP_OHCm70k_iYPA6UlbTBf7se1i3XwdK3uU,56
28
+ mal_toolbox-0.3.4.dist-info/top_level.txt,sha256=phqRVLRKGdSUgRY03mcpi2cmbbDo5YGjkV4gkqHFFcM,11
29
+ mal_toolbox-0.3.4.dist-info/RECORD,,
maltoolbox/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # MAL Toolbox v0.3.2
2
+ # MAL Toolbox v0.3.4
3
3
  # Copyright 2024, 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.2"
24
+ __version__ = "0.3.4"
25
25
  __authors__ = [
26
26
  "Andrei Buhaiu",
27
27
  "Giuseppe Nebbione",
@@ -46,13 +46,26 @@ def is_node_traversable_by_attacker(
46
46
 
47
47
  match(node.type):
48
48
  case 'or':
49
+ for parent in node.parents:
50
+ if parent.is_compromised_by(attacker):
51
+ logger.debug(
52
+ '"%s"(%d) is traversable because it is viable, and '
53
+ 'of type "or", and its parent "%s(%d)" has already '
54
+ 'been compromised.',
55
+ node.full_name,
56
+ node.id,
57
+ parent.full_name,
58
+ parent.id
59
+ )
60
+ return True
49
61
  logger.debug(
50
- '"%s"(%d) is traversable because it is viable and '
51
- 'of type "or".',
62
+ '"%s"(%d) is not traversable because while it is '
63
+ 'viable, and of type "or", none of its parents '
64
+ 'have been compromised.',
52
65
  node.full_name,
53
66
  node.id
54
67
  )
55
- return True
68
+ return False
56
69
 
57
70
  case 'and':
58
71
  for parent in node.parents:
@@ -35,7 +35,7 @@ def ingest_attack_graph(graph,
35
35
 
36
36
  nodes = {}
37
37
  rels = []
38
- for node in graph.nodes:
38
+ for node in graph.nodes.values():
39
39
  node_dict = node.to_dict()
40
40
  nodes[node.id] = Node(
41
41
  node_dict['asset'] if 'asset' in node_dict else node_dict['id'],
@@ -50,7 +50,7 @@ def ingest_attack_graph(graph,
50
50
  in node_dict else 'N/A')
51
51
 
52
52
 
53
- for node in graph.nodes:
53
+ for node in graph.nodes.values():
54
54
  for child in node.children:
55
55
  rels.append(Relationship(nodes[node.id], nodes[child.id]))
56
56
 
@@ -34,8 +34,8 @@ def disaggregate_attack_step_full_name(
34
34
 
35
35
  @dataclass
36
36
  class Detector:
37
- context: Context
38
37
  name: Optional[str]
38
+ context: Context
39
39
  type: Optional[str]
40
40
  tprate: Optional[dict]
41
41
 
@@ -61,6 +61,8 @@ class Context(dict):
61
61
  def __str__(self) -> str:
62
62
  return str({label: asset.name for label, asset in self._context_dict.items()})
63
63
 
64
+ def __repr__(self) -> str:
65
+ return f"Context({str(self)}))"
64
66
 
65
67
  @dataclass
66
68
  class LanguageGraphAsset: