pycti 5.12.14__py3-none-any.whl → 5.12.15__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.

Files changed (64) hide show
  1. pycti/__init__.py +1 -1
  2. pycti/api/__init__.py +0 -3
  3. pycti/api/opencti_api_client.py +10 -56
  4. pycti/api/opencti_api_connector.py +1 -2
  5. pycti/api/opencti_api_playbook.py +3 -4
  6. pycti/api/opencti_api_work.py +15 -12
  7. pycti/connector/__init__.py +0 -3
  8. pycti/connector/opencti_connector_helper.py +63 -58
  9. pycti/connector/opencti_metric_handler.py +8 -5
  10. pycti/entities/__init__.py +0 -3
  11. pycti/entities/opencti_attack_pattern.py +17 -11
  12. pycti/entities/opencti_campaign.py +15 -9
  13. pycti/entities/opencti_case_incident.py +39 -43
  14. pycti/entities/opencti_case_rfi.py +34 -46
  15. pycti/entities/opencti_case_rft.py +35 -44
  16. pycti/entities/opencti_channel.py +15 -9
  17. pycti/entities/opencti_course_of_action.py +15 -9
  18. pycti/entities/opencti_data_component.py +17 -14
  19. pycti/entities/opencti_data_source.py +12 -16
  20. pycti/entities/opencti_event.py +15 -9
  21. pycti/entities/opencti_external_reference.py +20 -15
  22. pycti/entities/opencti_feedback.py +36 -46
  23. pycti/entities/opencti_grouping.py +22 -20
  24. pycti/entities/opencti_identity.py +15 -8
  25. pycti/entities/opencti_incident.py +13 -9
  26. pycti/entities/opencti_indicator.py +18 -15
  27. pycti/entities/opencti_infrastructure.py +15 -9
  28. pycti/entities/opencti_intrusion_set.py +12 -8
  29. pycti/entities/opencti_kill_chain_phase.py +16 -12
  30. pycti/entities/opencti_label.py +16 -12
  31. pycti/entities/opencti_language.py +13 -9
  32. pycti/entities/opencti_location.py +13 -9
  33. pycti/entities/opencti_malware.py +15 -9
  34. pycti/entities/opencti_malware_analysis.py +17 -9
  35. pycti/entities/opencti_marking_definition.py +15 -11
  36. pycti/entities/opencti_narrative.py +15 -9
  37. pycti/entities/opencti_note.py +35 -20
  38. pycti/entities/opencti_observed_data.py +34 -19
  39. pycti/entities/opencti_opinion.py +37 -20
  40. pycti/entities/opencti_report.py +36 -20
  41. pycti/entities/opencti_stix.py +8 -19
  42. pycti/entities/opencti_stix_core_object.py +15 -9
  43. pycti/entities/opencti_stix_core_relationship.py +69 -52
  44. pycti/entities/opencti_stix_cyber_observable.py +78 -62
  45. pycti/entities/opencti_stix_domain_object.py +75 -55
  46. pycti/entities/opencti_stix_nested_ref_relationship.py +21 -14
  47. pycti/entities/opencti_stix_object_or_stix_relationship.py +4 -7
  48. pycti/entities/opencti_stix_sighting_relationship.py +34 -26
  49. pycti/entities/opencti_task.py +37 -44
  50. pycti/entities/opencti_threat_actor.py +7 -4
  51. pycti/entities/opencti_threat_actor_group.py +10 -8
  52. pycti/entities/opencti_threat_actor_individual.py +10 -9
  53. pycti/entities/opencti_tool.py +15 -9
  54. pycti/entities/opencti_vocabulary.py +11 -13
  55. pycti/entities/opencti_vulnerability.py +15 -9
  56. pycti/utils/opencti_logger.py +64 -0
  57. pycti/utils/opencti_stix2.py +30 -24
  58. pycti/utils/opencti_stix2_update.py +2 -6
  59. {pycti-5.12.14.dist-info → pycti-5.12.15.dist-info}/METADATA +1 -1
  60. pycti-5.12.15.dist-info/RECORD +68 -0
  61. pycti-5.12.14.dist-info/RECORD +0 -67
  62. {pycti-5.12.14.dist-info → pycti-5.12.15.dist-info}/LICENSE +0 -0
  63. {pycti-5.12.14.dist-info → pycti-5.12.15.dist-info}/WHEEL +0 -0
  64. {pycti-5.12.14.dist-info → pycti-5.12.15.dist-info}/top_level.txt +0 -0
