second phase of template fix (#3285)

This commit is contained in:
philhagen-rc
2026-02-18 11:45:22 -05:00
committed by GitHub
parent eee9292a81
commit 78bbf833fb
+19 -25
View File
@@ -1,9 +1,8 @@
# <%= technique['identifier'] %> - <%= technique['name'] -%>
# <%= technique['identifier'] %> - <%= technique['name'] %>
## Description from ATT&CK
<% attack_description_lines = technique['description'].gsub("%\\<", "%<").gsub(/<code>.*?<\/code>/) { |match| match.gsub('~', '\~') } %>
<% attack_description_lines.each do |desc_line| %>> <%= desc['line'].strip %>
<% attack_description_lines.lines.each do |desc_line| %>> <%= desc_line.strip -%>
<% end %>
[Source](https://attack.mitre.org/techniques/<%= technique['identifier'].gsub(/\./, '/') %>)
@@ -11,14 +10,12 @@
## Atomic Tests
<% atomic_yaml['atomic_tests'].each_with_index do |test, test_number| -%>
<% title = "Atomic Test ##{test_number+1} - #{test['name']}" %>- [<%= title %>](#<%= title.downcase.gsub(/ /, '-').gsub(/[`~!@#$%^&*()+=<>?,.\/:;"'|{}\[\]\\–—]/, '') %>)
<% title = "Atomic Test ##{test_number+1}: #{test['name']}" %>- [<%= title %>](#<%= title.downcase.gsub(/ /, '-').gsub(/[`~!@#$%^&*()+=<>?,.\/:;"'|{}\[\]\\–—]/, '') %>)
<% end %>
<% atomic_yaml['atomic_tests'].each_with_index do |test, test_number| -%>
### Atomic Test #<%= test_number+1 %>: <%= test['name'] %>
### Atomic Test #<%= test_number+1 %> - <%= test['name'] %>
<%= test['description'].strip -%>
<%= test['description'].strip %>
**Supported Platforms:** <%= test['supported_platforms'].collect do |p|
case p
@@ -30,13 +27,11 @@
end.join(', ') %>
**auto_generated_guid:** `<%= test['auto_generated_guid'] %>`
<%def cleanup(input)
input.to_s.strip.gsub(/\\/,"&#92;")
end%>
end -%>
<% if test['input_arguments'].to_a.count > 0 %>
#### Inputs:
#### Inputs
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
@@ -46,13 +41,11 @@ end%>
<% end -%>
<%- if test['executor']['name'] == 'manual' -%>
#### Run it with these steps! <%- if test['executor']['elevation_required'] -%> Elevation Required (e.g. root or admin) <%- end -%>
#### Attack Commands: Run it with these steps! <%- if test['executor']['elevation_required'] -%> Elevation Required (e.g. root or admin) <%- end -%>
<%= test['executor']['steps'] %>
<%- else -%>
##### Attack Commands: Run with `<%= test['executor']['name'] %>`! <%- if test['executor']['elevation_required'] -%> Elevation Required (e.g. root or admin) <%- end -%>
#### Attack Commands: Run with `<%= test['executor']['name'] %>`!<%- if test['executor']['elevation_required'] -%> Elevation Required (e.g. root or admin)<%- end -%>
<%def get_language(executor)
language = executor
if executor == "command_prompt"
@@ -69,30 +62,31 @@ end%>
<%- end -%>
<%- if test['executor']['cleanup_command'] != nil -%>
##### Cleanup Commands:
#### Cleanup Commands
```<%= get_language(test['executor']['name']) %>
<%= test['executor']['cleanup_command'].to_s.strip %>
```
<%- end -%>
<% if test['dependencies'].to_a.count > 0 %>
<% dependency_executor = test['executor']['name'] %>
#### Dependencies: Run with `<%- if test['dependency_executor_name'] != nil%><% dependency_executor = test['dependency_executor_name'] %><%= test['dependency_executor_name'] %><%- else -%><%= test['executor']['name'] %><%- end -%>`!
<% end -%>
<% if test['dependencies'].to_a.count > 0 -%>
<% dependency_executor = test['executor']['name'] -%>
#### Dependencies: Run with `<%- if test['dependency_executor_name'] != nil%><% dependency_executor = test['dependency_executor_name'] %><%= test['dependency_executor_name'] %><%- else -%><%= test['executor']['name'] %><%- end -%>`!
<% test['dependencies'].each do | dep | -%>
##### Description: <%= dep['description'].strip %>
###### Check Prereq Commands:
###### Check Prereq Commands
```<%= get_language(dependency_executor) %>
<%= dep['prereq_command'].strip %>
```
###### Get Prereq Commands:
###### Get Prereq Commands
```<%= get_language(dependency_executor) %>
<%= dep['get_prereq_command'].strip %>
```
<% end -%>
<% end %>
<% end -%>
<%- end -%>