pycti 5.12.28__tar.gz → 5.12.30__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 (73) hide show
  1. {pycti-5.12.28 → pycti-5.12.30}/PKG-INFO +1 -1
  2. {pycti-5.12.28 → pycti-5.12.30}/pycti/__init__.py +1 -1
  3. {pycti-5.12.28 → pycti-5.12.30}/pycti/api/opencti_api_client.py +16 -11
  4. {pycti-5.12.28 → pycti-5.12.30}/pycti.egg-info/PKG-INFO +1 -1
  5. {pycti-5.12.28 → pycti-5.12.30}/LICENSE +0 -0
  6. {pycti-5.12.28 → pycti-5.12.30}/README.md +0 -0
  7. {pycti-5.12.28 → pycti-5.12.30}/pycti/api/__init__.py +0 -0
  8. {pycti-5.12.28 → pycti-5.12.30}/pycti/api/opencti_api_connector.py +0 -0
  9. {pycti-5.12.28 → pycti-5.12.30}/pycti/api/opencti_api_playbook.py +0 -0
  10. {pycti-5.12.28 → pycti-5.12.30}/pycti/api/opencti_api_work.py +0 -0
  11. {pycti-5.12.28 → pycti-5.12.30}/pycti/connector/__init__.py +0 -0
  12. {pycti-5.12.28 → pycti-5.12.30}/pycti/connector/opencti_connector.py +0 -0
  13. {pycti-5.12.28 → pycti-5.12.30}/pycti/connector/opencti_connector_helper.py +0 -0
  14. {pycti-5.12.28 → pycti-5.12.30}/pycti/connector/opencti_metric_handler.py +0 -0
  15. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/__init__.py +0 -0
  16. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_attack_pattern.py +0 -0
  17. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_campaign.py +0 -0
  18. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_case_incident.py +0 -0
  19. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_case_rfi.py +0 -0
  20. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_case_rft.py +0 -0
  21. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_channel.py +0 -0
  22. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_course_of_action.py +0 -0
  23. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_data_component.py +0 -0
  24. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_data_source.py +0 -0
  25. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_event.py +0 -0
  26. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_external_reference.py +0 -0
  27. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_feedback.py +0 -0
  28. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_grouping.py +0 -0
  29. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_identity.py +0 -0
  30. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_incident.py +0 -0
  31. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_indicator.py +0 -0
  32. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_infrastructure.py +0 -0
  33. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_intrusion_set.py +0 -0
  34. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_kill_chain_phase.py +0 -0
  35. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_label.py +0 -0
  36. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_language.py +0 -0
  37. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_location.py +0 -0
  38. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_malware.py +0 -0
  39. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_malware_analysis.py +0 -0
  40. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_marking_definition.py +0 -0
  41. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_narrative.py +0 -0
  42. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_note.py +0 -0
  43. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_observed_data.py +0 -0
  44. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_opinion.py +0 -0
  45. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_report.py +0 -0
  46. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_stix.py +0 -0
  47. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_stix_core_object.py +0 -0
  48. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_stix_core_relationship.py +0 -0
  49. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_stix_cyber_observable.py +0 -0
  50. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_stix_domain_object.py +0 -0
  51. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_stix_nested_ref_relationship.py +0 -0
  52. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_stix_object_or_stix_relationship.py +0 -0
  53. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_stix_sighting_relationship.py +0 -0
  54. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_task.py +0 -0
  55. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_threat_actor.py +0 -0
  56. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_threat_actor_group.py +0 -0
  57. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_threat_actor_individual.py +0 -0
  58. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_tool.py +0 -0
  59. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_vocabulary.py +0 -0
  60. {pycti-5.12.28 → pycti-5.12.30}/pycti/entities/opencti_vulnerability.py +0 -0
  61. {pycti-5.12.28 → pycti-5.12.30}/pycti/utils/__init__.py +0 -0
  62. {pycti-5.12.28 → pycti-5.12.30}/pycti/utils/constants.py +0 -0
  63. {pycti-5.12.28 → pycti-5.12.30}/pycti/utils/opencti_logger.py +0 -0
  64. {pycti-5.12.28 → pycti-5.12.30}/pycti/utils/opencti_stix2.py +0 -0
  65. {pycti-5.12.28 → pycti-5.12.30}/pycti/utils/opencti_stix2_splitter.py +0 -0
  66. {pycti-5.12.28 → pycti-5.12.30}/pycti/utils/opencti_stix2_update.py +0 -0
  67. {pycti-5.12.28 → pycti-5.12.30}/pycti/utils/opencti_stix2_utils.py +0 -0
  68. {pycti-5.12.28 → pycti-5.12.30}/pycti.egg-info/SOURCES.txt +0 -0
  69. {pycti-5.12.28 → pycti-5.12.30}/pycti.egg-info/dependency_links.txt +0 -0
  70. {pycti-5.12.28 → pycti-5.12.30}/pycti.egg-info/requires.txt +0 -0
  71. {pycti-5.12.28 → pycti-5.12.30}/pycti.egg-info/top_level.txt +0 -0
  72. {pycti-5.12.28 → pycti-5.12.30}/pyproject.toml +0 -0
  73. {pycti-5.12.28 → pycti-5.12.30}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycti
