bin/generate-atomic-docs.rb
def generate_attack_matrix!(title_prefix, output_doc_path, only_platform: /.*/)
    result = ''
    result += "# #{title_prefix} Atomic Tests by ATT&CK Tactic & Technique\n"

    result += "| #{ATTACK_API.ordered_tactics.join(' | ')} |\n"
    result += "|#{'-----|' * ATTACK_API.ordered_tactics.count}\n"

    ATTACK_API.ordered_tactic_to_technique_matrix(only_platform: only_platform).each do |row_of_techniques|
      row_values = row_of_techniques.collect do |technique|
        if technique
          ATOMIC_RED_TEAM.github_link_to_technique(technique, include_identifier: false, only_platform: only_platform)
        end
      end
      result += "| #{row_values.join(' | ')} |\n"
    end
    File.write output_doc_path, result

    puts "Generated ATT&CK matrix at #{output_doc_path}"
  end
#
# Generates a Markdown ATT&CK documentation matrix for all techniques
#
Generates a Markdown ATT&CK documentation matrix for all techniques
Generates a Markdown ATT&CK documentation matrix for all techniques
def generate_attack_matrix!(title_prefix, output_doc_path, only_platform: /.*/)
    result = ''
    result += "# #{title_prefix} Atomic Tests by ATT&CK Tactic & Technique\n"
    result += "| #{ATTACK_API.ordered_tactics.join(' | ')} |\n"
    result += "|#{'-----|' * ATTACK_API.ordered_tactics.count}\n"
    ATTACK_API.ordered_tactic_to_technique_matrix(only_platform: only_platform).each do |row_of_techniques|
      row_values = row_of_techniques.collect do |technique|
        if technique
          ATOMIC_RED_TEAM.github_link_to_technique(technique, include_identifier: false, only_platform: only_platform)
        end
      end
      result += "| #{row_values.join(' | ')} |\n"
    end
    File.write output_doc_path, result
    puts "Generated ATT&CK matrix at #{output_doc_path}"
  end
def generate_attack_matrix! ( title_prefix , output_doc_path , only_platform : / .* / ) result = '' result += "# #{title_prefix} Atomic Tests by ATT&CK Tactic & Technique\n" result += "| #{ATTACK_API.ordered_tactics.join(' | ')} |\n" result += "|#{'-----|' * ATTACK_API.ordered_tactics.count}\n" ATTACK_API . ordered_tactic_to_technique_matrix ( only_platform : only_platform ) . each do | row_of_techniques | row_values = row_of_techniques . collect do | technique | if technique ATOMIC_RED_TEAM . github_link_to_technique ( technique , include_identifier : false , only_platform : only_platform ) end end result += "| #{row_values.join(' | ')} |\n" end File . write output_doc_path , result puts "Generated ATT&CK matrix at #{output_doc_path}" end
Generates a Markdown ATT&CK documentation matrix for all techniques
Generates a Markdown ATT&CK documentation matrix for all techniques
title_prefix
output_doc_path
only_platform