pycti 6.4.11__tar.gz → 6.5.1__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.4.11 → pycti-6.5.1}/PKG-INFO +1 -1
- {pycti-6.4.11 → pycti-6.5.1}/pycti/__init__.py +1 -1
- {pycti-6.4.11 → pycti-6.5.1}/pycti/api/opencti_api_work.py +18 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/connector/opencti_connector_helper.py +2 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_deprecated.py +1 -1
- {pycti-6.4.11 → pycti-6.5.1}/pycti/utils/opencti_stix2.py +15 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti.egg-info/PKG-INFO +1 -1
- {pycti-6.4.11 → pycti-6.5.1}/LICENSE +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/README.md +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/api/__init__.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/api/opencti_api_client.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/api/opencti_api_connector.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/api/opencti_api_playbook.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/connector/__init__.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/connector/opencti_connector.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/connector/opencti_metric_handler.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/__init__.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/indicator/__init__.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/indicator/opencti_indicator_properties.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_attack_pattern.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_campaign.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_case_incident.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_case_rfi.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_case_rft.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_channel.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_course_of_action.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_data_component.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_data_source.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_event.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_external_reference.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_feedback.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_grouping.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_identity.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_incident.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_indicator.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_infrastructure.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_intrusion_set.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_kill_chain_phase.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_label.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_language.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_location.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_malware.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_malware_analysis.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_marking_definition.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_narrative.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_note.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_observed_data.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_opinion.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_report.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_stix.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_stix_core_object.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_stix_core_relationship.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_stix_cyber_observable.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_stix_domain_object.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_stix_nested_ref_relationship.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_stix_object_or_stix_relationship.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_stix_sighting_relationship.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_task.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_threat_actor.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_threat_actor_group.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_threat_actor_individual.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_tool.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_vocabulary.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/opencti_vulnerability.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/stix_cyber_observable/__init__.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_properties.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/utils/__init__.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/utils/constants.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/utils/opencti_logger.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/utils/opencti_stix2_identifier.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/utils/opencti_stix2_splitter.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/utils/opencti_stix2_update.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti/utils/opencti_stix2_utils.py +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti.egg-info/SOURCES.txt +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti.egg-info/dependency_links.txt +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti.egg-info/requires.txt +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pycti.egg-info/top_level.txt +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/pyproject.toml +0 -0
- {pycti-6.4.11 → pycti-6.5.1}/setup.cfg +0 -0
|
@@ -82,6 +82,24 @@ class OpenCTIApiWork:
|
|
|
82
82
|
except:
|
|
83
83
|
self.api.app_logger.error("Cannot report expectation")
|
|
84
84
|
|
|
85
|
+
def add_draft_context(self, work_id: str, draft_context: str):
|
|
86
|
+
if self.api.bundle_send_to_queue:
|
|
87
|
+
self.api.app_logger.info(
|
|
88
|
+
"Update draft context",
|
|
89
|
+
{"work_id": work_id, "draft_context": draft_context},
|
|
90
|
+
)
|
|
91
|
+
query = """
|
|
92
|
+
mutation addDraftContext($id: ID!, $draftContext: String) {
|
|
93
|
+
workEdit(id: $id) {
|
|
94
|
+
addDraftContext(draftContext: $draftContext)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
"""
|
|
98
|
+
try:
|
|
99
|
+
self.api.query(query, {"id": work_id, "draftContext": draft_context})
|
|
100
|
+
except:
|
|
101
|
+
self.api.app_logger.error("Cannot report draft context")
|
|
102
|
+
|
|
85
103
|
def initiate_work(self, connector_id: str, friendly_name: str) -> str:
|
|
86
104
|
if self.api.bundle_send_to_queue:
|
|
87
105
|
self.api.app_logger.info("Initiate work", {"connector_id": connector_id})
|
|
@@ -1732,6 +1732,8 @@ class OpenCTIConnectorHelper: # pylint: disable=too-many-public-methods
|
|
|
1732
1732
|
if bundle_send_to_queue:
|
|
1733
1733
|
if work_id:
|
|
1734
1734
|
self.api.work.add_expectations(work_id, expectations_number)
|
|
1735
|
+
if draft_id:
|
|
1736
|
+
self.api.work.add_draft_context(work_id, draft_id)
|
|
1735
1737
|
if entities_types is None:
|
|
1736
1738
|
entities_types = []
|
|
1737
1739
|
if self.queue_protocol == "amqp":
|
|
@@ -2407,6 +2407,19 @@ class OpenCTIStix2:
|
|
|
2407
2407
|
|
|
2408
2408
|
return bundle
|
|
2409
2409
|
|
|
2410
|
+
def apply_patch(self, item):
|
|
2411
|
+
input = item["opencti_field_patch"]
|
|
2412
|
+
if item["type"] == "relationship":
|
|
2413
|
+
self.opencti.stix_core_relationship.update_field(id=item["id"], input=input)
|
|
2414
|
+
elif item["type"] == "sighting":
|
|
2415
|
+
self.opencti.stix_sighting_relationship.update_field(
|
|
2416
|
+
id=item["id"], input=input
|
|
2417
|
+
)
|
|
2418
|
+
elif StixCyberObservableTypes.has_value(item["type"]):
|
|
2419
|
+
self.opencti.stix_cyber_observable.update_field(id=item["id"], input=input)
|
|
2420
|
+
else:
|
|
2421
|
+
self.opencti.stix_domain_object.update_field(id=item["id"], input=input)
|
|
2422
|
+
|
|
2410
2423
|
def import_item(
|
|
2411
2424
|
self,
|
|
2412
2425
|
item,
|
|
@@ -2426,6 +2439,8 @@ class OpenCTIStix2:
|
|
|
2426
2439
|
target_id = item["merge_target_id"]
|
|
2427
2440
|
source_ids = item["merge_source_ids"]
|
|
2428
2441
|
self.opencti.stix.merge(id=target_id, object_ids=source_ids)
|
|
2442
|
+
elif item["opencti_operation"] == "patch":
|
|
2443
|
+
self.apply_patch(item=item)
|
|
2429
2444
|
else:
|
|
2430
2445
|
raise ValueError("Not supported opencti_operation")
|
|
2431
2446
|
elif item["type"] == "relationship":
|
|
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
|