pycti 6.6.12__py3-none-any.whl → 6.6.14__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 +8 -3
- pycti/api/opencti_api_work.py +15 -14
- {pycti-6.6.12.dist-info → pycti-6.6.14.dist-info}/METADATA +2 -2
- {pycti-6.6.12.dist-info → pycti-6.6.14.dist-info}/RECORD +8 -8
- {pycti-6.6.12.dist-info → pycti-6.6.14.dist-info}/WHEEL +1 -1
- {pycti-6.6.12.dist-info → pycti-6.6.14.dist-info}/licenses/LICENSE +0 -0
- {pycti-6.6.12.dist-info → pycti-6.6.14.dist-info}/top_level.txt +0 -0
pycti/__init__.py
CHANGED
pycti/api/opencti_api_client.py
CHANGED
|
@@ -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=
|
|
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=
|
|
380
|
+
headers=query_headers,
|
|
376
381
|
verify=self.ssl_verify,
|
|
377
382
|
cert=self.cert,
|
|
378
383
|
proxies=self.proxies,
|
pycti/api/opencti_api_work.py
CHANGED
|
@@ -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(
|
|
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(
|
|
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,
|
|
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.
|
|
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.
|
|
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,9 +1,9 @@
|
|
|
1
|
-
pycti/__init__.py,sha256=
|
|
1
|
+
pycti/__init__.py,sha256=L2SzKd-fnNGudWerKZZbghKWpnPfTnZFNN1JgMzjxWo,5539
|
|
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=yV8noIFiy-wtMbJ64KKZ7G7wUFZ10L6tYInmL_fKkMw,34567
|
|
4
4
|
pycti/api/opencti_api_connector.py,sha256=8xwHuLINP3ZCImzE9_K_iCR9QEA3K6aHpK4bJhcZf20,5582
|
|
5
5
|
pycti/api/opencti_api_playbook.py,sha256=456We78vESukfSOi_CctfZ9dbBJEi76EHClRc2f21Js,1628
|
|
6
|
-
pycti/api/opencti_api_work.py,sha256=
|
|
6
|
+
pycti/api/opencti_api_work.py,sha256=V8n8KaLNiOUYTXYE251bC-yHMHiXSR_sf_0jk2RgANY,8456
|
|
7
7
|
pycti/connector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
pycti/connector/opencti_connector.py,sha256=8lCZFvcA9-S1x6vFl756hgWAlzKfrnq-C4AIdDJr-Kg,2715
|
|
9
9
|
pycti/connector/opencti_connector_helper.py,sha256=7LXAEIvEcStXK0tr199EBU4grn-ejf93ogbMU3tiyq8,88534
|
|
@@ -72,8 +72,8 @@ pycti/utils/opencti_stix2_identifier.py,sha256=k8L1z4q1xdCBfxqUba4YS_kT-MmbJFxYh
|
|
|
72
72
|
pycti/utils/opencti_stix2_splitter.py,sha256=etnAWMDzNi2JCovSUJ5Td-XLVdzgKRdsV1XfpXOGols,11070
|
|
73
73
|
pycti/utils/opencti_stix2_update.py,sha256=CnMyqkeVA0jgyxEcgqna8sABU4YPMjkEJ228GVurIn4,14658
|
|
74
74
|
pycti/utils/opencti_stix2_utils.py,sha256=xgBZzm7HC76rLQYwTKkaUd_w9jJnVMoryHx7KDDIB_g,5065
|
|
75
|
-
pycti-6.6.
|
|
76
|
-
pycti-6.6.
|
|
77
|
-
pycti-6.6.
|
|
78
|
-
pycti-6.6.
|
|
79
|
-
pycti-6.6.
|
|
75
|
+
pycti-6.6.14.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
76
|
+
pycti-6.6.14.dist-info/METADATA,sha256=Yb7mdOjfnCSpKLDUKgYiy4-8SpYeTlfmSrx3ErP-2vo,5531
|
|
77
|
+
pycti-6.6.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
78
|
+
pycti-6.6.14.dist-info/top_level.txt,sha256=cqEpxitAhHP4VgSA6xmrak6Yk9MeBkwoMTB6k7d2ZnE,6
|
|
79
|
+
pycti-6.6.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|