3
- Version: 5.12.28
3
+ Version: 5.12.30
4
4
  Summary: Python API client for OpenCTI.
5
5
  Home-page: https://github.com/OpenCTI-Platform/client-python
6
6
  Author: Filigran
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- __version__ = "5.12.28"
2
+ __version__ = "5.12.30"
3
3
 
4
4
  from .api.opencti_api_client import OpenCTIApiClient
5
5
  from .api.opencti_api_connector import OpenCTIApiConnector
@@ -4,6 +4,7 @@ import datetime
4
4
  import io
5
5
  import json
6
6
  from typing import Union
7
+ from urllib.parse import urljoin
7
8
 
8
9
  import magic
9
10
  import requests
@@ -110,6 +111,7 @@ class OpenCTIApiClient:
110
111
  json_logging=False,
111
112
  cert=None,
112
113
  auth=None,
114
+ perform_health_check=True,
113
115
  ):
114
116
  """Constructor method"""
115
117
 
@@ -128,7 +130,7 @@ class OpenCTIApiClient:
128
130
 
129
131
  # Define API
130
132
  self.api_token = token
131
- self.api_url = url + "/graphql"
133
+ self.api_url = urljoin(url, "/graphql")
132
134
  self.request_headers = {
133
135
  "User-Agent": "pycti/" + __version__,
134
136
  "Authorization": "Bearer " + token,
@@ -196,7 +198,7 @@ class OpenCTIApiClient:
196
198
  self.indicator = Indicator(self)
197
199
 
198
200
  # Check if openCTI is available
199
- if not self.health_check():
201
+ if perform_health_check and not self.health_check():
200
202
  raise ValueError(
201
203
  "OpenCTI API is not reachable. Waiting for OpenCTI API to start or check your configuration..."
202
204
  )
@@ -209,12 +211,15 @@ class OpenCTIApiClient:
209
211
  "true" if synchronized is True else "false"
210
212
  )
211
213
 
214
+ def get_request_headers(self):
215
+ return self.request_headers
216
+
212
217
  def set_retry_number(self, retry_number):
213
218
  self.request_headers["opencti-retry-number"] = (
214
219
  "" if retry_number is None else str(retry_number)
215
220
  )
216
221
 
217
- def query(self, query, variables={}):
222
+ def query(self, query, variables=None):
218
223
  """submit a query to the OpenCTI GraphQL API
219
224
 
220
225
  :param query: GraphQL query string
@@ -224,7 +229,7 @@ class OpenCTIApiClient:
224
229
  :return: returns the response json content
225
230
  :rtype: Any
226
231
  """
227
-
232
+ variables = variables or {}
228
233
  query_var = {}
229
234
  files_vars = []
230
235
  # Implementation of spec https://github.com/jaydenseric/graphql-multipart-request-spec
@@ -376,15 +381,15 @@ class OpenCTIApiClient:
376
381
  :rtype: bool
377
382
  """
378
383
  try:
379
- self.app_logger.info("Health check (me)...")
384
+ self.app_logger.info("Health check (platform version)...")
380
385
  test = self.query(
381
386
  """
382
- query {
383
- me {
384
- id
385
- }
386
- }
387
- """
387
+ query {
388
+ about {
389
+ version
390
+ }
391
+ }
392
+ """
388
393
  )
389
394
  if test is not None:
390
395
  return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycti
3
- Version: 5.12.28
3
+ Version: 5.12.30
4
4
  Summary: Python API client for OpenCTI.
5
5
  Home-page: https://github.com/OpenCTI-Platform/client-python
6
6
  Author: Filigran
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes