pycti 5.12.29__py3-none-any.whl → 5.12.30__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 +1 -1
- pycti/api/opencti_api_client.py +16 -11
- {pycti-5.12.29.dist-info → pycti-5.12.30.dist-info}/METADATA +1 -1
- {pycti-5.12.29.dist-info → pycti-5.12.30.dist-info}/RECORD +7 -7
- {pycti-5.12.29.dist-info → pycti-5.12.30.dist-info}/LICENSE +0 -0
- {pycti-5.12.29.dist-info → pycti-5.12.30.dist-info}/WHEEL +0 -0
- {pycti-5.12.29.dist-info → pycti-5.12.30.dist-info}/top_level.txt +0 -0
pycti/__init__.py
CHANGED
pycti/api/opencti_api_client.py
CHANGED
|
@@ -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
|
|
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 (
|
|
384
|
+
self.app_logger.info("Health check (platform version)...")
|
|
380
385
|
test = self.query(
|
|
381
386
|
"""
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
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
|
-
pycti/__init__.py,sha256=
|
|
1
|
+
pycti/__init__.py,sha256=lDF77TRWtXw0Qa5AIzk4pzk5nq7nkbsC-rhuFwnN6GQ,4693
|
|
2
2
|
pycti/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
pycti/api/opencti_api_client.py,sha256=
|
|
3
|
+
pycti/api/opencti_api_client.py,sha256=iTOlkLW8LZybU20XhuzSqmxuH2DG-KirvAmZsHSig00,28887
|
|
4
4
|
pycti/api/opencti_api_connector.py,sha256=fYF0Jy9KIMFNt1RC_A1rpWomVJ-oj5HiSsBem4W0J5U,3549
|
|
5
5
|
pycti/api/opencti_api_playbook.py,sha256=Wcf-G__IHmR7LwtUFVUVx4Skg9e2mcb89n_HyfWC9YM,1383
|
|
6
6
|
pycti/api/opencti_api_work.py,sha256=ow30gswv4k5zLlZGlvLAn47ZM07RLsYvEV-KwtwedQg,7109
|
|
@@ -61,8 +61,8 @@ pycti/utils/opencti_stix2.py,sha256=VsPlUBed3YGmd2eTBpD3r8p-aYZFFwgruKNmsV_KYqQ,
|
|
|
61
61
|
pycti/utils/opencti_stix2_splitter.py,sha256=Ht9Mp-W3gbwxIKEr7i_5NYpcDr3TA2gYdC4TzOz0G4c,4496
|
|
62
62
|
pycti/utils/opencti_stix2_update.py,sha256=CnMyqkeVA0jgyxEcgqna8sABU4YPMjkEJ228GVurIn4,14658
|
|
63
63
|
pycti/utils/opencti_stix2_utils.py,sha256=_ijIz6SRP2OeIaWJcXJt8go510MUEGfWE3KY-I_9QZc,3725
|
|
64
|
-
pycti-5.12.
|
|
65
|
-
pycti-5.12.
|
|
66
|
-
pycti-5.12.
|
|
67
|
-
pycti-5.12.
|
|
68
|
-
pycti-5.12.
|
|
64
|
+
pycti-5.12.30.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
65
|
+
pycti-5.12.30.dist-info/METADATA,sha256=M2CCKhs2rBFp_xRcqGQw7CKLQTmBEZs_66Su_TdKDic,5304
|
|
66
|
+
pycti-5.12.30.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
67
|
+
pycti-5.12.30.dist-info/top_level.txt,sha256=cqEpxitAhHP4VgSA6xmrak6Yk9MeBkwoMTB6k7d2ZnE,6
|
|
68
|
+
pycti-5.12.30.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|