@@ -234,7 +234,7 @@ def handle_list(list_object, object_type):
234
234
elif obj ['type' ] == "marking-definition" :
235
235
stix_mapping = marking_stix_mapping
236
236
else :
237
- exit
237
+ return stix_objects_list
238
238
239
239
if key in stix_mapping .keys ():
240
240
if key == "external_references" or key == "kill_chain_phases" :
@@ -1215,6 +1215,8 @@ def get_software_used_by_group(self, stix_object, stix_format=True):
1215
1215
for relation in relationships :
1216
1216
if get_type_from_id (relation .target_ref ) in ['malware' , 'tool' ]:
1217
1217
software_relationships .append (relation )
1218
+ if len (software_relationships ) == 0 :
1219
+ return software_relationships
1218
1220
filter_objects = [
1219
1221
Filter ('type' , 'in' , ['malware' , 'tool' ]),
1220
1222
Filter ('id' , '=' , [r .target_ref for r in software_relationships ])
@@ -1256,6 +1258,8 @@ def get_techniques_used_by_software(self, stix_object, stix_format=True):
1256
1258
for relation in relationships :
1257
1259
if get_type_from_id (relation .source_ref ) in ['malware' , 'tool' ]:
1258
1260
software_relationships .append (relation )
1261
+ if len (software_relationships ) == 0 :
1262
+ return software_relationships
1259
1263
filter_objects = [
1260
1264
Filter ('type' , '=' , 'attack-pattern' ),
1261
1265
Filter ('id' , '=' , [r .target_ref for r in software_relationships ])
@@ -1299,6 +1303,8 @@ def get_techniques_used_by_group_software(self, stix_object, stix_format=True):
1299
1303
for relation in relationships :
1300
1304
if get_type_from_id (relation .target_ref ) in ['malware' , 'tool' ]:
1301
1305
software_relationships .append (relation )
1306
+ if len (software_relationships ) == 0 :
1307
+ return software_relationships
1302
1308
# Get all used by the software that is used by group
1303
1309
filter_objects = [
1304
1310
Filter ('type' , '=' , 'relationship' ),
@@ -1364,6 +1370,8 @@ def get_techniques_mitigated_by_mitigation(self, stix_object, stix_format=True):
1364
1370
for relation in relationships :
1365
1371
if get_type_from_id (relation .source_ref ) == 'course-of-action' :
1366
1372
mitigation_relationships .append (relation )
1373
+ if len (mitigation_relationships ) == 0 :
1374
+ return mitigation_relationships
1367
1375
filter_objects = [
1368
1376
Filter ('type' , '=' , 'attack-pattern' ),
1369
1377
Filter ('id' , '=' , [r .target_ref for r in mitigation_relationships ])
@@ -1406,6 +1414,8 @@ def get_techniques_mitigated_by_all_mitigations(self, stix_format=True):
1406
1414
for relation in relationships :
1407
1415
if get_type_from_id (relation .source_ref ) in ['course-of-action' ]:
1408
1416
mitigation_relationships .append (relation )
1417
+ if len (mitigation_relationships ) == 0 :
1418
+ return mitigation_relationships
1409
1419
# Get all techniques
1410
1420
techniques = self .get_techniques ()
1411
1421
all_techniques_list = list ()
0 commit comments