pycti 6.7.6__py3-none-any.whl → 6.7.8__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.7.6"
2
+ __version__ = "6.7.8"
3
3
 
4
4
  from .api.opencti_api_client import OpenCTIApiClient
5
5
  from .api.opencti_api_connector import OpenCTIApiConnector
@@ -2511,6 +2511,10 @@ class OpenCTIStix2:
2511
2511
  self.opencti.notification.update_field(
2512
2512
  id=item_id, input=field_patch_without_files
2513
2513
  )
2514
+ elif item["type"] == "user":
2515
+ self.opencti.user.update_field(
2516
+ id=item_id, input=field_patch_without_files
2517
+ )
2514
2518
  else:
2515
2519
  self.opencti.stix_domain_object.update_field(
2516
2520
  id=item_id, input=field_patch_without_files
@@ -2583,6 +2587,65 @@ class OpenCTIStix2:
2583
2587
  item["id"], organization_ids, sharing_direct_container
2584
2588
  )
2585
2589
 
2590
+ def element_add_organizations(self, item):
2591
+ organization_ids = self.opencti.get_attribute_in_extension(
2592
+ "organization_ids", item
2593
+ )
2594
+ if organization_ids is None:
2595
+ organization_ids = item["organization_ids"]
2596
+ if item["type"] == "user":
2597
+ for organization_id in organization_ids:
2598
+ self.opencti.user.add_organization(
2599
+ id=item["id"], organization_id=organization_id
2600
+ )
2601
+ else:
2602
+ raise ValueError(
2603
+ "Add organizations operation not compatible with type",
2604
+ {"type": item["type"]},
2605
+ )
2606
+
2607
+ def element_remove_organizations(self, item):
2608
+ organization_ids = self.opencti.get_attribute_in_extension(
2609
+ "organization_ids", item
2610
+ )
2611
+ if organization_ids is None:
2612
+ organization_ids = item["organization_ids"]
2613
+ if item["type"] == "user":
2614
+ for organization_id in organization_ids:
2615
+ self.opencti.user.delete_organization(
2616
+ id=item["id"], organization_id=organization_id
2617
+ )
2618
+ else:
2619
+ raise ValueError(
2620
+ "Remove organizations operation not compatible with type",
2621
+ {"type": item["type"]},
2622
+ )
2623
+
2624
+ def element_add_groups(self, item):
2625
+ group_ids = self.opencti.get_attribute_in_extension("group_ids", item)
2626
+ if group_ids is None:
2627
+ group_ids = item["group_ids"]
2628
+ if item["type"] == "user":
2629
+ for group_id in group_ids:
2630
+ self.opencti.user.add_membership(id=item["id"], group_id=group_id)
2631
+ else:
2632
+ raise ValueError(
2633
+ "Add groups operation not compatible with type", {"type": item["type"]}
2634
+ )
2635
+
2636
+ def element_remove_groups(self, item):
2637
+ group_ids = self.opencti.get_attribute_in_extension("group_ids", item)
2638
+ if group_ids is None:
2639
+ group_ids = item["group_ids"]
2640
+ if item["type"] == "user":
2641
+ for group_id in group_ids:
2642
+ self.opencti.user.delete_membership(id=item["id"], group_id=group_id)
2643
+ else:
2644
+ raise ValueError(
2645
+ "Remove groups operation not compatible with type",
2646
+ {"type": item["type"]},
2647
+ )
2648
+
2586
2649
  def element_operation_delete(self, item, operation):
2587
2650
  # If data is stix, just use the generic stix function for deletion
2588
2651
  force_delete = operation == "delete_force"
@@ -2665,6 +2728,14 @@ class OpenCTIStix2:
2665
2728
  self.opencti.stix_core_object.ask_enrichments(
2666
2729
  element_id=item["id"], connector_ids=connector_ids
2667
2730
  )
2731
+ elif operation == "add_organizations":
2732
+ self.element_add_organizations(item)
2733
+ elif operation == "remove_organizations":
2734
+ self.element_remove_organizations(item)
2735
+ elif operation == "add_groups":
2736
+ self.element_add_groups(item)
2737
+ elif operation == "remove_groups":
2738
+ self.element_remove_groups(item)
2668
2739
  else:
