pycti 6.6.12__tar.gz → 6.6.14__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.

Files changed (84) hide show
  1. {pycti-6.6.12 → pycti-6.6.14}/PKG-INFO +2 -2
  2. {pycti-6.6.12 → pycti-6.6.14}/pycti/__init__.py +1 -1
  3. {pycti-6.6.12 → pycti-6.6.14}/pycti/api/opencti_api_client.py +8 -3
  4. {pycti-6.6.12 → pycti-6.6.14}/pycti/api/opencti_api_work.py +15 -14
  5. {pycti-6.6.12 → pycti-6.6.14}/pycti.egg-info/PKG-INFO +2 -2
  6. {pycti-6.6.12 → pycti-6.6.14}/pycti.egg-info/requires.txt +1 -1
  7. {pycti-6.6.12 → pycti-6.6.14}/setup.cfg +1 -1
  8. {pycti-6.6.12 → pycti-6.6.14}/LICENSE +0 -0
  9. {pycti-6.6.12 → pycti-6.6.14}/README.md +0 -0
  10. {pycti-6.6.12 → pycti-6.6.14}/pycti/api/__init__.py +0 -0
  11. {pycti-6.6.12 → pycti-6.6.14}/pycti/api/opencti_api_connector.py +0 -0
  12. {pycti-6.6.12 → pycti-6.6.14}/pycti/api/opencti_api_playbook.py +0 -0
  13. {pycti-6.6.12 → pycti-6.6.14}/pycti/connector/__init__.py +0 -0
  14. {pycti-6.6.12 → pycti-6.6.14}/pycti/connector/opencti_connector.py +0 -0
  15. {pycti-6.6.12 → pycti-6.6.14}/pycti/connector/opencti_connector_helper.py +0 -0
  16. {pycti-6.6.12 → pycti-6.6.14}/pycti/connector/opencti_metric_handler.py +0 -0
  17. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/__init__.py +0 -0
  18. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/indicator/__init__.py +0 -0
  19. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/indicator/opencti_indicator_properties.py +0 -0
  20. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_attack_pattern.py +0 -0
  21. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_campaign.py +0 -0
  22. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_capability.py +0 -0
  23. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_case_incident.py +0 -0
  24. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_case_rfi.py +0 -0
  25. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_case_rft.py +0 -0
  26. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_channel.py +0 -0
  27. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_course_of_action.py +0 -0
  28. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_data_component.py +0 -0
  29. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_data_source.py +0 -0
  30. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_event.py +0 -0
  31. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_external_reference.py +0 -0
  32. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_feedback.py +0 -0
  33. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_group.py +0 -0
  34. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_grouping.py +0 -0
  35. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_identity.py +0 -0
  36. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_incident.py +0 -0
  37. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_indicator.py +0 -0
  38. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_infrastructure.py +0 -0
  39. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_intrusion_set.py +0 -0
  40. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_kill_chain_phase.py +0 -0
  41. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_label.py +0 -0
  42. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_language.py +0 -0
  43. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_location.py +0 -0
  44. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_malware.py +0 -0
  45. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_malware_analysis.py +0 -0
  46. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_marking_definition.py +0 -0
  47. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_narrative.py +0 -0
  48. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_note.py +0 -0
  49. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_observed_data.py +0 -0
  50. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_opinion.py +0 -0
  51. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_report.py +0 -0
  52. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_role.py +0 -0
  53. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_settings.py +0 -0
  54. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_stix.py +0 -0
  55. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_stix_core_object.py +0 -0
  56. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_stix_core_relationship.py +0 -0
  57. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_stix_cyber_observable.py +0 -0
  58. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_stix_domain_object.py +0 -0
  59. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_stix_nested_ref_relationship.py +0 -0
  60. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_stix_object_or_stix_relationship.py +0 -0
  61. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_stix_sighting_relationship.py +0 -0
  62. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_task.py +0 -0
  63. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_threat_actor.py +0 -0
  64. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_threat_actor_group.py +0 -0
  65. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_threat_actor_individual.py +0 -0
  66. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_tool.py +0 -0
  67. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_user.py +0 -0
  68. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_vocabulary.py +0 -0
  69. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/opencti_vulnerability.py +0 -0
  70. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/stix_cyber_observable/__init__.py +0 -0
  71. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_deprecated.py +0 -0
  72. {pycti-6.6.12 → pycti-6.6.14}/pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_properties.py +0 -0
  73. {pycti-6.6.12 → pycti-6.6.14}/pycti/utils/__init__.py +0 -0
  74. {pycti-6.6.12 → pycti-6.6.14}/pycti/utils/constants.py +0 -0
  75. {pycti-6.6.12 → pycti-6.6.14}/pycti/utils/opencti_logger.py +0 -0
  76. {pycti-6.6.12 → pycti-6.6.14}/pycti/utils/opencti_stix2.py +0 -0
  77. {pycti-6.6.12 → pycti-6.6.14}/pycti/utils/opencti_stix2_identifier.py +0 -0
  78. {pycti-6.6.12 → pycti-6.6.14}/pycti/utils/opencti_stix2_splitter.py +0 -0
  79. {pycti-6.6.12 → pycti-6.6.14}/pycti/utils/opencti_stix2_update.py +0 -0
  80. {pycti-6.6.12 → pycti-6.6.14}/pycti/utils/opencti_stix2_utils.py +0 -0
  81. {pycti-6.6.12 → pycti-6.6.14}/pycti.egg-info/SOURCES.txt +0 -0
  82. {pycti-6.6.12 → pycti-6.6.14}/pycti.egg-info/dependency_links.txt +0 -0
  83. {pycti-6.6.12 → pycti-6.6.14}/pycti.egg-info/top_level.txt +0 -0
  84. {pycti-6.6.12 → pycti-6.6.14}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycti
