Update attack_api.rb (#2624)

Co-authored-by: Carrie Roberts <clr2of8@gmail.com>
This commit is contained in:
Hare Sudhan
2023-11-28 11:01:37 -05:00
committed by GitHub
parent 3a9bc49be3
commit 3bd3ceb8a2
+3 -1
View File
@@ -76,6 +76,8 @@ class Attack
techniques.each do |technique|
next unless !technique['x_mitre_platforms'].nil?
next unless technique['x_mitre_platforms'].any? { |platform| platform.downcase.sub(" ", "-") =~ only_platform }
next unless technique.fetch('revoked', false) == false
next unless technique.fetch('x_mitre_deprecated', false) == false
technique.fetch('kill_chain_phases', []).select { |phase| phase['kill_chain_name'] == 'mitre-attack' }.each do |tactic|
techniques_by_tactic[tactic.fetch('phase_name')] << technique
@@ -91,7 +93,7 @@ class Attack
return @techniques unless @techniques.nil?
# pull out the attack pattern objects
@techniques = attack_stix.fetch("objects").select do |item|
@techniques = attack_stix.fetch("objects").select do |item|
item.fetch('type') == 'attack-pattern' && item.fetch('external_references', []).select do |references|
references['source_name'] == 'mitre-attack'
end