bin/generate-atomic-docs.rb
#
# Generates a master YAML index of ATT&CK Tactic -> Technique -> Atomic Tests
#
Generates a master YAML index of ATT&CK Tactic -> Technique -> Atomic Tests
Generates a master YAML index of ATT&CK Tactic - > Technique - > Atomic Tests
def generate_yaml_index!(output_doc_path)
    result = {}
    ATTACK_API.techniques_by_tactic.each do |tactic, techniques|
      result[tactic] = techniques.collect do |technique|
        [
            technique['external_references'][0]['external_id'],
            {
                'technique' => technique,
                'atomic_tests' => ATOMIC_RED_TEAM.atomic_tests_for_technique(technique)
            }
        ]
      end.to_h
    end
    File.write output_doc_path, JSON.parse(result.to_json).to_yaml 
    puts "Generated Atomic Red Team YAML index at #{output_doc_path}"
  end
def generate_yaml_index! ( output_doc_path ) result = { } ATTACK_API . techniques_by_tactic . each do | tactic , techniques | result [ tactic ] = techniques . collect do | technique | [ technique [ 'external_references' ] [ 0 ] [ 'external_id' ] , { 'technique' => technique , 'atomic_tests' => ATOMIC_RED_TEAM . atomic_tests_for_technique ( technique ) } ] end . to_h end File . write output_doc_path , JSON . parse ( result . to_json ) . to_yaml puts "Generated Atomic Red Team YAML index at #{output_doc_path}" end
Generates a master YAML index of ATT&CK Tactic -> Technique -> Atomic Tests
Generates a master YAML index of ATT&CK Tactic - > Technique - > Atomic Tests
# shenanigans to eliminate YAML aliases
output_doc_path