3
- Version: 6.6.12
3
+ Version: 6.6.14
4
4
  Summary: Python API client for OpenCTI.
5
5
  Home-page: https://github.com/OpenCTI-Platform/client-python
6
6
  Author: Filigran
@@ -53,7 +53,7 @@ Requires-Dist: types-python-dateutil~=2.9.0; extra == "dev"
53
53
  Requires-Dist: wheel~=0.45.1; extra == "dev"
54
54
  Provides-Extra: doc
55
55
  Requires-Dist: autoapi~=2.0.1; extra == "doc"
56
- Requires-Dist: sphinx-autodoc-typehints~=3.1.0; extra == "doc"
56
+ Requires-Dist: sphinx-autodoc-typehints~=3.2.0; extra == "doc"
57
57
  Requires-Dist: sphinx-rtd-theme~=3.0.2; extra == "doc"
58
58
  Dynamic: license-file
59
59
 
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- __version__ = "6.6.12"
2
+ __version__ = "6.6.14"
3
3
 
4
4
  from .api.opencti_api_client import OpenCTIApiClient
5
5
  from .api.opencti_api_connector import OpenCTIApiConnector
@@ -264,13 +264,15 @@ class OpenCTIApiClient:
264
264
  "" if retry_number is None else str(retry_number)
265
265
  )
266
266
 
267
- def query(self, query, variables=None):
267
+ def query(self, query, variables=None, disable_impersonate=False):
268
268
  """submit a query to the OpenCTI GraphQL API
269
269
 
270
270
  :param query: GraphQL query string
271
271
  :type query: str
272
272
  :param variables: GraphQL query variables, defaults to {}
273
273
  :type variables: dict, optional
274
+ :param disable_impersonate: removes impersonate header if set to True, defaults to False
275
+ :type disable_impersonate: bool, optional
274
276
  :return: returns the response json content
275
277
  :rtype: Any
276
278
  """
@@ -295,6 +297,9 @@ class OpenCTIApiClient:
295
297
  else:
296
298
  query_var[key] = val
297
299
 
300
+ query_headers = self.request_headers.copy()
301
+ if disable_impersonate and "opencti-applicant-id" in query_headers:
302
+ del query_headers["opencti-applicant-id"]
298
303
  # If yes, transform variable (file to null) and create multipart query
299
304
  if len(files_vars) > 0:
300
305
  multipart_data = {
@@ -361,7 +366,7 @@ class OpenCTIApiClient:
361
366
  self.api_url,
362
367
  data=multipart_data,
363
368
  files=multipart_files,
364
- headers=self.request_headers,
369
+ headers=query_headers,
365
370
  verify=self.ssl_verify,
366
371
  cert=self.cert,
367
372
  proxies=self.proxies,
@@ -372,7 +377,7 @@ class OpenCTIApiClient:
372
377
  r = self.session.post(
373
378
  self.api_url,
374
379
  json={"query": query, "variables": variables},
375
- headers=self.request_headers,
380
+ headers=query_headers,
376
381
  verify=self.ssl_verify,
377
382
  cert=self.cert,
378
383
  proxies=self.proxies,
@@ -20,7 +20,7 @@ class OpenCTIApiWork:
20
20
  }
21
21
  }
22
22
  """
23
- self.api.query(query, {"id": work_id, "message": message})
23
+ self.api.query(query, {"id": work_id, "message": message}, True)
24
24
 
25
25
  def to_processed(self, work_id: str, message: str, in_error: bool = False):
26
26
  if self.api.bundle_send_to_queue:
@@ -35,7 +35,7 @@ class OpenCTIApiWork:
35
35
  }
36
36
  """
