pycti 6.4.11__py3-none-any.whl → 6.5.1__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.

Potentially problematic release.


This version of pycti might be problematic. Click here for more details.

pycti/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- __version__ = "6.4.11"
2
+ __version__ = "6.5.1"
3
3
 
4
4
  from .api.opencti_api_client import OpenCTIApiClient
5
5
  from .api.opencti_api_connector import OpenCTIApiConnector
@@ -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":
@@ -3,7 +3,7 @@ import deprecation
3
3
 
4
4
  class StixCyberObservableDeprecatedMixin:
5
5
  """
6
- deprecated [>=6.2 & <6.5]`
6
+ deprecated [>=6.2 & <6.8]`
7
7
  Promote a Stix-Observable to an Indicator
8
8
 
9
9
  :param id: the Stix-Observable id
@@ -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":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pycti
3
- Version: 6.4.11
3
+ Version: 6.5.1
4
4
  Summary: Python API client for OpenCTI.
5
5
  Home-page: https://github.com/OpenCTI-Platform/client-python
6
6
  Author: Filigran
@@ -1,12 +1,12 @@
1
- pycti/__init__.py,sha256=Wo8hD5M5evAaGIDXf-FQwW7rZ-kcwPayoJ7Y5Qx2qUo,5219
1
+ pycti/__init__.py,sha256=EDjdNBXpv2xU_AQbYOiHSi_MofEgIVd8wu2Da6VISF8,5218
2
2
  pycti/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  pycti/api/opencti_api_client.py,sha256=OBXRNBbkYsbgqjxeY5iltHXIDeWqpFN3-SKsinkr66U,32402
4
4
  pycti/api/opencti_api_connector.py,sha256=ubM_zPjTD8L33TEugCQgf_YF9zugDFg_7FgNubGlwJw,5447
5
5
  pycti/api/opencti_api_playbook.py,sha256=456We78vESukfSOi_CctfZ9dbBJEi76EHClRc2f21Js,1628
6
- pycti/api/opencti_api_work.py,sha256=JLfl7oy6Cq9IrYW_kUrqwzN46FoVzyIn1JJQKyK0h_w,7615
6
+ pycti/api/opencti_api_work.py,sha256=qIRJMCfyC9odXf7LMRg9ImYizqF2WHUOU7Ty5IUFGg8,8351
7
7
  pycti/connector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  pycti/connector/opencti_connector.py,sha256=5oVvS27KWhzRiofJAeQPDtba-EP83FziSistyEd5l-U,2561
9
- pycti/connector/opencti_connector_helper.py,sha256=b-6ymDF3e4pfVxRhB13vj8Vwzo3h2TcV1iud6pPrKOk,80672
9
+ pycti/connector/opencti_connector_helper.py,sha256=Az_scgGMBsZ5_m6_DNsKL84pWgJbD_Lksa2CkWkWipg,80772
10
10
  pycti/connector/opencti_metric_handler.py,sha256=4jXHeJflomtHjuQ_YU0b36TG7o26vOWbY_jvU8Ezobs,3725
11
11
  pycti/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  pycti/entities/opencti_attack_pattern.py,sha256=rj3o2bFCoXniLmD9Ithi09S9Us8ab1G-GFLgqS8jll0,22237
@@ -57,18 +57,18 @@ pycti/entities/opencti_vulnerability.py,sha256=PxlfRKrwmkqU5E8o8WF04YRXJtCxBu5QB
57
57
  pycti/entities/indicator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  pycti/entities/indicator/opencti_indicator_properties.py,sha256=8X8YkCshM0gkHc9sQZ_WSNvVxOA4aTJmLta8ZG93HOU,5087
59
59
  pycti/entities/stix_cyber_observable/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_deprecated.py,sha256=BH65h6xBz7naG61t5nvBdhnGYnobNuiUZf8CJC4-nnc,1847
60
+ pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_deprecated.py,sha256=q-2G6OOqvUC1U2hSKxD8uT5T18M_IDkl72Tn1KoumQI,1847
61
61
  pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_properties.py,sha256=MN56CW8RWZwB0Pr8UiHZy_4nSzbgFbwdhSFKpsZ_d1Y,11293
62
62
  pycti/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
63
  pycti/utils/constants.py,sha256=ZgOVxY5bnrHiNvPgOfZLWk16sSDnaE_tg8JVjZpw24Q,11831
64
64
  pycti/utils/opencti_logger.py,sha256=0dvB75V0SuPFGxL539dAQrxTt1N5Acx0A3Ogwl5WMJ8,2199
65
- pycti/utils/opencti_stix2.py,sha256=1b63TSl3ImiKkSJQKhNgqrUbMRIEc-o2_1GQ1G-Y5bY,116949
65
+ pycti/utils/opencti_stix2.py,sha256=pUx1Oglb1EnREheMzmJBrmRS17vGnZzF8PCmB-pjNM0,117680
66
66
  pycti/utils/opencti_stix2_identifier.py,sha256=k8L1z4q1xdCBfxqUba4YS_kT-MmbJFxYh0RvfGOmrOs,837
67
67
  pycti/utils/opencti_stix2_splitter.py,sha256=etnAWMDzNi2JCovSUJ5Td-XLVdzgKRdsV1XfpXOGols,11070
68
68
  pycti/utils/opencti_stix2_update.py,sha256=CnMyqkeVA0jgyxEcgqna8sABU4YPMjkEJ228GVurIn4,14658
69
69
  pycti/utils/opencti_stix2_utils.py,sha256=xgBZzm7HC76rLQYwTKkaUd_w9jJnVMoryHx7KDDIB_g,5065
70
- pycti-6.4.11.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
71
- pycti-6.4.11.dist-info/METADATA,sha256=Fi_cj9nOtI1-hTgj9zWrTcocWyHn8BgdOk0-RaU1sZg,5420
72
- pycti-6.4.11.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
73
- pycti-6.4.11.dist-info/top_level.txt,sha256=cqEpxitAhHP4VgSA6xmrak6Yk9MeBkwoMTB6k7d2ZnE,6
74
- pycti-6.4.11.dist-info/RECORD,,
70
+ pycti-6.5.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
71
+ pycti-6.5.1.dist-info/METADATA,sha256=MAlkjZwkBgaOT5zmyFolpyg3y_eYxFlIx-7ngO-l9Dk,5419
72
+ pycti-6.5.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
73
+ pycti-6.5.1.dist-info/top_level.txt,sha256=cqEpxitAhHP4VgSA6xmrak6Yk9MeBkwoMTB6k7d2ZnE,6
74
+ pycti-6.5.1.dist-info/RECORD,,
File without changes