Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions atomic_red_team/atomic_doc_template.md.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# <%= technique['identifier'] %> - <%= technique['name'] -%>

## [Description from ATT&CK](https://attack.mitre.org/techniques/<%= technique['identifier'].gsub(/\./, '/') %>)
<blockquote>
## Description from ATT&CK

<%= technique['description'].gsub("%\\<", "%<").gsub(/<code>.*?<\/code>/) { |match| match.gsub('~', '\~') } %>
<% attack_description_lines = technique['description'].gsub("%\\<", "%<").gsub(/<code>.*?<\/code>/) { |match| match.gsub('~', '\~') } %>
<% attack_description_lines.each do |desc_line| %>> <%= desc['line'].strip %>
<% end %>

</blockquote>
[Source](https://attack.mitre.org/techniques/<%= technique['identifier'].gsub(/\./, '/') %>)

## 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| -%>
<br/>

## Atomic Test #<%= test_number+1 %> - <%= test['name'] %>
<%= test['description'].strip -%>
### Atomic Test #<%= test_number+1 %> - <%= test['name'] %>

<%= test['description'].strip -%>

**Supported Platforms:** <%= test['supported_platforms'].collect do |p|
case p
Expand All @@ -29,16 +29,15 @@
end
end.join(', ') %>


**auto_generated_guid:** <%= test['auto_generated_guid'] %>

**auto_generated_guid:** `<%= test['auto_generated_guid'] %>`

<%def cleanup(input)
input.to_s.strip.gsub(/\\/,"&#92;")
end%>

<% if test['input_arguments'].to_a.count > 0 %>
#### Inputs:

| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
<% test['input_arguments'].each do |arg_name, arg_options| -%>
Expand All @@ -52,7 +51,7 @@ 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
Expand All @@ -70,7 +69,8 @@ end%>
<%- end -%>

<%- if test['executor']['cleanup_command'] != nil -%>
#### Cleanup Commands:
##### Cleanup Commands:

```<%= get_language(test['executor']['name']) %>
<%= test['executor']['cleanup_command'].to_s.strip %>
```
Expand All @@ -79,21 +79,20 @@ 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 -%>




<br/>
<%- end -%>