@@ -1084,7 +1084,20 @@ def prepare_export(
10841084 if "objects" in entity :
10851085 del entity ["objects" ]
10861086 del entity ["objectsIds" ]
1087+ # Stix Sighting Relationship
1088+ if entity ["type" ] == "stix-sighting-relationship" :
1089+ entity ["type" ] = "sighting"
1090+ entity ["count" ] = entity ["attribute_count" ]
1091+ del entity ["attribute_count" ]
1092+ entity ["sighting_of_ref" ] = entity ["from" ]["standard_id" ]
1093+ objects_to_get .append (entity ["from" ]["standard_id" ])
1094+ entity ["where_sighted_refs" ] = entity ["to" ]["standard_id" ]
1095+ objects_to_get .append (entity ["to" ]["standard_id" ])
1096+ del entity ["from" ]
1097+ del entity ["to" ]
10871098 # Stix Core Relationship
1099+ if "from" in entity or "to" in entity :
1100+ entity ["type" ] = "relationship"
10881101 if "from" in entity :
10891102 entity ["source_ref" ] = entity ["from" ]["standard_id" ]
10901103 objects_to_get .append (entity ["from" ]["standard_id" ])
@@ -1095,6 +1108,7 @@ def prepare_export(
10951108 objects_to_get .append (entity ["to" ]["standard_id" ])
10961109 if "to" in entity :
10971110 del entity ["to" ]
1111+ # Stix Cyber Observable
10981112 if "observable_value" in entity :
10991113 del entity ["observable_value" ]
11001114
@@ -1141,6 +1155,41 @@ def prepare_export(
11411155 + stix_core_relationship ["id" ]
11421156 + '" are less than max definition, not exporting the relation AND the target entity.' ,
11431157 )
1158+ # Get sighting
1159+ stix_sighting_relationships = self .opencti .stix_sighting_relationship .list (
1160+ fromId = entity ["x_opencti_id" ]
1161+ )
1162+ for stix_sighting_relationship in stix_sighting_relationships :
1163+ if self .check_max_marking_definition (
1164+ max_marking_definition_entity ,
1165+ stix_sighting_relationship ["objectMarking" ]
1166+ if "objectMarking" in stix_sighting_relationship
1167+ else None ,
1168+ ):
1169+ objects_to_get .append (
1170+ stix_sighting_relationship ["to" ]
1171+ if stix_sighting_relationship ["to" ]["id" ] != entity ["x_opencti_id" ]
1172+ else stix_sighting_relationship ["from" ]
1173+ )
1174+ relation_object_data = self .prepare_export (
1175+ self .generate_export (stix_sighting_relationship ),
1176+ "simple" ,
1177+ max_marking_definition_entity ,
1178+ )
1179+ relation_object_bundle = self .filter_objects (
1180+ uuids , relation_object_data
1181+ )
1182+ uuids = uuids + [x ["id" ] for x in relation_object_bundle ]
1183+ result = result + relation_object_bundle
1184+ else :
1185+ self .opencti .log (
1186+ "info" ,
1187+ "Marking definitions of "
1188+ + stix_sighting_relationship ["entity_type" ]
1189+ + ' "'
1190+ + stix_sighting_relationship ["id" ]
1191+ + '" are less than max definition, not exporting the relation AND the target entity.' ,
1192+ )
11441193 # Export
11451194 reader = {
11461195 "Attack-Pattern" : self .opencti .attack_pattern .read ,
0 commit comments