pycti 5.12.21__py3-none-any.whl → 5.12.23__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 (50) hide show
  1. pycti/__init__.py +1 -1
  2. pycti/connector/opencti_connector_helper.py +13 -11
  3. pycti/entities/opencti_attack_pattern.py +76 -58
  4. pycti/entities/opencti_campaign.py +49 -41
  5. pycti/entities/opencti_case_incident.py +62 -48
  6. pycti/entities/opencti_case_rfi.py +45 -35
  7. pycti/entities/opencti_case_rft.py +45 -35
  8. pycti/entities/opencti_channel.py +45 -35
  9. pycti/entities/opencti_course_of_action.py +43 -35
  10. pycti/entities/opencti_data_component.py +43 -35
  11. pycti/entities/opencti_data_source.py +48 -38
  12. pycti/entities/opencti_event.py +44 -38
  13. pycti/entities/opencti_external_reference.py +5 -3
  14. pycti/entities/opencti_feedback.py +40 -32
  15. pycti/entities/opencti_grouping.py +43 -35
  16. pycti/entities/opencti_identity.py +91 -73
  17. pycti/entities/opencti_incident.py +59 -47
  18. pycti/entities/opencti_indicator.py +110 -84
  19. pycti/entities/opencti_infrastructure.py +56 -44
  20. pycti/entities/opencti_intrusion_set.py +61 -47
  21. pycti/entities/opencti_language.py +30 -24
  22. pycti/entities/opencti_location.py +41 -35
  23. pycti/entities/opencti_malware.py +83 -63
  24. pycti/entities/opencti_malware_analysis.py +87 -63
  25. pycti/entities/opencti_marking_definition.py +24 -18
  26. pycti/entities/opencti_narrative.py +45 -35
  27. pycti/entities/opencti_note.py +51 -39
  28. pycti/entities/opencti_observed_data.py +70 -48
  29. pycti/entities/opencti_opinion.py +40 -32
  30. pycti/entities/opencti_report.py +74 -47
  31. pycti/entities/opencti_stix_core_object.py +10 -10
  32. pycti/entities/opencti_stix_core_relationship.py +55 -41
  33. pycti/entities/opencti_stix_cyber_observable.py +442 -318
  34. pycti/entities/opencti_stix_domain_object.py +15 -13
  35. pycti/entities/opencti_stix_object_or_stix_relationship.py +5 -5
  36. pycti/entities/opencti_task.py +44 -36
  37. pycti/entities/opencti_threat_actor_group.py +76 -56
  38. pycti/entities/opencti_threat_actor_individual.py +76 -56
  39. pycti/entities/opencti_tool.py +53 -41
  40. pycti/entities/opencti_vulnerability.py +151 -109
  41. pycti/utils/constants.py +1 -0
  42. pycti/utils/opencti_stix2.py +177 -139
  43. pycti/utils/opencti_stix2_update.py +20 -12
  44. pycti/utils/opencti_stix2_utils.py +5 -3
  45. {pycti-5.12.21.dist-info → pycti-5.12.23.dist-info}/METADATA +2 -2
  46. pycti-5.12.23.dist-info/RECORD +68 -0
  47. pycti-5.12.21.dist-info/RECORD +0 -68
  48. {pycti-5.12.21.dist-info → pycti-5.12.23.dist-info}/LICENSE +0 -0
  49. {pycti-5.12.21.dist-info → pycti-5.12.23.dist-info}/WHEEL +0 -0
  50. {pycti-5.12.21.dist-info → pycti-5.12.23.dist-info}/top_level.txt +0 -0
@@ -631,13 +631,13 @@ class Indicator:
631
631
  if stix_object is not None:
632
632
  # Search in extensions
633
633
  if "x_opencti_score" not in stix_object:
634
- stix_object[
635
- "x_opencti_score"
636
- ] = self.opencti.get_attribute_in_extension("score", stix_object)
634
+ stix_object["x_opencti_score"] = (
635
+ self.opencti.get_attribute_in_extension("score", stix_object)
636
+ )
637
637
  if "x_opencti_detection" not in stix_object:
