pycti 6.7.10__py3-none-any.whl → 6.7.12__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.10"
2
+ __version__ = "6.7.12"
3
3
 
4
4
  from .api.opencti_api_client import OpenCTIApiClient
5
5
  from .api.opencti_api_connector import OpenCTIApiConnector
@@ -783,9 +783,10 @@ class ListenStream(threading.Thread):
783
783
  # state can be None if reset from the UI
784
784
  # In this case, default parameters will be used but SSE Client needs to be restarted
785
785
  if state is None:
786
- self.exit = True
787
- state["start_from"] = str(msg.id)
788
- self.helper.set_state(state)
786
+ self.exit_event.set()
787
+ else:
788
+ state["start_from"] = str(msg.id)
789
+ self.helper.set_state(state)
789
790
  except Exception as ex:
790
791
  self.helper.connector_logger.error(
791
792
  "Error in ListenStream loop, exit.", {"reason": str(ex)}
@@ -785,6 +785,28 @@ class User:
785
785
  result["data"]["userEdit"]["tokenRenew"]
786
786
  )
787
787
 
788
+ def send_mail(self, **kwargs):
789
+ id = kwargs.get("id", None)
790
+ template_id = kwargs.get("template_id", None)
791
+ if id is None or template_id is None:
792
+ self.opencti.admin_logger.error(
793
+ "[opencti_user] Missing parameters: id and template_id"
794
+ )
795
+
796
+ self.opencti.admin_logger.info(
797
+ "Send email to user", {"id": id, "template_id": template_id}
798
+ )
799
+ input = {
800
+ "target_user_id": id,
801
+ "email_template_id": template_id,
802
+ }
803
+ query = """
804
+ mutation SendUserMail($input: SendUserMailInput!) {
805
+ sendUserMail(input: $input)
806
+ }
807
+ """
808
+ self.opencti.query(query, {"input": input})
809
+
788
810
  def process_multiple_fields(self, data):
789
811
  if "roles" in data:
790
812
  data["roles"] = self.opencti.process_multiple(data["roles"])
@@ -2646,11 +2646,25 @@ class OpenCTIStix2:
2646
2646
  {"type": item["type"]},
2647
2647
  )
2648
2648
 
2649
+ def send_email(self, item):
2650
+ template_id = self.opencti.get_attribute_in_extension("template_id", item)
2651
+ if template_id is None:
2652
+ template_id = item["template_id"]
2653
+ if item["type"] == "user":
2654
+ self.opencti.user.send_mail(id=item["id"], template_id=template_id[0])
2655
+ else:
2656
+ raise ValueError(
2657
+ "Not supported opencti_operation for this type",
2658
+ {"type": item["type"]},
2659
+ )
2660
+
2649
2661
  def element_operation_delete(self, item, operation):
2650
2662
  # If data is stix, just use the generic stix function for deletion
2651
2663
  force_delete = operation == "delete_force"
2652
2664
  if item["type"] == "relationship":
2653
2665
  self.opencti.stix_core_relationship.delete(id=item["id"])
2666
+ elif item["type"] == "external-reference":
2667
+ self.opencti.external_reference.delete(item["id"])
2654
2668
  elif item["type"] == "sighting":
2655
2669
  self.opencti.stix_sighting_relationship.delete(id=item["id"])
2656
2670
  elif item["type"] in STIX_META_OBJECTS:
@@ -2736,6 +2750,8 @@ class OpenCTIStix2:
2736
2750
  self.element_add_groups(item)
2737
2751
  elif operation == "remove_groups":
2738
2752
  self.element_remove_groups(item)
2753
+ elif operation == "send_email":
2754
+ self.send_email(item=item)
2739
2755
  else:
2740
2756
  raise ValueError(
2741
2757
  "Not supported opencti_operation",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycti
3
- Version: 6.7.10
3
+ Version: 6.7.12
4
4
  Summary: Python API client for OpenCTI.
5
5
  Home-page: https://github.com/OpenCTI-Platform/client-python
6
6
  Author: Filigran
@@ -23,20 +23,20 @@ Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
24
  Requires-Dist: datefinder~=0.7.3
25
25
  Requires-Dist: pika~=1.3.0
26
- Requires-Dist: pydantic~=2.11.3
26
+ Requires-Dist: pydantic<3,>=2.8.2
27
27
  Requires-Dist: python-magic~=0.4.27; sys_platform == "linux" or sys_platform == "darwin"
28
28
  Requires-Dist: python-magic-bin~=0.4.14; sys_platform == "win32"
29
29
  Requires-Dist: python_json_logger~=3.3.0
30
30
  Requires-Dist: PyYAML~=6.0
31
- Requires-Dist: requests~=2.32.3
31
+ Requires-Dist: requests<3,>=2.32.0
32
32
  Requires-Dist: setuptools~=80.9.0
33
33
  Requires-Dist: cachetools~=5.5.2
34
34
  Requires-Dist: prometheus-client~=0.22.1
35
35
  Requires-Dist: opentelemetry-api~=1.35.0
36
36
  Requires-Dist: opentelemetry-sdk~=1.35.0
37
37
  Requires-Dist: deprecation~=2.1.0
38
- Requires-Dist: fastapi<0.117.0,>=0.116.1
39
- Requires-Dist: uvicorn[standard]<0.36.0,>=0.35.0
38
+ Requires-Dist: fastapi<0.117.0,>=0.115.2
39
+ Requires-Dist: uvicorn[standard]<0.36.0,>=0.34.0
40
40
  Requires-Dist: filigran-sseclient>=1.0.2
41
41
  Requires-Dist: stix2~=3.0.1
42
42
  Provides-Extra: dev
@@ -1,4 +1,4 @@
1
- pycti/__init__.py,sha256=HfmZ_1QYkh-QxJhudx-KmVJ7tWtNpmzMeE7u70Gy1SI,5677
1
+ pycti/__init__.py,sha256=8LDJmJrjDLjmwtfz6YwwOCO0jDQeTRCAsF7zP5EAZig,5677
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
@@ -13,7 +13,7 @@ pycti/api/opencti_api_work.py,sha256=uV1mbPz3zmNZjoNHVmX6SyWPQKEHkpSDXkb_a2NIOA4
13
13
  pycti/api/opencti_api_workspace.py,sha256=ycqOTEXeUHF2k8H4jhoYDd1W6ijFcNUjYf4eSdLpH0k,611
14
14
  pycti/connector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  pycti/connector/opencti_connector.py,sha256=8lCZFvcA9-S1x6vFl756hgWAlzKfrnq-C4AIdDJr-Kg,2715
16
- pycti/connector/opencti_connector_helper.py,sha256=qsJ9HTuoWjl2xP0FsOwnobmvLKkL0oBC1QlcHVD8_jw,88629
16
+ pycti/connector/opencti_connector_helper.py,sha256=Wh4OYpQyVp-SzIbBeyMePCPyn02MLLErTSIeZu6wxUU,88672
17
17
  pycti/connector/opencti_metric_handler.py,sha256=4jXHeJflomtHjuQ_YU0b36TG7o26vOWbY_jvU8Ezobs,3725
18
18
  pycti/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  pycti/entities/opencti_attack_pattern.py,sha256=HVfLhtd8rlT42xutRS8qOkDsG5_Ws4EoGfObLW5mQl4,22535
@@ -63,7 +63,7 @@ pycti/entities/opencti_threat_actor.py,sha256=vFPeo0pOYSqHBKVlWc4o8RjuP2PP0A09KW
63
63
  pycti/entities/opencti_threat_actor_group.py,sha256=dV28sDfADoDpATyk8w2fN1ZGOoad3LCk7lnij3nFBY8,20828
64
64
  pycti/entities/opencti_threat_actor_individual.py,sha256=l-E0RShOofXTZgw2HUyrDprXm8K3yvxh620hqAl-a-4,21178
65
65
  pycti/entities/opencti_tool.py,sha256=GXeTfWkTgNxFnNGPsO03BOK2dsZGCp5IT-leQHiFWtw,15462
66
- pycti/entities/opencti_user.py,sha256=zJKhJCvC2N5-3E92uFad2CwiQhCWVAHYrgomzqBwD-s,29735
66
+ pycti/entities/opencti_user.py,sha256=XrsD84uKiItk2AUucM682Zjb1ikAQIRF17MS969TGQ4,30492
67
67
  pycti/entities/opencti_vocabulary.py,sha256=xupdHJ6TznCmvI3sVYU261SnfblSNc1nwg19MG9yrao,6499
68
68
  pycti/entities/opencti_vulnerability.py,sha256=7SDIOpIxuJp3syouPC2M8zFYcSep5y1wBVfoG79HTMA,53216
69
69
  pycti/entities/indicator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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=xrAcpKa8Aclv1eH8WilhXeWpBfaWd7v4fAG0CsLKiMc,132995
77
+ pycti/utils/opencti_stix2.py,sha256=d8neEswXJCsuobSQHJ-PnbvY3RFVftfqgs7WOH-46k0,133663
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.10.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
83
- pycti-6.7.10.dist-info/METADATA,sha256=-lQO8GSWcJ400zgMciTKlAakVqKypf7Klx3s4ABduJE,5531
84
- pycti-6.7.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
85
- pycti-6.7.10.dist-info/top_level.txt,sha256=cqEpxitAhHP4VgSA6xmrak6Yk9MeBkwoMTB6k7d2ZnE,6
86
- pycti-6.7.10.dist-info/RECORD,,
82
+ pycti-6.7.12.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
83
+ pycti-6.7.12.dist-info/METADATA,sha256=DncAwtiRcj1Vthje2J5VjSDJQCylEcZAFE0FwddE-3E,5536
84
+ pycti-6.7.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
85
+ pycti-6.7.12.dist-info/top_level.txt,sha256=cqEpxitAhHP4VgSA6xmrak6Yk9MeBkwoMTB6k7d2ZnE,6
86
+ pycti-6.7.12.dist-info/RECORD,,
File without changes