37
37
  self.api.query(
38
- query, {"id": work_id, "message": message, "inError": in_error}
38
+ query, {"id": work_id, "message": message, "inError": in_error}, True
39
39
  )
40
40
 
41
41
  def ping(self, work_id: str):
@@ -60,7 +60,7 @@ class OpenCTIApiWork:
60
60
  }
61
61
  """
62
62
  try:
63
- self.api.query(query, {"id": work_id, "error": error})
63
+ self.api.query(query, {"id": work_id, "error": error}, True)
64
64
  except:
65
65
  self.api.app_logger.error("Cannot report expectation")
66
66
 
@@ -78,7 +78,9 @@ class OpenCTIApiWork:
78
78
  }
79
79
  """
80
80
  try:
81
- self.api.query(query, {"id": work_id, "expectations": expectations})
81
+ self.api.query(
82
+ query, {"id": work_id, "expectations": expectations}, True
83
+ )
82
84
  except:
83
85
  self.api.app_logger.error("Cannot report expectation")
84
86
 
@@ -96,7 +98,9 @@ class OpenCTIApiWork:
96
98
  }
97
99
  """
98
100
  try:
99
- self.api.query(query, {"id": work_id, "draftContext": draft_context})
101
+ self.api.query(
102
+ query, {"id": work_id, "draftContext": draft_context}, True
103
+ )
100
104
  except:
101
105
  self.api.app_logger.error("Cannot report draft context")
102
106
 
@@ -111,7 +115,9 @@ class OpenCTIApiWork:
111
115
  }
112
116
  """
113
117
  work = self.api.query(
114
- query, {"connectorId": connector_id, "friendlyName": friendly_name}
118
+ query,
119
+ {"connectorId": connector_id, "friendlyName": friendly_name},
120
+ True,
115
121
  )
116
122
  return work["data"]["workAdd"]["id"]
117
123
 
@@ -122,10 +128,7 @@ class OpenCTIApiWork:
122
128
  delete
123
129
  }
124
130
  }"""
125
- work = self.api.query(
126
- query,
127
- {"workId": work_id},
128
- )
131
+ work = self.api.query(query, {"workId": work_id}, True)
129
132
  return work["data"]
130
133
 
131
134
  def wait_for_work_to_finish(self, work_id: str):
@@ -179,10 +182,7 @@ class OpenCTIApiWork:
179
182
  }
180
183
  }
181
184
  """
182
- result = self.api.query(
183
- query,
184
- {"id": work_id},
185
- )
185
+ result = self.api.query(query, {"id": work_id}, True)
186
186
  return result["data"]["work"]
187
187
 
188
188
  def get_connector_works(self, connector_id: str) -> List[Dict]:
@@ -243,6 +243,7 @@ class OpenCTIApiWork:
243
243
  "filterGroups": [],
244
244
  },
245
245
  },
246
+ True,
246
247
  )
247
248
  result = result["data"]["works"]["edges"]
248
249
  return_value = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycti
3
- Version: 6.6.12
3
+ Version: 6.6.14
4
4
  Summary: Python API client for OpenCTI.
5
5
  Home-page: https://github.com/OpenCTI-Platform/client-python
6
6
  Author: Filigran
@@ -53,7 +53,7 @@ Requires-Dist: types-python-dateutil~=2.9.0; extra == "dev"
53
53
  Requires-Dist: wheel~=0.45.1; extra == "dev"
54
54
  Provides-Extra: doc
55
55
  Requires-Dist: autoapi~=2.0.1; extra == "doc"
56
- Requires-Dist: sphinx-autodoc-typehints~=3.1.0; extra == "doc"
56
+ Requires-Dist: sphinx-autodoc-typehints~=3.2.0; extra == "doc"
57
57
  Requires-Dist: sphinx-rtd-theme~=3.0.2; extra == "doc"
58
58
  Dynamic: license-file
59
59
 
@@ -36,5 +36,5 @@ wheel~=0.45.1
36
36
 
37
37
  [doc]
38
38
  autoapi~=2.0.1
39
- sphinx-autodoc-typehints~=3.1.0
39
+ sphinx-autodoc-typehints~=3.2.0
40
40
  sphinx-rtd-theme~=3.0.2
@@ -68,7 +68,7 @@ dev =
68
68
  wheel~=0.45.1
69
69
  doc =
70
70
  autoapi~=2.0.1
71
- sphinx-autodoc-typehints~=3.1.0
71
+ sphinx-autodoc-typehints~=3.2.0
72
72
  sphinx-rtd-theme~=3.0.2
73
73
 
74
74
  [egg_info]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes