pycti 6.3.2__tar.gz → 6.3.4__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.
Potentially problematic release.
This version of pycti might be problematic. Click here for more details.
- {pycti-6.3.2 → pycti-6.3.4}/PKG-INFO +1 -1
- {pycti-6.3.2 → pycti-6.3.4}/pycti/__init__.py +1 -1
- {pycti-6.3.2 → pycti-6.3.4}/pycti/utils/opencti_stix2.py +6 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/utils/opencti_stix2_splitter.py +25 -4
- {pycti-6.3.2 → pycti-6.3.4}/pycti/utils/opencti_stix2_utils.py +24 -17
- {pycti-6.3.2 → pycti-6.3.4}/pycti.egg-info/PKG-INFO +1 -1
- {pycti-6.3.2 → pycti-6.3.4}/LICENSE +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/README.md +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/api/__init__.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/api/opencti_api_client.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/api/opencti_api_connector.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/api/opencti_api_playbook.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/api/opencti_api_work.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/connector/__init__.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/connector/opencti_connector.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/connector/opencti_connector_helper.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/connector/opencti_metric_handler.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/__init__.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/indicator/__init__.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/indicator/opencti_indicator_properties.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_attack_pattern.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_campaign.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_case_incident.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_case_rfi.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_case_rft.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_channel.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_course_of_action.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_data_component.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_data_source.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_event.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_external_reference.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_feedback.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_grouping.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_identity.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_incident.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_indicator.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_infrastructure.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_intrusion_set.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_kill_chain_phase.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_label.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_language.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_location.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_malware.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_malware_analysis.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_marking_definition.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_narrative.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_note.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_observed_data.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_opinion.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_report.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_stix.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_stix_core_object.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_stix_core_relationship.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_stix_cyber_observable.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_stix_domain_object.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_stix_nested_ref_relationship.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_stix_object_or_stix_relationship.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_stix_sighting_relationship.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_task.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_threat_actor.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_threat_actor_group.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_threat_actor_individual.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_tool.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_vocabulary.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/opencti_vulnerability.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/stix_cyber_observable/__init__.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_deprecated.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_properties.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/utils/__init__.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/utils/constants.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/utils/opencti_logger.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/utils/opencti_stix2_identifier.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti/utils/opencti_stix2_update.py +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti.egg-info/SOURCES.txt +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti.egg-info/dependency_links.txt +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti.egg-info/requires.txt +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pycti.egg-info/top_level.txt +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/pyproject.toml +0 -0
- {pycti-6.3.2 → pycti-6.3.4}/setup.cfg +0 -0
|
@@ -2280,6 +2280,12 @@ class OpenCTIStix2:
|
|
|
2280
2280
|
do_list = lister.get(
|
|
2281
2281
|
entity_type, lambda **kwargs: self.unknown_type({"type": entity_type})
|
|
2282
2282
|
)
|
|
2283
|
+
|
|
2284
|
+
if getAll and (orderBy is None or orderBy == "_score"):
|
|
2285
|
+
orderBy = "created_at"
|
|
2286
|
+
if orderMode is None:
|
|
2287
|
+
orderMode = "desc"
|
|
2288
|
+
|
|
2283
2289
|
# noinspection PyTypeChecker
|
|
2284
2290
|
return do_list(
|
|
2285
2291
|
search=search,
|
|
@@ -10,19 +10,24 @@ from pycti.utils.opencti_stix2_identifier import (
|
|
|
10
10
|
)
|
|
11
11
|
from pycti.utils.opencti_stix2_utils import (
|
|
12
12
|
STIX_CYBER_OBSERVABLE_MAPPING,
|
|
13
|
-
|
|
13
|
+
SUPPORTED_STIX_ENTITY_OBJECTS,
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
+
OPENCTI_EXTENSION = "extension-definition--ea279b3e-5c71-4632-ac08-831c66a786ba"
|
|
17
|
+
|
|
16
18
|
supported_types = (
|
|
17
|
-
|
|
19
|
+
SUPPORTED_STIX_ENTITY_OBJECTS # entities
|
|
18
20
|
+ list(STIX_CYBER_OBSERVABLE_MAPPING.keys()) # observables
|
|
19
21
|
+ ["relationship", "sighting"] # relationships
|
|
20
22
|
)
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
def is_id_supported(key):
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
if "--" in key:
|
|
27
|
+
id_type = key.split("--")[0]
|
|
28
|
+
return id_type in supported_types
|
|
29
|
+
# If not a stix id, don't try to filter
|
|
30
|
+
return True
|
|
26
31
|
|
|
27
32
|
|
|
28
33
|
class OpenCTIStix2Splitter:
|
|
@@ -31,6 +36,18 @@ class OpenCTIStix2Splitter:
|
|
|
31
36
|
self.cache_refs = {}
|
|
32
37
|
self.elements = []
|
|
33
38
|
|
|
39
|
+
def get_internal_ids_in_extension(self, item):
|
|
40
|
+
ids = []
|
|
41
|
+
if item.get("x_opencti_id"):
|
|
42
|
+
ids.append(item["x_opencti_id"])
|
|
43
|
+
if (
|
|
44
|
+
item.get("extensions")
|
|
45
|
+
and item["extensions"].get(OPENCTI_EXTENSION)
|
|
46
|
+
and item["extensions"].get(OPENCTI_EXTENSION).get("id")
|
|
47
|
+
):
|
|
48
|
+
ids.append(item["extensions"][OPENCTI_EXTENSION]["id"])
|
|
49
|
+
return ids
|
|
50
|
+
|
|
34
51
|
def enlist_element(
|
|
35
52
|
self, item_id, raw_data, cleanup_inconsistent_bundle, parent_acc
|
|
36
53
|
):
|
|
@@ -173,6 +190,8 @@ class OpenCTIStix2Splitter:
|
|
|
173
190
|
if is_compatible:
|
|
174
191
|
self.elements.append(item)
|
|
175
192
|
self.cache_index[item_id] = item
|
|
193
|
+
for internal_id in self.get_internal_ids_in_extension(item):
|
|
194
|
+
self.cache_index[internal_id] = item
|
|
176
195
|
|
|
177
196
|
return nb_deps
|
|
178
197
|
|
|
@@ -202,6 +221,8 @@ class OpenCTIStix2Splitter:
|
|
|
202
221
|
# Build flat list of elements
|
|
203
222
|
for item in bundle_data["objects"]:
|
|
204
223
|
raw_data[item["id"]] = item
|
|
224
|
+
for internal_id in self.get_internal_ids_in_extension(item):
|
|
225
|
+
raw_data[internal_id] = item
|
|
205
226
|
for item in bundle_data["objects"]:
|
|
206
227
|
self.enlist_element(item["id"], raw_data, cleanup_inconsistent_bundle, [])
|
|
207
228
|
|
|
@@ -2,44 +2,49 @@ from typing import Any, Dict
|
|
|
2
2
|
|
|
3
3
|
from stix2 import EqualityComparisonExpression, ObjectPath, ObservationExpression
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
"marking-definition",
|
|
5
|
+
SUPPORTED_STIX_ENTITY_OBJECTS = [
|
|
7
6
|
"attack-pattern",
|
|
8
7
|
"campaign",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"note",
|
|
12
|
-
"observed-data",
|
|
13
|
-
"opinion",
|
|
14
|
-
"report",
|
|
15
|
-
"grouping",
|
|
8
|
+
"case-incident",
|
|
9
|
+
"x-opencti-case-incident",
|
|
16
10
|
"case-rfi",
|
|
17
11
|
"x-opencti-case-rfi",
|
|
18
12
|
"case-rft",
|
|
19
13
|
"x-opencti-case-rft",
|
|
20
|
-
"
|
|
21
|
-
"x-opencti-task",
|
|
22
|
-
"case-incident",
|
|
23
|
-
"x-opencti-case-incident",
|
|
24
|
-
"feedback",
|
|
25
|
-
"x-opencti-feedback",
|
|
14
|
+
"channel",
|
|
26
15
|
"course-of-action",
|
|
27
16
|
"data-component",
|
|
28
17
|
"x-mitre-data-component",
|
|
29
18
|
"data-source",
|
|
30
19
|
"x-mitre-data-source",
|
|
20
|
+
"event",
|
|
21
|
+
"external-reference",
|
|
22
|
+
"feedback",
|
|
23
|
+
"x-opencti-feedback",
|
|
24
|
+
"grouping",
|
|
31
25
|
"identity",
|
|
26
|
+
"incident",
|
|
32
27
|
"indicator",
|
|
33
28
|
"infrastructure",
|
|
34
29
|
"intrusion-set",
|
|
30
|
+
"kill-chain-phase",
|
|
31
|
+
"label",
|
|
32
|
+
"language",
|
|
35
33
|
"location",
|
|
36
34
|
"malware",
|
|
37
35
|
"malware-analysis",
|
|
36
|
+
"marking-definition",
|
|
37
|
+
"narrative",
|
|
38
|
+
"note",
|
|
39
|
+
"observed-data",
|
|
40
|
+
"opinion",
|
|
41
|
+
"report",
|
|
42
|
+
"task",
|
|
43
|
+
"x-opencti-task",
|
|
38
44
|
"threat-actor",
|
|
39
45
|
"tool",
|
|
40
|
-
"
|
|
46
|
+
"vocabulary",
|
|
41
47
|
"vulnerability",
|
|
42
|
-
"incident",
|
|
43
48
|
]
|
|
44
49
|
|
|
45
50
|
STIX_CYBER_OBSERVABLE_MAPPING = {
|
|
@@ -74,6 +79,8 @@ STIX_CYBER_OBSERVABLE_MAPPING = {
|
|
|
74
79
|
"tracking-number": "Tracking-Number",
|
|
75
80
|
"payment-card": "Payment-Card",
|
|
76
81
|
"media-content": "Media-Content",
|
|
82
|
+
"simple-observable": "Simple-Observable",
|
|
83
|
+
"persona": "Persona",
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
PATTERN_MAPPING = {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|