@@ -311,17 +311,27 @@ def import_object(self, stix_object, update=False):
311311 else :
312312 published = datetime .datetime .today ().strftime ('%Y-%m-%dT%H:%M:%SZ' )
313313
314- title = source_name
314+ if 'mitre-attack (' in source_name and 'name' in stix_object :
315+ title = '[MITRE ATT&CK] ' + stix_object ['name' ]
316+ else :
317+ title = source_name
318+
315319 if 'external_id' in external_reference :
316320 title = title + ' (' + external_reference ['external_id' ] + ')'
317321 report_id = self .opencti .create_report_if_not_exists_from_external_reference (
318322 external_reference_id ,
319323 title ,
320324 external_reference ['description' ] if 'description' in external_reference else None ,
321325 published ,
322- 'external'
326+ 'external' ,
327+ 2
323328 )['id' ]
324329
330+ # Resolve author
331+ author_id = self .resolve_author (title )
332+ if author_id is not None :
333+ self .opencti .update_stix_domain_entity_created_by_ref (report_id , author_id )
334+
325335 # Add marking
326336 if 'marking_tlpwhite' in self .mapping_cache :
327337 object_marking_ref_result = self .mapping_cache ['marking_tlpwhite' ]
@@ -910,9 +920,15 @@ def import_relationship(self, stix_relation):
910920 title ,
911921 external_reference ['description' ] if 'description' in external_reference else None ,
912922 published ,
913- 'external'
923+ 'external' ,
924+ 2
914925 )['id' ]
915926
927+ # Resolve author
928+ author_id = self .resolve_author (title )
929+ if author_id is not None :
930+ self .opencti .update_stix_domain_entity_created_by_ref (report_id , author_id )
931+
916932 # Add marking
917933 if 'marking_tlpwhite' in self .mapping_cache :
918934 object_marking_ref_result = self .mapping_cache ['marking_tlpwhite' ]
@@ -930,6 +946,65 @@ def import_relationship(self, stix_relation):
930946 self .opencti .add_object_ref_to_report_if_not_exists (report_id , target_id )
931947 self .opencti .add_object_ref_to_report_if_not_exists (report_id , stix_relation_id )
932948
949+ def resolve_author (self , title ):
950+ if 'fireeye' in title .lower ():
951+ if 'FireEye' in self .mapping_cache :
952+ return self .mapping_cache ['FireEye' ]
953+ else :
954+ author_id = self .opencti .create_identity_if_not_exists ('Organization' , 'FireEye' , '' )['id' ]
955+ self .mapping_cache ['FireEye' ] = author_id
956+ return author_id
957+ if 'eset' in title .lower ():
958+ if 'ESET' in self .mapping_cache :
959+ return self .mapping_cache ['ESET' ]
960+ else :
961+ author_id = self .opencti .create_identity_if_not_exists ('Organization' , 'ESET' , '' )['id' ]
962+ self .mapping_cache ['ESET' ] = author_id
963+ return author_id
964+ if 'unit 42' in title .lower ():
965+ if 'PaloAlto' in self .mapping_cache :
966+ return self .mapping_cache ['PaloAlto' ]
967+ else :
968+ author_id = self .opencti .create_identity_if_not_exists ('Organization' , 'Palo Alto Networks' , '' )['id' ]
969+ self .mapping_cache ['PaloAlto' ] = author_id
970+ return author_id
971+ if 'accenture' in title .lower ():
972+ if 'Accenture' in self .mapping_cache :
973+ return self .mapping_cache ['Accenture' ]
974+ else :
975+ author_id = self .opencti .create_identity_if_not_exists ('Organization' , 'Accenture' , '' )['id' ]
976+ self .mapping_cache ['Accenture' ] = author_id
977+ return author_id
978+ if 'symantec' in title .lower ():
979+ if 'Symantec' in self .mapping_cache :
980+ return self .mapping_cache ['Symantec' ]
981+ else :
982+ author_id = self .opencti .create_identity_if_not_exists ('Organization' , 'Symantec' , '' )['id' ]
983+ self .mapping_cache ['Symantec' ] = author_id
984+ return author_id
985+ if 'mcafee' in title .lower ():
986+ if 'McAfee' in self .mapping_cache :
987+ return self .mapping_cache ['McAfee' ]
988+ else :
989+ author_id = self .opencti .create_identity_if_not_exists ('Organization' , 'McAfee' , '' )['id' ]
990+ self .mapping_cache ['McAfee' ] = author_id
991+ return author_id
992+ if 'crowdstrike' in title .lower ():
993+ if 'CrowdStrike' in self .mapping_cache :
994+ return self .mapping_cache ['CrowdStrike' ]
995+ else :
996+ author_id = self .opencti .create_identity_if_not_exists ('Organization' , 'CrowdStrike' , '' )['id' ]
997+ self .mapping_cache ['CrowdStrike' ] = author_id
998+ return author_id
999+ if 'mitre atta&ck' in title .lower ():
1000+ if 'Mitre' in self .mapping_cache :
1001+ return self .mapping_cache ['Mitre' ]
1002+ else :
1003+ author_id = self .opencti .create_identity_if_not_exists ('Organization' , 'The MITRE Corporation' , '' )['id' ]
1004+ self .mapping_cache ['Mitre' ] = author_id
1005+ return author_id
1006+ return None
1007+
9331008 def import_bundle (self , stix_bundle , update = False , types = []):
9341009 # Check if the bundle is correctly formated
9351010 if 'type' not in stix_bundle or stix_bundle ['type' ] != 'bundle' :
0 commit comments