Fix [galaxies] add version

This commit is contained in:
niclas 2024-03-05 15:33:10 +01:00
parent 050f367c68
commit b2cc4ccd08
8 changed files with 33 additions and 16 deletions

View file

@ -642,5 +642,6 @@
"uuid": "8bde8146-0656-5800-82e6-e24e008e4f4a",
"value": "SolarWinds Compromise"
}
]
],
"version": 1
}

View file

@ -10488,5 +10488,6 @@
"uuid": "5e34409e-2f55-4384-b519-80747d02394c",
"value": "ZIRCONIUM"
}
]
],
"version": 1
}

View file

@ -57458,5 +57458,6 @@
"uuid": "4922dbb5-d3fd-4bf2-8af7-3b8889579c31",
"value": "Sysdig Kinsing November 2020"
}
]
],
"version": 1
}

View file

@ -33305,5 +33305,6 @@
"uuid": "91e1ee26-d6ae-4203-a466-93c9e5019b47",
"value": "ZxxZ"
}
]
],
"version": 1
}

View file

@ -3425,5 +3425,6 @@
"uuid": "52c0edbc-ce4d-429a-b1d5-720403e0172f",
"value": "Impact"
}
]
],
"version": 1
}

View file

@ -12734,5 +12734,6 @@
"uuid": "4eb755e6-41f1-4c92-b14d-87a61a446258",
"value": "XSL Script Processing"
}
]
],
"version": 1
}

View file

@ -38,29 +38,31 @@ def create_galaxy(
uuid=galaxy.uuid,
enrichment=extended_relations,
subs=create_subs,
version=version,
)
cluster.add_values(data)
case "software":
cluster = SoftwareCluster(
**config["cluster"],
uuid=galaxy.uuid,
version=version,
enrichment=extended_relations,
subs=create_subs,
)
cluster.add_values(data)
case "campaigns":
cluster = CampaignsCluster(**config["cluster"], uuid=galaxy.uuid)
cluster = CampaignsCluster(**config["cluster"], uuid=galaxy.uuid, version=version)
cluster.add_values(data)
case "technique":
cluster = TechniqueCluster(
**config["cluster"], uuid=galaxy.uuid, subs=create_subs
**config["cluster"], uuid=galaxy.uuid, subs=create_subs, version=version
)
cluster.add_values(data)
case "tactic":
cluster = TacticCluster(**config["cluster"], uuid=galaxy.uuid)
cluster = TacticCluster(**config["cluster"], uuid=galaxy.uuid, version=version)
cluster.add_values(data)
case "references":
cluster = ReferencesCluster(**config["cluster"], uuid=galaxy.uuid)
cluster = ReferencesCluster(**config["cluster"], uuid=galaxy.uuid, version=version)
cluster.add_values(data)
case _:
print("Error: Invalid endpoint")

View file

@ -114,6 +114,7 @@ class Cluster:
source: str,
type: str,
uuid: str,
version: int,
):
self.authors = authors
self.category = category
@ -122,6 +123,7 @@ class Cluster:
self.source = source
self.type = type
self.uuid = uuid
self.version = version
self.values = []
self.CLUSTER_PATH = "../../clusters"
@ -145,6 +147,7 @@ class Cluster:
"type": self.type,
"uuid": self.uuid,
"values": self.values,
"version": self.version,
}
def _get_relation_from_mitre_id(
@ -176,10 +179,11 @@ class GroupCluster(Cluster):
source: str,
type: str,
uuid: str,
version: int,
enrichment: bool = False,
subs: bool = False,
):
super().__init__(authors, category, description, name, source, type, uuid)
super().__init__(authors, category, description, name, source, type, uuid, version)
self.enrichment = enrichment
self.subs = subs
@ -263,10 +267,11 @@ class SoftwareCluster(Cluster):
source: str,
type: str,
uuid: str,
version: int,
enrichment: bool = False,
subs: bool = False,
):
super().__init__(authors, category, description, name, source, type, uuid)
super().__init__(authors, category, description, name, source, type, uuid, version)
self.enrichment = enrichment
self.subs = subs
@ -361,9 +366,10 @@ class TechniqueCluster(Cluster):
source: str,
type: str,
uuid: str,
version: int,
subs: bool = False,
):
super().__init__(authors, category, description, name, source, type, uuid)
super().__init__(authors, category, description, name, source, type, uuid, version)
self.subs = subs
def add_values(self, data):
@ -432,8 +438,9 @@ class TacticCluster(Cluster):
source: str,
type: str,
uuid: str,
version: int,
):
super().__init__(authors, category, description, name, source, type, uuid)
super().__init__(authors, category, description, name, source, type, uuid, version)
def add_values(self, data):
for entry in data["data"]:
@ -472,8 +479,9 @@ class ReferencesCluster(Cluster):
source: str,
type: str,
uuid: str,
version: int,
):
super().__init__(authors, category, description, name, source, type, uuid)
super().__init__(authors, category, description, name, source, type, uuid, version)
def add_values(self, data):
for entry in data["data"]:
@ -506,8 +514,9 @@ class CampaignsCluster(Cluster):
source: str,
type: str,
uuid: str,
version: int,
):
super().__init__(authors, category, description, name, source, type, uuid)
super().__init__(authors, category, description, name, source, type, uuid, version)
def add_values(self, data):
for entry in data["data"]: