@@ -524,81 +524,99 @@ def import_from_stix2(self, **kwargs):
524524 else 0
525525 )
526526 if "x_mitre_platforms" not in stix_object :
527- stix_object [
528- "x_mitre_platforms"
529- ] = self . opencti . get_attribute_in_mitre_extension (
530- "platforms" , stix_object
527+ stix_object ["x_mitre_platforms" ] = (
528+ self . opencti . get_attribute_in_mitre_extension (
529+ "platforms" , stix_object
530+ )
531531 )
532532 if "x_mitre_permissions_required" not in stix_object :
533- stix_object [
534- "x_mitre_permissions_required"
535- ] = self . opencti . get_attribute_in_mitre_extension (
536- "permissions_required" , stix_object
533+ stix_object ["x_mitre_permissions_required" ] = (
534+ self . opencti . get_attribute_in_mitre_extension (
535+ "permissions_required" , stix_object
536+ )
537537 )
538538 if "x_mitre_detection" not in stix_object :
539- stix_object [
540- "x_mitre_detection"
541- ] = self . opencti . get_attribute_in_mitre_extension (
542- "detection" , stix_object
539+ stix_object ["x_mitre_detection" ] = (
540+ self . opencti . get_attribute_in_mitre_extension (
541+ "detection" , stix_object
542+ )
543543 )
544544 if "x_opencti_stix_ids" not in stix_object :
545- stix_object [
546- "x_opencti_stix_ids"
547- ] = self . opencti . get_attribute_in_extension ( "stix_ids" , stix_object )
545+ stix_object ["x_opencti_stix_ids" ] = (
546+ self . opencti . get_attribute_in_extension ( "stix_ids" , stix_object )
547+ )
548548 if "x_opencti_granted_refs" not in stix_object :
549- stix_object [
550- "x_opencti_granted_refs"
551- ] = self . opencti . get_attribute_in_extension ( "granted_refs" , stix_object )
549+ stix_object ["x_opencti_granted_refs" ] = (
550+ self . opencti . get_attribute_in_extension ( "granted_refs" , stix_object )
551+ )
552552
553553 return self .create (
554554 stix_id = stix_object ["id" ],
555- createdBy = extras ["created_by_id" ]
556- if "created_by_id" in extras
557- else None ,
558- objectMarking = extras ["object_marking_ids" ]
559- if "object_marking_ids" in extras
560- else None ,
561- objectLabel = extras ["object_label_ids" ]
562- if "object_label_ids" in extras
563- else None ,
564- externalReferences = extras ["external_references_ids" ]
565- if "external_references_ids" in extras
566- else None ,
555+ createdBy = (
556+ extras ["created_by_id" ] if "created_by_id" in extras else None
557+ ),
558+ objectMarking = (
559+ extras ["object_marking_ids" ]
560+ if "object_marking_ids" in extras
561+ else None
562+ ),
563+ objectLabel = (
564+ extras ["object_label_ids" ] if "object_label_ids" in extras else None
565+ ),
566+ externalReferences = (
567+ extras ["external_references_ids" ]
568+ if "external_references_ids" in extras
569+ else None
570+ ),
567571 revoked = stix_object ["revoked" ] if "revoked" in stix_object else None ,
568- confidence = stix_object [ "confidence" ]
569- if "confidence" in stix_object
570- else None ,
572+ confidence = (
573+ stix_object [ "confidence" ] if "confidence" in stix_object else None
574+ ) ,
571575 lang = stix_object ["lang" ] if "lang" in stix_object else None ,
572576 created = stix_object ["created" ] if "created" in stix_object else None ,
573577 modified = stix_object ["modified" ] if "modified" in stix_object else None ,
574578 name = stix_object ["name" ],
575- description = self . opencti . stix2 . convert_markdown (
576- stix_object ["description" ]
577- )
578- if "description" in stix_object
579- else None ,
579+ description = (
580+ self . opencti . stix2 . convert_markdown ( stix_object ["description" ])
581+ if "description" in stix_object
582+ else None
583+ ) ,
580584 aliases = self .opencti .stix2 .pick_aliases (stix_object ),
581- x_mitre_platforms = stix_object ["x_mitre_platforms" ]
582- if "x_mitre_platforms" in stix_object
583- else stix_object ["x_amitt_platforms" ]
584- if "x_amitt_platforms" in stix_object
585- else None ,
586- x_mitre_permissions_required = stix_object ["x_mitre_permissions_required" ]
587- if "x_mitre_permissions_required" in stix_object
588- else None ,
589- x_mitre_detection = stix_object ["x_mitre_detection" ]
590- if "x_mitre_detection" in stix_object
591- else None ,
585+ x_mitre_platforms = (
586+ stix_object ["x_mitre_platforms" ]
587+ if "x_mitre_platforms" in stix_object
588+ else (
589+ stix_object ["x_amitt_platforms" ]
590+ if "x_amitt_platforms" in stix_object
591+ else None
592+ )
593+ ),
594+ x_mitre_permissions_required = (
595+ stix_object ["x_mitre_permissions_required" ]
596+ if "x_mitre_permissions_required" in stix_object
597+ else None
598+ ),
599+ x_mitre_detection = (
600+ stix_object ["x_mitre_detection" ]
601+ if "x_mitre_detection" in stix_object
602+ else None
603+ ),
592604 x_mitre_id = x_mitre_id ,
593- killChainPhases = extras ["kill_chain_phases_ids" ]
594- if "kill_chain_phases_ids" in extras
595- else None ,
596- x_opencti_stix_ids = stix_object ["x_opencti_stix_ids" ]
597- if "x_opencti_stix_ids" in stix_object
598- else None ,
599- objectOrganization = stix_object ["x_opencti_granted_refs" ]
600- if "x_opencti_granted_refs" in stix_object
601- else None ,
605+ killChainPhases = (
606+ extras ["kill_chain_phases_ids" ]
607+ if "kill_chain_phases_ids" in extras
608+ else None
609+ ),
610+ x_opencti_stix_ids = (
611+ stix_object ["x_opencti_stix_ids" ]
612+ if "x_opencti_stix_ids" in stix_object
613+ else None
614+ ),
615+ objectOrganization = (
616+ stix_object ["x_opencti_granted_refs" ]
617+ if "x_opencti_granted_refs" in stix_object
618+ else None
619+ ),
602620 update = update ,
603621 )
604622 else :
0 commit comments