pycti 6.8.2__py3-none-any.whl → 6.8.4__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.8.2"
2
+ __version__ = "6.8.4"
3
3
 
4
4
  from .api.opencti_api_client import OpenCTIApiClient
5
5
  from .api.opencti_api_connector import OpenCTIApiConnector
@@ -95,7 +95,7 @@ class Vocabulary:
95
95
  )
96
96
  return None
97
97
 
98
- def handle_vocab(self, vocab, cache, field):
98
+ def read_or_create_unchecked_with_cache(self, vocab, cache, field):
99
99
  if "vocab_" + vocab in cache:
100
100
  vocab_data = cache["vocab_" + vocab]
101
101
  else:
@@ -360,17 +360,23 @@ class OpenCTIStix2:
360
360
  if isinstance(stix_object.get(f["key"]), list):
361
361
  object_open_vocabularies[f["key"]] = []
362
362
  for vocab in stix_object[f["key"]]:
363
- object_open_vocabularies[f["key"]].append(
364
- self.opencti.vocabulary.handle_vocab(
363
+ resolved_vocab = (
364
+ self.opencti.vocabulary.read_or_create_unchecked_with_cache(
365
365
  vocab, self.mapping_cache_permanent, field=f
366
- )["name"]
366
+ )
367
367
  )
368
+ if resolved_vocab is not None:
369
+ object_open_vocabularies[f["key"]].append(
370
+ resolved_vocab["name"]
371
+ )
368
372
  else:
369
- object_open_vocabularies[f["key"]] = (
370
- self.opencti.vocabulary.handle_vocab(
373
+ resolved_vocab = (
374
+ self.opencti.vocabulary.read_or_create_unchecked_with_cache(
371
375
  stix_object[f["key"]], self.mapping_cache_permanent, field=f
372
- )["name"]
376
+ )
373
377
  )
378
+ if resolved_vocab is not None:
379
+ object_open_vocabularies[f["key"]] = resolved_vocab["name"]
374
380
 
375
381
  # Object Labels
376
382
  object_label_ids = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycti
3
- Version: 6.8.2
3
+ Version: 6.8.4
4
4
  Summary: Python API client for OpenCTI.
5
5
  Home-page: https://github.com/OpenCTI-Platform/client-python
6
6
  Author: Filigran
@@ -148,6 +148,20 @@ Integration testing
148
148
  $ pytest ./tests/02-integration/
149
149
  ```
150
150
 
151
+ Example testing:
152
+
153
+ > OpenCTI must be running
154
+
155
+ ```bash
156
+ cd examples
157
+ # Configure with you local instance of OpenCTI
158
+ export OPENCTI_API_URL="http://localhost:4000"
159
+ export OPENCTI_API_TOKEN="xxxxxxxxxxxxxxxxxxxxxx"
160
+
161
+ #Run one example file
162
+ python get_indicators_of_malware.py
163
+ ```
164
+
151
165
  ## About
152
166
 
153
167
  OpenCTI is a product designed and developed by the company [Filigran](https://filigran.io).
@@ -1,4 +1,4 @@
1
- pycti/__init__.py,sha256=V7qOweYblXS-RKKSgHV0WQnAgwhK-GeJ5WsAagtE10k,5676
1
+ pycti/__init__.py,sha256=4vHb_HgB17gWCbjyhJQDRoHuOokQYfnXgrbW3LLy1rk,5676
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
@@ -64,7 +64,7 @@ pycti/entities/opencti_threat_actor_group.py,sha256=dV28sDfADoDpATyk8w2fN1ZGOoad
64
64
  pycti/entities/opencti_threat_actor_individual.py,sha256=l-E0RShOofXTZgw2HUyrDprXm8K3yvxh620hqAl-a-4,21178
65
65
  pycti/entities/opencti_tool.py,sha256=WHCnTzgYyrWB_vaksoY5CRGgZjqANeza3a3b8cTeVKI,16932
66
66
  pycti/entities/opencti_user.py,sha256=XrsD84uKiItk2AUucM682Zjb1ikAQIRF17MS969TGQ4,30492
67
- pycti/entities/opencti_vocabulary.py,sha256=wxVfWyeI_O0zqQYtX5xAOOkZDSQi1UQiGazcJKRg5Tg,6720
67
+ pycti/entities/opencti_vocabulary.py,sha256=JJFls8bkp5cIWBJ6xU7pLk4VcwATw6xadjuOhTOk4Qw,6743
68
68
  pycti/entities/opencti_vulnerability.py,sha256=zMIbVIOAclUcThSi-u-OL_xgBLmroXVkF4H2E7PpOxo,53444
69
69
  pycti/entities/indicator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
70
  pycti/entities/indicator/opencti_indicator_properties.py,sha256=iQvSeMHB-vSTzINnRxqIJfC3OgMHyhbXUVF2juU7DoE,5219
@@ -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=MApWthWJrSeBI0rumnhLhBtanjrtmfP6PJqOiQjcCOY,4091
77
- pycti/utils/opencti_stix2.py,sha256=xeBh1tMh_8k6tcfy7aYSM1OryhhzBdIuMtuRZlKTO6w,135505
77
+ pycti/utils/opencti_stix2.py,sha256=nBBZ4kN1tds6rkd-z4LUuUsaLMIBzWt4WYaipbm_PVs,135837
78
78
  pycti/utils/opencti_stix2_identifier.py,sha256=k8L1z4q1xdCBfxqUba4YS_kT-MmbJFxYh0RvfGOmrOs,837
79
79
  pycti/utils/opencti_stix2_splitter.py,sha256=wOOgPM5FYYbCEhFAg9om54AzyNRwK_RzocsJJ6kViqY,11489
80
80
  pycti/utils/opencti_stix2_update.py,sha256=CnMyqkeVA0jgyxEcgqna8sABU4YPMjkEJ228GVurIn4,14658
81
81
  pycti/utils/opencti_stix2_utils.py,sha256=10CF7ip1XEURyd6EUMDpBHPQvmi5uGUxh1QDOw6LKJk,6955
82
- pycti-6.8.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
83
- pycti-6.8.2.dist-info/METADATA,sha256=eEYd1gzDg-naMxxKMuIRfJ7Im6pEPuEKpC53kNMOEg8,5535
84
- pycti-6.8.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
85
- pycti-6.8.2.dist-info/top_level.txt,sha256=cqEpxitAhHP4VgSA6xmrak6Yk9MeBkwoMTB6k7d2ZnE,6
86
- pycti-6.8.2.dist-info/RECORD,,
82
+ pycti-6.8.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
83
+ pycti-6.8.4.dist-info/METADATA,sha256=mm-OcZWT8lWgBjvVxeCi3Un4rAC3h3XFTt39l5m31s4,5808
84
+ pycti-6.8.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
85
+ pycti-6.8.4.dist-info/top_level.txt,sha256=cqEpxitAhHP4VgSA6xmrak6Yk9MeBkwoMTB6k7d2ZnE,6
86
+ pycti-6.8.4.dist-info/RECORD,,
File without changes