@@ -5,8 +5,6 @@ import uuid
5
5
 
6
6
  from stix2.canonicalization.Canonicalize import canonicalize
7
7
 
8
- from pycti.entities import LOGGER
9
-
10
8
 
11
9
  class Indicator:
12
10
  """Main Indicator class for OpenCTI
@@ -335,7 +333,9 @@ class Indicator:
335
333
  if get_all:
336
334
  first = 100
337
335
 
338
- LOGGER.info("Listing Indicators with filters %s.", json.dumps(filters))
336
+ self.opencti.app_logger.info(
337
+ "Listing Indicators with filters", {"filters": json.dumps(filters)}
338
+ )
339
339
  query = (
340
340
  """
341
341
  query Indicators($filters: FilterGroup, $search: String, $first: Int, $after: ID, $orderBy: IndicatorsOrdering, $orderMode: OrderingMode) {
@@ -379,7 +379,7 @@ class Indicator:
379
379
  final_data = final_data + data
380
380
  while result["data"]["indicators"]["pageInfo"]["hasNextPage"]:
381
381
  after = result["data"]["indicators"]["pageInfo"]["endCursor"]
382
- LOGGER.info("Listing Indicators after " + after)
382
+ self.opencti.app_logger.info("Listing Indicators", {"after": after})
383
383
  result = self.opencti.query(
384
384
  query,
385
385
  {
@@ -421,7 +421,7 @@ class Indicator:
421
421
  custom_attributes = kwargs.get("customAttributes", None)
422
422
  with_files = kwargs.get("withFiles", False)
423
423
  if id is not None:
424
- LOGGER.info("Reading Indicator {%s}.", id)
424
+ self.opencti.app_logger.info("Reading Indicator", {"id": id})
425
425
  query = (
426
426
  """
427
427
  query Indicator($id: String!) {
@@ -446,7 +446,9 @@ class Indicator:
446
446
  else:
447
447
  return None
448
448
  else:
449
- LOGGER.error("[opencti_indicator] Missing parameters: id or filters")
449
+ self.opencti.app_logger.error(
450
+ "[opencti_indicator] Missing parameters: id or filters"
451
+ )
450
452
  return None
451
453
 
452
454
  def create(self, **kwargs):
@@ -498,7 +500,7 @@ class Indicator:
498
500
  ):
499
501
  if x_opencti_main_observable_type == "File":
500
502
  x_opencti_main_observable_type = "StixFile"
501
- LOGGER.info("Creating Indicator {%s}.", name)
503
+ self.opencti.app_logger.info("Creating Indicator", {"name": name})
502
504
  query = """
503
505
  mutation IndicatorAdd($input: IndicatorAddInput!) {
504
506
  indicatorAdd(input: $input) {
@@ -554,7 +556,7 @@ class Indicator:
554
556
  )
555
557
  return self.opencti.process_multiple_fields(result["data"]["indicatorAdd"])
556
558
  else:
557
- LOGGER.error(
559
+ self.opencti.app_logger.error(
558
560
  "[opencti_indicator] Missing parameters: "
559
561
  "name or pattern or pattern_type or x_opencti_main_observable_type"
560
562
  )
@@ -576,17 +578,16 @@ class Indicator:
576
578
  if indicator is None:
577
579
  indicator = self.read(id=id)
578
580
  if indicator is None:
579
- LOGGER.error(
581
+ self.opencti.app_logger.error(
580
582
  "[opencti_indicator] Cannot add Object Ref, indicator not found"
581
583
  )
582
584
  return False
583
585
  if stix_cyber_observable_id in indicator["observablesIds"]:
584
586
  return True
585
587
  else:
586
- LOGGER.info(
587
- "Adding Stix-Observable {%s} to Indicator {%s}",
588
- stix_cyber_observable_id,
589
- id,
588
+ self.opencti.app_logger.info(
589
+ "Adding Stix-Observable to Indicator",
590
+ {"observable": stix_cyber_observable_id, "indicator": id},
590
591
  )
591
592
  query = """
592
593
  mutation StixCoreRelationshipAdd($input: StixCoreRelationshipAddInput!) {
@@ -608,7 +609,7 @@ class Indicator:
608
609
  )
609
610
  return True
610
611
  else:
611
- LOGGER.error(
612
+ self.opencti.app_logger.error(
612
613
  "[opencti_indicator] Missing parameters: id and stix cyber_observable_id"
613
614
  )
614
615
  return False
@@ -738,4 +739,6 @@ class Indicator:
738
739
  update=update,
739
740
  )
740
741
  else:
741
- LOGGER.error("[opencti_indicator] Missing parameters: stixObject")
742
+ self.opencti.app_logger.error(
743
+ "[opencti_indicator] Missing parameters: stixObject"
744
+ )
@@ -5,8 +5,6 @@ import uuid
5
5
 
6
6
  from stix2.canonicalization.Canonicalize import canonicalize
7
7
 
8
- from pycti.entities import LOGGER
9
-
10
8
 
11
9
  class Infrastructure:
12
10
  """Main Infrastructure class for OpenCTI
@@ -293,7 +291,9 @@ class Infrastructure:
293
291
  if get_all:
294
292
  first = 500
295
293
 
296
- LOGGER.info("Listing Infrastructures with filters %s.", json.dumps(filters))
294
+ self.opencti.app_logger.info(
295
+ "Listing Infrastructures with filters", {"filters": json.dumps(filters)}
296
+ )
297
297
  query = (
298
298
  """
299
299
  query Infrastructures($filters: FilterGroup, $search: String, $first: Int, $after: ID, $orderBy: InfrastructuresOrdering, $orderMode: OrderingMode) {
@@ -338,7 +338,9 @@ class Infrastructure:
338
338
  final_data = final_data + data
339
339
  while result["data"]["infrastructures"]["pageInfo"]["hasNextPage"]:
340
340
  after = result["data"]["infrastructures"]["pageInfo"]["endCursor"]
341
- LOGGER.info("Listing Infrastructures after " + after)
341
+ self.opencti.app_logger.info(
342
+ "Listing Infrastructures", {"after": after}
343
+ )
342
344
  result = self.opencti.query(
343
345
  query,
344
346
  {
@@ -377,7 +379,7 @@ class Infrastructure:
377
379
  custom_attributes = kwargs.get("customAttributes", None)
378
380
  with_files = kwargs.get("withFiles", False)
379
381
  if id is not None:
380
- LOGGER.info("Reading Infrastructure {%s}.", id)
382
+ self.opencti.app_logger.info("Reading Infrastructure", {"id": id})
381
383
  query = (
382
384
  """
383
385
  query Infrastructure($id: String!) {
@@ -404,7 +406,9 @@ class Infrastructure:
404
406
  else:
405
407
  return None
406
408
  else:
407
- LOGGER.error("[opencti_infrastructure] Missing parameters: id or filters")
409
+ self.opencti.app_logger.error(
410
+ "[opencti_infrastructure] Missing parameters: id or filters"
411
+ )
408
412
  return None
409
413
 
410
414
  """
@@ -437,7 +441,7 @@ class Infrastructure:
437
441
  update = kwargs.get("update", False)
438
442
 
439
443
  if name is not None:
440
- LOGGER.info("Creating Infrastructure {%s}.", name)
444
+ self.opencti.app_logger.info("Creating Infrastructure", {"name": name})
441
445
  query = """
442
446
  mutation InfrastructureAdd($input: InfrastructureAddInput!) {
443
447
  infrastructureAdd(input: $input) {
@@ -479,7 +483,7 @@ class Infrastructure:
479
483
  result["data"]["infrastructureAdd"]
480
484
  )
481
485
  else:
482
- LOGGER.error(
486
+ self.opencti.app_logger.error(
483
487
  "[opencti_infrastructure] Missing parameters: "
484
488
  "name and infrastructure_pattern and main_observable_type"
485
489
  )
@@ -555,4 +559,6 @@ class Infrastructure:
555
559
  update=update,
556
560
  )
557
561
  else:
558
- LOGGER.error("[opencti_infrastructure] Missing parameters: stixObject")
562
+ self.opencti.app_logger.error(
563
+ "[opencti_infrastructure] Missing parameters: stixObject"
564
+ )
@@ -5,8 +5,6 @@ import uuid
5
5
 
6
6
  from stix2.canonicalization.Canonicalize import canonicalize
7
7
 
8
- from pycti.entities import LOGGER
9
-
10
8
 
11
9
  class IntrusionSet:
12
10
  def __init__(self, opencti):
@@ -262,7 +260,9 @@ class IntrusionSet:
262
260
  if get_all:
263
261
  first = 500
264
262
 
265
- LOGGER.info("Listing Intrusion-Sets with filters %s.", json.dumps(filters))
263
+ self.opencti.app_logger.info(
264
+ "Listing Intrusion-Sets with filters", {"filters": json.dumps(filters)}
265
+ )
266
266
  query = (
267
267
  """
268
268
  query IntrusionSets($filters: FilterGroup, $search: String, $first: Int, $after: ID, $orderBy: IntrusionSetsOrdering, $orderMode: OrderingMode) {
@@ -318,7 +318,7 @@ class IntrusionSet:
318
318
  custom_attributes = kwargs.get("customAttributes", None)
319
319
  with_files = kwargs.get("withFiles", False)
320
320
  if id is not None:
321
- LOGGER.info("Reading Intrusion-Set {%s}.", id)
321
+ self.opencti.app_logger.info("Reading Intrusion-Set", {"id": id})
322
322
  query = (
323
323
  """
324
324
  query IntrusionSet($id: String!) {
@@ -343,7 +343,9 @@ class IntrusionSet:
343
343
  else:
344
344
  return None
345
345
  else:
346
- LOGGER.error("[opencti_intrusion_set] Missing parameters: id or filters")
346
+ self.opencti.app_logger.error(
347
+ "[opencti_intrusion_set] Missing parameters: id or filters"
348
+ )
347
349
  return None
348
350
 
349
351
  """
@@ -378,7 +380,7 @@ class IntrusionSet:
378
380
  update = kwargs.get("update", False)
379
381
 
380
382
  if name is not None:
381
- LOGGER.info("Creating Intrusion-Set {%s}.", name)
383
+ self.opencti.app_logger.info("Creating Intrusion-Set", {"name": name})
382
384
  query = """
383
385
  mutation IntrusionSetAdd($input: IntrusionSetAddInput!) {
384
386
  intrusionSetAdd(input: $input) {
@@ -422,7 +424,7 @@ class IntrusionSet:
422
424
  result["data"]["intrusionSetAdd"]
423
425
  )
424
426
  else:
425
- LOGGER.error(
427
+ self.opencti.app_logger.error(
426
428
  "[opencti_intrusion_set] Missing parameters: name and description"
427
429
  )
428
430
 
@@ -501,4 +503,6 @@ class IntrusionSet:
501
503
  update=update,
502
504
  )
503
505
  else:
504
- LOGGER.error("[opencti_intrusion_set] Missing parameters: stixObject")
506
+ self.opencti.app_logger.error(
507
+ "[opencti_intrusion_set] Missing parameters: stixObject"
508
+ )
@@ -5,8 +5,6 @@ import uuid
5
5
 
6
6
  from stix2.canonicalization.Canonicalize import canonicalize
7
7
 
8
- from pycti.entities import LOGGER
9
-
10
8
 
11
9
  class KillChainPhase:
12
10
  def __init__(self, opencti):
@@ -53,8 +51,8 @@ class KillChainPhase:
53
51
  if get_all:
54
52
  first = 500
55
53
 
56
- LOGGER.info(
57
- "Listing Kill-Chain-Phase with filters " + json.dumps(filters) + "."
54
+ self.opencti.app_logger.info(
55
+ "Listing Kill-Chain-Phase with filters", {"filters": json.dumps(filters)}
58
56
  )
59
57
  query = (
60
58
  """
@@ -104,7 +102,7 @@ class KillChainPhase:
104
102
  id = kwargs.get("id", None)
105
103
  filters = kwargs.get("filters", None)
106
104
  if id is not None:
107
- LOGGER.info("Reading Kill-Chain-Phase {%s}.", id)
105
+ self.opencti.app_logger.info("Reading Kill-Chain-Phase", {"id": id})
108
106
  query = (
109
107
  """
110
108
  query KillChainPhase($id: String!) {
@@ -127,7 +125,9 @@ class KillChainPhase:
127
125
  else:
128
126
  return None
129
127
  else:
130
- LOGGER.error("[opencti_kill_chain_phase] Missing parameters: id or filters")
128
+ self.opencti.app_logger.error(
129
+ "[opencti_kill_chain_phase] Missing parameters: id or filters"
130
+ )
131
131
  return None
132
132
 
133
133
  """
@@ -147,7 +147,9 @@ class KillChainPhase:
147
147
  update = kwargs.get("update", False)
148
148
 
149
149
  if kill_chain_name is not None and phase_name is not None:
150
- LOGGER.info("Creating Kill-Chain-Phase {%s}.", phase_name)
150
+ self.opencti.app_logger.info(
151
+ "Creating Kill-Chain-Phase", {"name": phase_name}
152
+ )
151
153
  query = (
152
154
  """
153
155
  mutation KillChainPhaseAdd($input: KillChainPhaseAddInput!) {
@@ -177,7 +179,7 @@ class KillChainPhase:
177
179
  result["data"]["killChainPhaseAdd"]
178
180
  )
179
181
  else:
180
- LOGGER.error(
182
+ self.opencti.app_logger.error(
181
183
  "[opencti_kill_chain_phase] Missing parameters: kill_chain_name and phase_name",
182
184
  )
183
185
 
@@ -193,7 +195,7 @@ class KillChainPhase:
193
195
  id = kwargs.get("id", None)
194
196
  input = kwargs.get("input", None)
195
197
  if id is not None and input is not None:
196
- LOGGER.info("Updating Kill chain {%s}.", id)
198
+ self.opencti.app_logger.info("Updating Kill chain", {"id": id})
197
199
  query = """
198
200
  mutation KillChainPhaseEdit($id: ID!, $input: [EditInput]!) {
199
201
  killChainPhaseEdit(id: $id) {
@@ -216,7 +218,7 @@ class KillChainPhase:
216
218
  result["data"]["killChainPhaseEdit"]["fieldPatch"]
217
219
  )
218
220
  else:
219
- LOGGER.error(
221
+ self.opencti.app_logger.error(
220
222
  "[opencti_kill_chain] Missing parameters: id and key and value"
221
223
  )
222
224
  return None
@@ -224,7 +226,7 @@ class KillChainPhase:
224
226
  def delete(self, **kwargs):
225
227
  id = kwargs.get("id", None)
226
228
  if id is not None:
227
- LOGGER.info("Deleting Kill-Chain-Phase {%s}.", id)
229
+ self.opencti.app_logger.info("Deleting Kill-Chain-Phase", {"id": id})
228
230
  query = """
229
231
  mutation KillChainPhaseEdit($id: ID!) {
230
232
  killChainPhaseEdit(id: $id) {
@@ -234,5 +236,7 @@ class KillChainPhase:
234
236
  """
235
237
  self.opencti.query(query, {"id": id})
236
238
  else:
237
- LOGGER.error("[opencti_kill_chain_phase] Missing parameters: id")
239
+ self.opencti.app_logger.error(
240
+ "[opencti_kill_chain_phase] Missing parameters: id"
241
+ )
238
242
  return None
@@ -5,8 +5,6 @@ import uuid
5
5
 
6
6
  from stix2.canonicalization.Canonicalize import canonicalize
7
7
 
8
- from pycti.entities import LOGGER
9
-
10
8
 
11
9
  class Label:
12
10
  def __init__(self, opencti):
@@ -49,7 +47,9 @@ class Label:
49
47
  if get_all:
50
48
  first = 100
51
49
 
52
- LOGGER.info("Listing Labels with filters %s.", json.dumps(filters))
50
+ self.opencti.app_logger.info(
51
+ "Listing Labels with filters", {"filters": json.dumps(filters)}
52
+ )
53
53
  query = (
54
54
  """
55
55
  query Labels($filters: FilterGroup, $search: String, $first: Int, $after: ID, $orderBy: LabelsOrdering, $orderMode: OrderingMode) {
@@ -89,7 +89,7 @@ class Label:
89
89
  final_data = final_data + data
90
90
  while result["data"]["labels"]["pageInfo"]["hasNextPage"]:
91
91
  after = result["data"]["labels"]["pageInfo"]["endCursor"]
92
- LOGGER.info("Listing Labels after " + after)
92
+ self.opencti.app_logger.info("Listing Labels", {"after": after})
93
93
  result = self.opencti.query(
94
94
  query,
95
95
  {
@@ -121,7 +121,7 @@ class Label:
121
121
  id = kwargs.get("id", None)
122
122
  filters = kwargs.get("filters", None)
123
123
  if id is not None:
124
- LOGGER.info("Reading label {%s}.", id)
124
+ self.opencti.app_logger.info("Reading label", {"id": id})
125
125
  query = (
126
126
  """
127
127
  query Label($id: String!) {
@@ -142,7 +142,9 @@ class Label:
142
142
  else:
143
143
  return None
144
144
  else:
145
- LOGGER.error("[opencti_label] Missing parameters: id or filters")
145
+ self.opencti.app_logger.error(
146
+ "[opencti_label] Missing parameters: id or filters"
147
+ )
146
148
  return None
147
149
 
148
150
  """
@@ -161,7 +163,7 @@ class Label:
161
163
  update = kwargs.get("update", False)
162
164
 
163
165
  if value is not None:
164
- LOGGER.info("Creating Label {%s}.", value)
166
+ self.opencti.app_logger.info("Creating Label", {"value": value})
165
167
  query = (
166
168
  """
167
169
  mutation LabelAdd($input: LabelAddInput!) {
@@ -187,7 +189,7 @@ class Label:
187
189
  )
188
190
  return self.opencti.process_multiple_fields(result["data"]["labelAdd"])
189
191
  else:
190
- LOGGER.error("[opencti_label] Missing parameters: value")
192
+ self.opencti.app_logger.error("[opencti_label] Missing parameters: value")
191
193
 
192
194
  """
193
195
  Read or create a Label
@@ -223,7 +225,7 @@ class Label:
223
225
  id = kwargs.get("id", None)
224
226
  input = kwargs.get("input", None)
225
227
  if id is not None and input is not None:
226
- LOGGER.info("Updating Label {%s}.", id)
228
+ self.opencti.app_logger.info("Updating Label", {"id": id})
227
229
  query = """
228
230
  mutation LabelEdit($id: ID!, $input: [EditInput]!) {
229
231
  labelEdit(id: $id) {
@@ -246,13 +248,15 @@ class Label:
246
248
  result["data"]["labelEdit"]["fieldPatch"]
247
249
  )
248
250
  else:
249
- LOGGER.error("[opencti_label] Missing parameters: id and key and value")
251
+ self.opencti.app_logger.error(
252
+ "[opencti_label] Missing parameters: id and key and value"
253
+ )
250
254
  return None
251
255
 
252
256
  def delete(self, **kwargs):
253
257
  id = kwargs.get("id", None)
254
258
  if id is not None:
255
- LOGGER.info("Deleting Label {%s}.", id)
259
+ self.opencti.app_logger.info("Deleting Label", {"id": id})
256
260
  query = """
257
261
  mutation LabelEdit($id: ID!) {
258
262
  labelEdit(id: $id) {
@@ -262,5 +266,5 @@ class Label:
262
266
  """
263
267
  self.opencti.query(query, {"id": id})
264
268
  else:
265
- LOGGER.error("[opencti_label] Missing parameters: id")
269
+ self.opencti.app_logger.error("[opencti_label] Missing parameters: id")
266
270
  return None
@@ -5,8 +5,6 @@ import uuid
5
5
 
6
6
  from stix2.canonicalization.Canonicalize import canonicalize
7
7
 
8
- from pycti.entities import LOGGER
9
-
10
8
 
11
9
  class Language:
12
10
  def __init__(self, opencti):
@@ -274,7 +272,9 @@ class Language:
274
272
  if get_all:
275
273
  first = 100
276
274
 
277
- LOGGER.info("Listing Languages with filters %s.", json.dumps(filters))
275
+ self.opencti.app_logger.info(
276
+ "Listing Languages with filters", {"filters": json.dumps(filters)}
277
+ )
278
278
  query = (
279
279
  """
280
280
  query Languages($filters: FilterGroup, $search: String, $first: Int, $after: ID, $orderBy: LanguagesOrdering, $orderMode: OrderingMode) {
@@ -318,7 +318,7 @@ class Language:
318
318
  final_data = final_data + data
319
319
  while result["data"]["languages"]["pageInfo"]["hasNextPage"]:
320
320
  after = result["data"]["languages"]["pageInfo"]["endCursor"]
321
- LOGGER.info("Listing Languages after " + after)
321
+ self.opencti.app_logger.info("Listing Languages", {"after": after})
322
322
  result = self.opencti.query(
323
323
  query,
324
324
  {
@@ -352,7 +352,7 @@ class Language:
352
352
  custom_attributes = kwargs.get("customAttributes", None)
353
353
  with_files = kwargs.get("withFiles", False)
354
354
  if id is not None:
355
- LOGGER.info("Reading Language {%s}.", id)
355
+ self.opencti.app_logger.info("Reading Language", {"id": id})
356
356
  query = (
357
357
  """
358
358
  query Language($id: String!) {
@@ -377,7 +377,9 @@ class Language:
377
377
  else:
378
378
  return None
379
379
  else:
380
- LOGGER.error("[opencti_language] Missing parameters: id or filters")
380
+ self.opencti.app_logger.error(
381
+ "[opencti_language] Missing parameters: id or filters"
382
+ )
381
383
  return None
382
384
 
383
385
  """
@@ -404,7 +406,7 @@ class Language:
404
406
  update = kwargs.get("update", False)
405
407
 
406
408
  if name is not None:
407
- LOGGER.info("Creating Language {%s}.", name)
409
+ self.opencti.app_logger.info("Creating Language", {"name": name})
408
410
  query = """
409
411
  mutation LanguageAdd($input: LanguageAddInput!) {
410
412
  languageAdd(input: $input) {
@@ -438,7 +440,7 @@ class Language:
438
440
  )
439
441
  return self.opencti.process_multiple_fields(result["data"]["languageAdd"])
440
442
  else:
441
- LOGGER.error("[opencti_language] Missing parameters: name")
443
+ self.opencti.app_logger.error("[opencti_language] Missing parameters: name")
442
444
 
443
445
  """
444
446
  Import an Language object from a STIX2 object
@@ -491,4 +493,6 @@ class Language:
491
493
  update=update,
492
494
  )
493
495
  else:
494
- LOGGER.error("[opencti_language] Missing parameters: stixObject")
496
+ self.opencti.app_logger.error(
497
+ "[opencti_language] Missing parameters: stixObject"
498
+ )
@@ -5,8 +5,6 @@ import uuid
5
5
 
6
6
  from stix2.canonicalization.Canonicalize import canonicalize
7
7
 
8
- from pycti.entities import LOGGER
9
-
10
8
 
11
9
  class Location:
12
10
  def __init__(self, opencti):
@@ -261,7 +259,9 @@ class Location:
261
259
  if get_all:
262
260
  first = 500
263
261
 
264
- LOGGER.info("Listing Locations with filters %s.", json.dumps(filters))
262
+ self.opencti.app_logger.info(
263
+ "Listing Locations with filters", {"filters": json.dumps(filters)}
264
+ )
265
265
  query = (
266
266
  """
267
267
  query Locations($types: [String], $filters: FilterGroup, $search: String, $first: Int, $after: ID, $orderBy: LocationsOrdering, $orderMode: OrderingMode) {
@@ -318,7 +318,7 @@ class Location:
318
318
  custom_attributes = kwargs.get("customAttributes", None)
319
319
  with_files = kwargs.get("withFiles", False)
320
320
  if id is not None:
321
- LOGGER.info("Reading Location {%s}.", id)
321
+ self.opencti.app_logger.info("Reading Location", {"id": id})
322
322
  query = (
323
323
  """
324
324
  query Location($id: String!) {
@@ -343,7 +343,9 @@ class Location:
343
343
  else:
344
344
  return None
345
345
  else:
346
- LOGGER.error("[opencti_location] Missing parameters: id or filters")
346
+ self.opencti.app_logger.error(
347
+ "[opencti_location] Missing parameters: id or filters"
348
+ )
347
349
  return None
348
350
 
349
351
  """
@@ -375,7 +377,7 @@ class Location:
375
377
  update = kwargs.get("update", False)
376
378
 
377
379
  if name is not None:
378
- LOGGER.info("Creating Location {%s}.", name)
380
+ self.opencti.app_logger.info("Creating Location", {"name": name})
379
381
  query = """
380
382
  mutation LocationAdd($input: LocationAddInput!) {
381
383
  locationAdd(input: $input) {
@@ -414,7 +416,7 @@ class Location:
414
416
  )
415
417
  return self.opencti.process_multiple_fields(result["data"]["locationAdd"])
416
418
  else:
417
- LOGGER.error("Missing parameters: name")
419
+ self.opencti.app_logger.error("Missing parameters: name")
418
420
 
419
421
  """
420
422
  Import an Location object from a STIX2 object
@@ -436,7 +438,7 @@ class Location:
436
438
  elif "region" in stix_object:
437
439
  name = stix_object["region"]
438
440
  else:
439
- LOGGER.error("[opencti_location] Missing name")
441
+ self.opencti.app_logger.error("[opencti_location] Missing name")
440
442
  return
441
443
  if "x_opencti_location_type" in stix_object:
442
444
  type = stix_object["x_opencti_location_type"]
@@ -504,4 +506,6 @@ class Location:
504
506
  update=update,
505
507
  )
506
508
  else:
507
- LOGGER.error("[opencti_location] Missing parameters: stixObject")
509
+ self.opencti.app_logger.error(
510
+ "[opencti_location] Missing parameters: stixObject"
511
+ )
@@ -5,8 +5,6 @@ import uuid
5
5
 
6
6
  from stix2.canonicalization.Canonicalize import canonicalize
7
7
 
8
- from pycti.entities import LOGGER
9
-
10
8
 
11
9
  class Malware:
12
10
  def __init__(self, opencti):
@@ -292,7 +290,9 @@ class Malware:
292
290
  if get_all:
293
291
  first = 500
294
292
 
295
- LOGGER.info("Listing Malwares with filters %s.", json.dumps(filters))
293
+ self.opencti.app_logger.info(
294
+ "Listing Malwares with filters", {"filters": json.dumps(filters)}
295
+ )
296
296
  query = (
297
297
  """
298
298
  query Malwares($filters: FilterGroup, $search: String, $first: Int, $after: ID, $orderBy: MalwaresOrdering, $orderMode: OrderingMode) {
@@ -337,7 +337,7 @@ class Malware:
337
337
  final_data = final_data + data
338
338
  while result["data"]["malwares"]["pageInfo"]["hasNextPage"]:
339
339
  after = result["data"]["malwares"]["pageInfo"]["endCursor"]
340
- LOGGER.info("Listing Malwares after %s", after)
340
+ self.opencti.app_logger.info("Listing Malwares", {"after": after})
341
341
  result = self.opencti.query(
342
342
  query,
343
343
  {
@@ -371,7 +371,7 @@ class Malware:
371
371
  custom_attributes = kwargs.get("customAttributes", None)
372
372
  with_files = kwargs.get("withFiles", False)
373
373
  if id is not None:
374
- LOGGER.info("Reading Malware {%s}.", id)
374
+ self.opencti.app_logger.info("Reading Malware", {"id": id})
375
375
  query = (
376
376
  """
377
377
  query Malware($id: String!) {
@@ -396,7 +396,9 @@ class Malware:
396
396
  else:
397
397
  return None
398
398
  else:
399
- LOGGER.error("[opencti_malware] Missing parameters: id or filters")
399
+ self.opencti.app_logger.error(
400
+ "[opencti_malware] Missing parameters: id or filters"
401
+ )
400
402
  return None
401
403
 
402
404
  """
@@ -434,7 +436,7 @@ class Malware:
434
436
  update = kwargs.get("update", False)
435
437
 
436
438
  if name is not None:
437
- LOGGER.info("Creating Malware {%s}.", name)
439
+ self.opencti.app_logger.info("Creating Malware", {"name": name})
438
440
  query = """
439
441
  mutation MalwareAdd($input: MalwareAddInput!) {
440
442
  malwareAdd(input: $input) {
@@ -479,7 +481,9 @@ class Malware:
479
481
  )
480
482
  return self.opencti.process_multiple_fields(result["data"]["malwareAdd"])
481
483
  else:
482
- LOGGER.error("[opencti_malware] Missing parameters: name and description")
484
+ self.opencti.app_logger.error(
485
+ "[opencti_malware] Missing parameters: name and description"
486
+ )
483
487
 
484
488
  """
485
489
  Import an Malware object from a STIX2 object
@@ -573,4 +577,6 @@ class Malware:
573
577
  update=update,
574
578
  )
575
579
  else:
576
- LOGGER.error("[opencti_malware] Missing parameters: stixObject")
580
+ self.opencti.app_logger.error(
581
+ "[opencti_malware] Missing parameters: stixObject"
582
+ )