638
- stix_object[
639
- "x_opencti_detection"
640
- ] = self.opencti.get_attribute_in_extension("detection", stix_object)
638
+ stix_object["x_opencti_detection"] = (
639
+ self.opencti.get_attribute_in_extension("detection", stix_object)
640
+ )
641
641
  if (
642
642
  "x_opencti_main_observable_type" not in stix_object
643
643
  and self.opencti.get_attribute_in_extension(
@@ -645,97 +645,123 @@ class Indicator:
645
645
  )
646
646
  is not None
647
647
  ):
648
- stix_object[
649
- "x_opencti_main_observable_type"
650
- ] = self.opencti.get_attribute_in_extension(
651
- "main_observable_type", stix_object
648
+ stix_object["x_opencti_main_observable_type"] = (
649
+ self.opencti.get_attribute_in_extension(
650
+ "main_observable_type", stix_object
651
+ )
652
652
  )
653
653
  if "x_opencti_create_observables" not in stix_object:
654
- stix_object[
655
- "x_opencti_create_observables"
656
- ] = self.opencti.get_attribute_in_extension(
657
- "create_observables", stix_object
654
+ stix_object["x_opencti_create_observables"] = (
655
+ self.opencti.get_attribute_in_extension(
656
+ "create_observables", stix_object
657
+ )
658
658
  )
659
659
  if "x_opencti_stix_ids" not in stix_object:
660
- stix_object[
661
- "x_opencti_stix_ids"
662
- ] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
660
+ stix_object["x_opencti_stix_ids"] = (
661
+ self.opencti.get_attribute_in_extension("stix_ids", stix_object)
662
+ )
663
663
  if "x_opencti_granted_refs" not in stix_object:
664
- stix_object[
665
- "x_opencti_granted_refs"
666
- ] = self.opencti.get_attribute_in_extension("granted_refs", stix_object)
664
+ stix_object["x_opencti_granted_refs"] = (
665
+ self.opencti.get_attribute_in_extension("granted_refs", stix_object)
666
+ )
667
667
 
668
668
  return self.create(
669
669
  stix_id=stix_object["id"],
670
- createdBy=extras["created_by_id"]
671
- if "created_by_id" in extras
672
- else None,
673
- objectMarking=extras["object_marking_ids"]
674
- if "object_marking_ids" in extras
675
- else None,
676
- objectLabel=extras["object_label_ids"]
677
- if "object_label_ids" in extras
678
- else None,
679
- externalReferences=extras["external_references_ids"]
680
- if "external_references_ids" in extras
681
- else None,
670
+ createdBy=(
671
+ extras["created_by_id"] if "created_by_id" in extras else None
672
+ ),
673
+ objectMarking=(
674
+ extras["object_marking_ids"]
675
+ if "object_marking_ids" in extras
676
+ else None
677
+ ),
678
+ objectLabel=(
679
+ extras["object_label_ids"] if "object_label_ids" in extras else None
680
+ ),
681
+ externalReferences=(
682
+ extras["external_references_ids"]
683
+ if "external_references_ids" in extras
684
+ else None
685
+ ),
682
686
  revoked=stix_object["revoked"] if "revoked" in stix_object else None,
683
- confidence=stix_object["confidence"]
684
- if "confidence" in stix_object
685
- else None,
687
+ confidence=(
688
+ stix_object["confidence"] if "confidence" in stix_object else None
689
+ ),
686
690
  lang=stix_object["lang"] if "lang" in stix_object else None,
687
691
  created=stix_object["created"] if "created" in stix_object else None,
688
692
  modified=stix_object["modified"] if "modified" in stix_object else None,
689
- pattern_type=stix_object["pattern_type"]
690
- if "pattern_type" in stix_object
691
- else None,
692
- pattern_version=stix_object["pattern_version"]
693
- if "pattern_version" in stix_object
694
- else None,
693
+ pattern_type=(
694
+ stix_object["pattern_type"]
695
+ if "pattern_type" in stix_object
696
+ else None
697
+ ),
698
+ pattern_version=(
699
+ stix_object["pattern_version"]
700
+ if "pattern_version" in stix_object
701
+ else None
702
+ ),
695
703
  pattern=stix_object["pattern"] if "pattern" in stix_object else "",
696
- name=stix_object["name"]
697
- if "name" in stix_object
698
- else stix_object["pattern"],
699
- description=self.opencti.stix2.convert_markdown(
700
- stix_object["description"]
701
- )
702
- if "description" in stix_object
703
- else None,
704
- indicator_types=stix_object["indicator_types"]
705
- if "indicator_types" in stix_object
706
- else None,
707
- valid_from=stix_object["valid_from"]
708
- if "valid_from" in stix_object
709
- else None,
710
- valid_until=stix_object["valid_until"]
711
- if "valid_until" in stix_object
712
- else None,
713
- x_opencti_score=stix_object["x_opencti_score"]
714
- if "x_opencti_score" in stix_object
715
- else 50,
716
- x_opencti_detection=stix_object["x_opencti_detection"]
717
- if "x_opencti_detection" in stix_object
718
- else False,
719
- x_mitre_platforms=stix_object["x_mitre_platforms"]
720
- if "x_mitre_platforms" in stix_object
721
- else None,
722
- x_opencti_main_observable_type=stix_object[
723
- "x_opencti_main_observable_type"
724
- ]
725
- if "x_opencti_main_observable_type" in stix_object
726
- else "Unknown",
727
- killChainPhases=extras["kill_chain_phases_ids"]
728
- if "kill_chain_phases_ids" in extras
729
- else None,
730
- x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
731
- if "x_opencti_stix_ids" in stix_object
732
- else None,
733
- x_opencti_create_observables=stix_object["x_opencti_create_observables"]
734
- if "x_opencti_create_observables" in stix_object
735
- else False,
736
- objectOrganization=stix_object["x_opencti_granted_refs"]
737
- if "x_opencti_granted_refs" in stix_object
738
- else None,
704
+ name=(
705
+ stix_object["name"]
706
+ if "name" in stix_object
707
+ else stix_object["pattern"]
708
+ ),
709
+ description=(
710
+ self.opencti.stix2.convert_markdown(stix_object["description"])
711
+ if "description" in stix_object
712
+ else None
713
+ ),
714
+ indicator_types=(
715
+ stix_object["indicator_types"]
716
+ if "indicator_types" in stix_object
717
+ else None
718
+ ),
719
+ valid_from=(
720
+ stix_object["valid_from"] if "valid_from" in stix_object else None
721
+ ),
722
+ valid_until=(
723
+ stix_object["valid_until"] if "valid_until" in stix_object else None
724
+ ),
725
+ x_opencti_score=(
726
+ stix_object["x_opencti_score"]
727
+ if "x_opencti_score" in stix_object
728
+ else 50
729
+ ),
730
+ x_opencti_detection=(
731
+ stix_object["x_opencti_detection"]
732
+ if "x_opencti_detection" in stix_object
733
+ else False
734
+ ),
735
+ x_mitre_platforms=(
736
+ stix_object["x_mitre_platforms"]
737
+ if "x_mitre_platforms" in stix_object
738
+ else None
739
+ ),
740
+ x_opencti_main_observable_type=(
741
+ stix_object["x_opencti_main_observable_type"]
742
+ if "x_opencti_main_observable_type" in stix_object
743
+ else "Unknown"
744
+ ),
745
+ killChainPhases=(
746
+ extras["kill_chain_phases_ids"]
747
+ if "kill_chain_phases_ids" in extras
748
+ else None
749
+ ),
750
+ x_opencti_stix_ids=(
751
+ stix_object["x_opencti_stix_ids"]
752
+ if "x_opencti_stix_ids" in stix_object
753
+ else None
754
+ ),
755
+ x_opencti_create_observables=(
756
+ stix_object["x_opencti_create_observables"]
757
+ if "x_opencti_create_observables" in stix_object
758
+ else False
759
+ ),
760
+ objectOrganization=(
761
+ stix_object["x_opencti_granted_refs"]
762
+ if "x_opencti_granted_refs" in stix_object
763
+ else None
764
+ ),
739
765
  update=update,
740
766
  )
741
767
  else:
@@ -502,60 +502,72 @@ class Infrastructure:
502
502
  if stix_object is not None:
503
503
  # Search in extensions
504
504
  if "x_opencti_stix_ids" not in stix_object:
505
- stix_object[
506
- "x_opencti_stix_ids"
507
- ] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
505
+ stix_object["x_opencti_stix_ids"] = (
506
+ self.opencti.get_attribute_in_extension("stix_ids", stix_object)
507
+ )
508
508
  if "x_opencti_granted_refs" not in stix_object:
509
- stix_object[
510
- "x_opencti_granted_refs"
511
- ] = self.opencti.get_attribute_in_extension("granted_refs", stix_object)
509
+ stix_object["x_opencti_granted_refs"] = (
510
+ self.opencti.get_attribute_in_extension("granted_refs", stix_object)
511
+ )
512
512
 
513
513
  return self.create(
514
514
  stix_id=stix_object["id"],
515
- createdBy=extras["created_by_id"]
516
- if "created_by_id" in extras
517
- else None,
518
- objectMarking=extras["object_marking_ids"]
519
- if "object_marking_ids" in extras
520
- else None,
521
- objectLabel=extras["object_label_ids"]
522
- if "object_label_ids" in extras
523
- else None,
524
- externalReferences=extras["external_references_ids"]
525
- if "external_references_ids" in extras
526
- else None,
515
+ createdBy=(
516
+ extras["created_by_id"] if "created_by_id" in extras else None
517
+ ),
518
+ objectMarking=(
519
+ extras["object_marking_ids"]
520
+ if "object_marking_ids" in extras
521
+ else None
522
+ ),
523
+ objectLabel=(
524
+ extras["object_label_ids"] if "object_label_ids" in extras else None
525
+ ),
526
+ externalReferences=(
527
+ extras["external_references_ids"]
528
+ if "external_references_ids" in extras
529
+ else None
530
+ ),
527
531
  revoked=stix_object["revoked"] if "revoked" in stix_object else None,
528
- confidence=stix_object["confidence"]
529
- if "confidence" in stix_object
530
- else None,
532
+ confidence=(
533
+ stix_object["confidence"] if "confidence" in stix_object else None
534
+ ),
531
535
  lang=stix_object["lang"] if "lang" in stix_object else None,
532
536
  created=stix_object["created"] if "created" in stix_object else None,
533
537
  modified=stix_object["modified"] if "modified" in stix_object else None,
534
538
  name=stix_object["name"],
535
- description=self.opencti.stix2.convert_markdown(
536
- stix_object["description"]
537
- )
538
- if "description" in stix_object
539
- else None,
539
+ description=(
540
+ self.opencti.stix2.convert_markdown(stix_object["description"])
541
+ if "description" in stix_object
542
+ else None
543
+ ),
540
544
  aliases=self.opencti.stix2.pick_aliases(stix_object),
541
- infrastructure_types=stix_object["infrastructure_types"]
542
- if "infrastructure_types" in stix_object
543
- else None,
544
- first_seen=stix_object["first_seen"]
545
- if "first_seen" in stix_object
546
- else None,
547
- last_seen=stix_object["last_seen"]
548
- if "last_seen" in stix_object
549
- else None,
550
- killChainPhases=extras["kill_chain_phases_ids"]
551
- if "kill_chain_phases_ids" in extras
552
- else None,
553
- x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
554
- if "x_opencti_stix_ids" in stix_object
555
- else None,
556
- objectOrganization=stix_object["x_opencti_granted_refs"]
557
- if "x_opencti_granted_refs" in stix_object
558
- else None,
545
+ infrastructure_types=(
546
+ stix_object["infrastructure_types"]
547
+ if "infrastructure_types" in stix_object
548
+ else None
549
+ ),
550
+ first_seen=(
551
+ stix_object["first_seen"] if "first_seen" in stix_object else None
552
+ ),
553
+ last_seen=(
554
+ stix_object["last_seen"] if "last_seen" in stix_object else None
555
+ ),
556
+ killChainPhases=(
557
+ extras["kill_chain_phases_ids"]
558
+ if "kill_chain_phases_ids" in extras
559
+ else None
560
+ ),
561
+ x_opencti_stix_ids=(
562
+ stix_object["x_opencti_stix_ids"]
563
+ if "x_opencti_stix_ids" in stix_object
564
+ else None
565
+ ),
566
+ objectOrganization=(
567
+ stix_object["x_opencti_granted_refs"]
568
+ if "x_opencti_granted_refs" in stix_object
569
+ else None
570
+ ),
559
571
  update=update,
560
572
  )
561
573
  else:
@@ -442,64 +442,78 @@ class IntrusionSet:
442
442
  if stix_object is not None:
443
443
  # Search in extensions
444
444
  if "x_opencti_stix_ids" not in stix_object:
445
- stix_object[
446
- "x_opencti_stix_ids"
447
- ] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
445
+ stix_object["x_opencti_stix_ids"] = (
446
+ self.opencti.get_attribute_in_extension("stix_ids", stix_object)
447
+ )
448
448
  if "x_opencti_granted_refs" not in stix_object:
449
- stix_object[
450
- "x_opencti_granted_refs"
451
- ] = self.opencti.get_attribute_in_extension("granted_refs", stix_object)
449
+ stix_object["x_opencti_granted_refs"] = (
450
+ self.opencti.get_attribute_in_extension("granted_refs", stix_object)
451
+ )
452
452
 
453
453
  return self.create(
454
454
  stix_id=stix_object["id"],
455
- createdBy=extras["created_by_id"]
456
- if "created_by_id" in extras
457
- else None,
458
- objectMarking=extras["object_marking_ids"]
459
- if "object_marking_ids" in extras
460
- else None,
461
- objectLabel=extras["object_label_ids"]
462
- if "object_label_ids" in extras
463
- else None,
464
- externalReferences=extras["external_references_ids"]
465
- if "external_references_ids" in extras
466
- else None,
455
+ createdBy=(
456
+ extras["created_by_id"] if "created_by_id" in extras else None
457
+ ),
458
+ objectMarking=(
459
+ extras["object_marking_ids"]
460
+ if "object_marking_ids" in extras
461
+ else None
462
+ ),
463
+ objectLabel=(
464
+ extras["object_label_ids"] if "object_label_ids" in extras else None
465
+ ),
466
+ externalReferences=(
467
+ extras["external_references_ids"]
468
+ if "external_references_ids" in extras
469
+ else None
470
+ ),
467
471
  revoked=stix_object["revoked"] if "revoked" in stix_object else None,
468
- confidence=stix_object["confidence"]
469
- if "confidence" in stix_object
470
- else None,
472
+ confidence=(
473
+ stix_object["confidence"] if "confidence" in stix_object else None
474
+ ),
471
475
  lang=stix_object["lang"] if "lang" in stix_object else None,
472
476
  created=stix_object["created"] if "created" in stix_object else None,
473
477
  modified=stix_object["modified"] if "modified" in stix_object else None,
474
478
  name=stix_object["name"],
475
- description=self.opencti.stix2.convert_markdown(
476
- stix_object["description"]
477
- )
478
- if "description" in stix_object
479
- else None,
479
+ description=(
480
+ self.opencti.stix2.convert_markdown(stix_object["description"])
481
+ if "description" in stix_object
482
+ else None
483
+ ),
480
484
  aliases=self.opencti.stix2.pick_aliases(stix_object),
481
- first_seen=stix_object["first_seen"]
482
- if "first_seen" in stix_object
483
- else None,
484
- last_seen=stix_object["last_seen"]
485
- if "last_seen" in stix_object
486
- else None,
485
+ first_seen=(
486
+ stix_object["first_seen"] if "first_seen" in stix_object else None
487
+ ),
488
+ last_seen=(
489
+ stix_object["last_seen"] if "last_seen" in stix_object else None
490
+ ),
487
491
  goals=stix_object["goals"] if "goals" in stix_object else None,
488
- resource_level=stix_object["resource_level"]
489
- if "resource_level" in stix_object
490
- else None,
491
- primary_motivation=stix_object["primary_motivation"]
492
- if "primary_motivation" in stix_object
493
- else None,
494
- secondary_motivations=stix_object["secondary_motivations"]
495
- if "secondary_motivations" in stix_object
496
- else None,
497
- x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
498
- if "x_opencti_stix_ids" in stix_object
499
- else None,
500
- objectOrganization=stix_object["x_opencti_granted_refs"]
501
- if "x_opencti_granted_refs" in stix_object
502
- else None,
492
+ resource_level=(
493
+ stix_object["resource_level"]
494
+ if "resource_level" in stix_object
495
+ else None
496
+ ),
497
+ primary_motivation=(
498
+ stix_object["primary_motivation"]
499
+ if "primary_motivation" in stix_object
500
+ else None
501
+ ),
502
+ secondary_motivations=(
503
+ stix_object["secondary_motivations"]
504
+ if "secondary_motivations" in stix_object
505
+ else None
506
+ ),
507
+ x_opencti_stix_ids=(
508
+ stix_object["x_opencti_stix_ids"]
509
+ if "x_opencti_stix_ids" in stix_object
510
+ else None
511
+ ),
512
+ objectOrganization=(
513
+ stix_object["x_opencti_granted_refs"]
514
+ if "x_opencti_granted_refs" in stix_object
515
+ else None
516
+ ),
503
517
  update=update,
504
518
  )
505
519
  else:
@@ -456,40 +456,46 @@ class Language:
456
456
  if stix_object is not None:
457
457
  # Search in extensions
458
458
  if "x_opencti_stix_ids" not in stix_object:
459
- stix_object[
460
- "x_opencti_stix_ids"
461
- ] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
459
+ stix_object["x_opencti_stix_ids"] = (
460
+ self.opencti.get_attribute_in_extension("stix_ids", stix_object)
461
+ )
462
462
  if "x_opencti_granted_refs" not in stix_object:
463
- stix_object[
464
- "x_opencti_granted_refs"
465
- ] = self.opencti.get_attribute_in_extension("granted_refs", stix_object)
463
+ stix_object["x_opencti_granted_refs"] = (
464
+ self.opencti.get_attribute_in_extension("granted_refs", stix_object)
465
+ )
466
466
 
467
467
  return self.opencti.language.create(
468
468
  stix_id=stix_object["id"],
469
- createdBy=extras["created_by_id"]
470
- if "created_by_id" in extras
471
- else None,
472
- objectMarking=extras["object_marking_ids"]
473
- if "object_marking_ids" in extras
474
- else None,
475
- objectLabel=extras["object_label_ids"]
476
- if "object_label_ids" in extras
477
- else None,
478
- externalReferences=extras["external_references_ids"]
479
- if "external_references_ids" in extras
480
- else None,
469
+ createdBy=(
470
+ extras["created_by_id"] if "created_by_id" in extras else None
471
+ ),
472
+ objectMarking=(
473
+ extras["object_marking_ids"]
474
+ if "object_marking_ids" in extras
475
+ else None
476
+ ),
477
+ objectLabel=(
478
+ extras["object_label_ids"] if "object_label_ids" in extras else None
479
+ ),
480
+ externalReferences=(
481
+ extras["external_references_ids"]
482
+ if "external_references_ids" in extras
483
+ else None
484
+ ),
481
485
  revoked=stix_object["revoked"] if "revoked" in stix_object else None,
482
- confidence=stix_object["confidence"]
483
- if "confidence" in stix_object
484
- else None,
486
+ confidence=(
487
+ stix_object["confidence"] if "confidence" in stix_object else None
488
+ ),
485
489
  lang=stix_object["lang"] if "lang" in stix_object else None,
486
490
  created=stix_object["created"] if "created" in stix_object else None,
487
491
  modified=stix_object["modified"] if "modified" in stix_object else None,
488
492
  name=stix_object["name"],
489
493
  aliases=self.opencti.stix2.pick_aliases(stix_object),
490
- x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
491
- if "x_opencti_stix_ids" in stix_object
492
- else None,
494
+ x_opencti_stix_ids=(
495
+ stix_object["x_opencti_stix_ids"]
496
+ if "x_opencti_stix_ids" in stix_object
497
+ else None
498
+ ),
493
499
  update=update,
494
500
  )
495
501
  else:
@@ -456,52 +456,58 @@ class Location:
456
456
  if stix_object is not None:
457
457
  # Search in extensions
458
458
  if "x_opencti_aliases" not in stix_object:
459
- stix_object[
460
- "x_opencti_aliases"
461
- ] = self.opencti.get_attribute_in_extension("aliases", stix_object)
459
+ stix_object["x_opencti_aliases"] = (
460
+ self.opencti.get_attribute_in_extension("aliases", stix_object)
461
+ )
462
462
  if "x_opencti_stix_ids" not in stix_object:
463
- stix_object[
464
- "x_opencti_stix_ids"
465
- ] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
463
+ stix_object["x_opencti_stix_ids"] = (
464
+ self.opencti.get_attribute_in_extension("stix_ids", stix_object)
465
+ )
466
466
 
467
467
  return self.create(
468
468
  type=type,
469
469
  stix_id=stix_object["id"],
470
- createdBy=extras["created_by_id"]
471
- if "created_by_id" in extras
472
- else None,
473
- objectMarking=extras["object_marking_ids"]
474
- if "object_marking_ids" in extras
475
- else None,
476
- objectLabel=extras["object_label_ids"]
477
- if "object_label_ids" in extras
478
- else None,
479
- externalReferences=extras["external_references_ids"]
480
- if "external_references_ids" in extras
481
- else None,
470
+ createdBy=(
471
+ extras["created_by_id"] if "created_by_id" in extras else None
472
+ ),
473
+ objectMarking=(
474
+ extras["object_marking_ids"]
475
+ if "object_marking_ids" in extras
476
+ else None
477
+ ),
478
+ objectLabel=(
479
+ extras["object_label_ids"] if "object_label_ids" in extras else None
480
+ ),
481
+ externalReferences=(
482
+ extras["external_references_ids"]
483
+ if "external_references_ids" in extras
484
+ else None
485
+ ),
482
486
  revoked=stix_object["revoked"] if "revoked" in stix_object else None,
483
- confidence=stix_object["confidence"]
484
- if "confidence" in stix_object
485
- else None,
487
+ confidence=(
488
+ stix_object["confidence"] if "confidence" in stix_object else None
489
+ ),
486
490
  lang=stix_object["lang"] if "lang" in stix_object else None,
487
491
  created=stix_object["created"] if "created" in stix_object else None,
488
492
  modified=stix_object["modified"] if "modified" in stix_object else None,
489
493
  name=name,
490
- description=self.opencti.stix2.convert_markdown(
491
- stix_object["description"]
492
- )
493
- if "description" in stix_object
494
- else None,
494
+ description=(
495
+ self.opencti.stix2.convert_markdown(stix_object["description"])
496
+ if "description" in stix_object
497
+ else None
498
+ ),
495
499
  latitude=stix_object["latitude"] if "latitude" in stix_object else None,
496
- longitude=stix_object["longitude"]
497
- if "longitude" in stix_object
498
- else None,
499
- precision=stix_object["precision"]
500
- if "precision" in stix_object
501
- else None,
502
- x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
503
- if "x_opencti_stix_ids" in stix_object
504
- else None,
500
+ longitude=(
501
+ stix_object["longitude"] if "longitude" in stix_object else None
502
+ ),
503
+ precision=(
504
+ stix_object["precision"] if "precision" in stix_object else None
505
+ ),
506
+ x_opencti_stix_ids=(
507
+ stix_object["x_opencti_stix_ids"]
508
+ if "x_opencti_stix_ids" in stix_object
509
+ else None
510
+ ),
505
511
  x_opencti_aliases=self.opencti.stix2.pick_aliases(stix_object),
506
512
  update=update,
507
513
  )