2669
2740
  raise ValueError(
2670
2741
  "Not supported opencti_operation",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycti
3
- Version: 6.7.6
3
+ Version: 6.7.8
4
4
  Summary: Python API client for OpenCTI.
5
5
  Home-page: https://github.com/OpenCTI-Platform/client-python
6
6
  Author: Filigran
@@ -30,13 +30,13 @@ Requires-Dist: python_json_logger~=3.3.0
30
30
  Requires-Dist: PyYAML~=6.0
31
31
  Requires-Dist: requests~=2.32.3
32
32
  Requires-Dist: setuptools~=80.9.0
33
- Requires-Dist: cachetools~=5.5.0
34
- Requires-Dist: prometheus-client~=0.21.1
35
- Requires-Dist: opentelemetry-api~=1.32.0
36
- Requires-Dist: opentelemetry-sdk~=1.32.0
33
+ Requires-Dist: cachetools~=5.5.2
34
+ Requires-Dist: prometheus-client~=0.22.1
35
+ Requires-Dist: opentelemetry-api~=1.35.0
36
+ Requires-Dist: opentelemetry-sdk~=1.35.0
37
37
  Requires-Dist: deprecation~=2.1.0
38
38
  Requires-Dist: fastapi<0.117.0,>=0.116.1
39
- Requires-Dist: uvicorn[standard]<0.35.0,>=0.33.0
39
+ Requires-Dist: uvicorn[standard]<0.36.0,>=0.35.0
40
40
  Requires-Dist: filigran-sseclient>=1.0.2
41
41
  Requires-Dist: stix2~=3.0.1
42
42
  Provides-Extra: dev
@@ -45,7 +45,7 @@ Requires-Dist: build~=1.2.1; extra == "dev"
45
45
  Requires-Dist: isort~=6.0.0; extra == "dev"
46
46
  Requires-Dist: types-pytz~=2025.2.0.20250326; extra == "dev"
47
47
  Requires-Dist: pre-commit~=4.2.0; extra == "dev"
48
- Requires-Dist: pytest-cases~=3.8.0; extra == "dev"
48
+ Requires-Dist: pytest-cases~=3.9.1; extra == "dev"
49
49
  Requires-Dist: pytest-cov~=6.2.1; extra == "dev"
50
50
  Requires-Dist: pytest_randomly~=3.16.0; extra == "dev"
51
51
  Requires-Dist: pytest~=8.4.1; extra == "dev"
@@ -1,4 +1,4 @@
1
- pycti/__init__.py,sha256=p99VIwu7pWKV_RI-QQJ1V-0_uCC4t_4fQC8uIGqsI9k,5676
1
+ pycti/__init__.py,sha256=i4RBruOMI_IJ2ScErGsmW4pa8WQtibF7qOcAUtGLCvY,5676
2
2
  pycti/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  pycti/api/opencti_api_client.py,sha256=lbygp2fOsmTKIrM-8Y7GxFzCZzdFStC0dhxyKYs0Wzo,35368
4
4
  pycti/api/opencti_api_connector.py,sha256=8xwHuLINP3ZCImzE9_K_iCR9QEA3K6aHpK4bJhcZf20,5582
@@ -74,13 +74,13 @@ pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_properties.py
74
74
  pycti/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
75
  pycti/utils/constants.py,sha256=VRYRvDm6hkTR0ZcHHWMzQBwqlPRskYnusBpgoX0S05A,12854
76
76
  pycti/utils/opencti_logger.py,sha256=BHNy9fJuTUTn_JEYSCmyvVwd6y-9ZJKxO40mY4iZ0bc,2226
77
- pycti/utils/opencti_stix2.py,sha256=PbdyUf7mpg7NO8253jEXBEg6WiDpgwPaPzzz-9dI0xw,130129
77
+ pycti/utils/opencti_stix2.py,sha256=xrAcpKa8Aclv1eH8WilhXeWpBfaWd7v4fAG0CsLKiMc,132995
78
78
  pycti/utils/opencti_stix2_identifier.py,sha256=k8L1z4q1xdCBfxqUba4YS_kT-MmbJFxYh0RvfGOmrOs,837
79
79
  pycti/utils/opencti_stix2_splitter.py,sha256=sjD9mN6jEea7Zr1k17rNiYaozLcDU4qg0HgIixXRHt4,11371
80
80
  pycti/utils/opencti_stix2_update.py,sha256=CnMyqkeVA0jgyxEcgqna8sABU4YPMjkEJ228GVurIn4,14658
81
81
  pycti/utils/opencti_stix2_utils.py,sha256=4vu-j3weP9IS3Ky31exOIw4t3fBg00emCTRlVpevrTU,5582
82
- pycti-6.7.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
83
- pycti-6.7.6.dist-info/METADATA,sha256=r3fiovVNL_wXkS5Cw8_7MHTTfXDDDG9gHc7i2litkog,5530
84
- pycti-6.7.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
85
- pycti-6.7.6.dist-info/top_level.txt,sha256=cqEpxitAhHP4VgSA6xmrak6Yk9MeBkwoMTB6k7d2ZnE,6
86
- pycti-6.7.6.dist-info/RECORD,,
82
+ pycti-6.7.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
83
+ pycti-6.7.8.dist-info/METADATA,sha256=17SpcCZ7QwI5UJvVj8z7ZDl7J1lTgNHyTZG2CxJ0_fQ,5530
84
+ pycti-6.7.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
85
+ pycti-6.7.8.dist-info/top_level.txt,sha256=cqEpxitAhHP4VgSA6xmrak6Yk9MeBkwoMTB6k7d2ZnE,6
86
+ pycti-6.7.8.dist-info/RECORD,,
File without changes