@@ -764,8 +764,13 @@ def get_related(thesrc, src_type, rel_type, target_type, reverse=False):
764
764
# software:group
765
765
def software_used_by_groups (thesrc ):
766
766
""" returns group_id => {software, relationship} for each software used by the group."""
767
- x = get_related(thesrc, " intrusion-set" , " uses" , " tool" )
768
- x.update(get_related(thesrc, " intrusion-set" , " uses" , " malware" ))
767
+ x = get_related(thesrc, " intrusion-set" , " uses" , " malware" )
768
+ x_tool = get_related(thesrc, " intrusion-set" , " uses" , " tool" )
769
+ for key in x_tool:
770
+ if key in x:
771
+ x[key].extend(x_tool[key])
772
+ else :
773
+ x[key] = x_tool[key]
769
774
return x
770
775
771
776
def groups_using_software (thesrc ):
@@ -793,7 +798,12 @@ def techniques_used_by_software(thesrc):
793
798
def software_using_technique (thesrc ):
794
799
""" return technique_id => {software, relationship} for each software using the technique."""
795
800
x = get_related(thesrc, " malware" , " uses" , " attack-pattern" , reverse = True )
796
- x.update(get_related(thesrc, " tool" , " uses" , " attack-pattern" , reverse = True ))
801
+ x_tool = get_related(thesrc, " tool" , " uses" , " attack-pattern" , reverse = True )
802
+ for key in x_tool:
803
+ if key in x:
804
+ x[key].extend(x_tool[key])
805
+ else :
806
+ x[key] = x_tool[key]
797
807
return x
798
808
799
809
# technique:mitigation
0 commit comments