@@ -378,6 +378,52 @@ def extract_embedded_relationships(
378378 "type" : kill_chain_phase ["entity_type" ],
379379 }
380380 kill_chain_phases_ids .append (kill_chain_phase ["id" ])
381+ elif (
382+ self .opencti .get_attribute_in_extension ("kill_chain_phases" , stix_object )
383+ is not None
384+ ):
385+ for kill_chain_phase in self .opencti .get_attribute_in_extension (
386+ "kill_chain_phases" , stix_object
387+ ):
388+ if (
389+ kill_chain_phase ["kill_chain_name" ] + kill_chain_phase ["phase_name" ]
390+ in self .mapping_cache
391+ ):
392+ kill_chain_phase = self .mapping_cache [
393+ kill_chain_phase ["kill_chain_name" ]
394+ + kill_chain_phase ["phase_name" ]
395+ ]
396+ else :
397+ if (
398+ "x_opencti_order" not in kill_chain_phase
399+ and self .opencti .get_attribute_in_extension (
400+ "order" , kill_chain_phase
401+ )
402+ is not None
403+ ):
404+ kill_chain_phase [
405+ "x_opencti_order"
406+ ] = self .opencti .get_attribute_in_extension (
407+ "order" , kill_chain_phase
408+ )
409+ kill_chain_phase = self .opencti .kill_chain_phase .create (
410+ kill_chain_name = kill_chain_phase ["kill_chain_name" ],
411+ phase_name = kill_chain_phase ["phase_name" ],
412+ x_opencti_order = kill_chain_phase ["x_opencti_order" ]
413+ if "x_opencti_order" in kill_chain_phase
414+ else 0 ,
415+ stix_id = kill_chain_phase ["id" ]
416+ if "id" in kill_chain_phase
417+ else None ,
418+ )
419+ self .mapping_cache [
420+ kill_chain_phase ["kill_chain_name" ]
421+ + kill_chain_phase ["phase_name" ]
422+ ] = {
423+ "id" : kill_chain_phase ["id" ],
424+ "type" : kill_chain_phase ["entity_type" ],
425+ }
426+ kill_chain_phases_ids .append (kill_chain_phase ["id" ])
381427 # Object refs
382428 object_refs_ids = (
383429 stix_object ["object_refs" ] if "object_refs" in stix_object else []
0 commit comments