Merge pull request #381 from redcanaryco/roll-the-dice

initial commit of roll the dice implementation
This commit is contained in:
Keith McCammon
2018-10-20 19:18:14 -06:00
committed by GitHub
4 changed files with 118 additions and 0 deletions
+6
View File
@@ -8,6 +8,9 @@
<meta name="theme-color" content="#157878">
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
<link rel="icon" type="image/png" href="assets/images/favicon.png">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.12.0/js-yaml.min.js" ></script>
</head>
<body>
<section class="page-header" style="background-image: url('https://redcanary.com/wp-content/uploads/product-features-bg.png');
@@ -50,5 +53,8 @@
ga('send', 'pageview');
</script>
{% endif %}
<script src="{{ base.url | prepend: site.url }}/assets/javascripts/{{ page.path | replace: 'md', 'js' }}"></script>
</body>
</html>
+12
View File
@@ -11,4 +11,16 @@ $section-headings-color: #CE232E;
html {
font-size: 14px;
}
.btn.btn-roll-the-dice {
font-size: 2em;
color: white;
background: #CE232E;
padding: 10px 50px;
margin: 0 auto;
}
table#roll-the-dice th {
vertical-align: top;
}
+50
View File
@@ -0,0 +1,50 @@
$(document).ready(function () {
$.get("https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/index.yaml", function (data) {
window.atomic_index = jsyaml.safeLoad(data);
});
$('.randoms > *').hide()
});
roll_the_dice = function () {
var tactic_name = Object.keys(window.atomic_index)[Math.floor(Math.random() * Object.keys(window.atomic_index).length)];
var tactic = window.atomic_index[tactic_name]
console.log("Random tactic:")
console.log(tactic_name)
console.log(tactic)
var technique_name = Object.keys(tactic)[Math.floor(Math.random() * Object.keys(tactic).length)];
var technique = tactic[technique_name]
console.log("Random technique:")
console.log(technique_name)
console.log(technique)
var test = technique.atomic_tests[Math.floor(Math.random() * technique.atomic_tests.length)];
console.log("Random test:")
console.log(test)
$('.random-tactic-name').text(tactic_name).fadeIn(function () {
setTimeout(function () {
$('.random-technique-name').text(technique_name).fadeIn(function () {
setTimeout(function () {
$('.random-test-name').text(test.name).fadeIn();
$('.random-test-description').text(test.description).fadeIn();
$('.random-test-platforms em').text(test.supported_platforms).fadeIn();
if (test.input_arguments) {
$('.random-test-input-arguments pre').text(jsyaml.safeDump(test.input_arguments)).fadeIn();
} else {
$('.random-test-input-arguments').hide()
}
$('.random-test-executor-name').text("Run with " + test.executor.name).fadeIn();
$('.random-test-executor-steps').text(test.executor.command).fadeIn();
var link = "https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/" +
technique.technique.identifier + "/" + technique.technique.identifier + ".md"
$('.random-test-link').attr('href', link)
$('.random-test-link').text(link).fadeIn();
$('.randoms > *').show()
}, 500);
});
}, 500);
});
}
+50
View File
@@ -0,0 +1,50 @@
---
layout: default
---
# Roll the Dice
Not sure where to start? Roll the dice to select a random Atomic Test from the catalog. Kudos to
[Tim Malcomvetter](https://medium.com/@malcomvetter/red-team-use-of-mitre-att-ck-f9ceac6b3be2) and
[Tim McG](https://www.twitter.com/NotMedic) for the idea.
<div style="text-align: center; margin-bottom: 30px;">
<a class="btn btn-roll-the-dice" href="#" onclick="roll_the_dice()">Roll the dice!</a>
</div>
<table id="roll-the-dice" style="width: auto; margin: 0 auto; display: table; min-width: 700px; max-width: 700px;">
<tr>
<th style="width: 120px"><strong>Tactic</strong></th>
<td class="randoms">
<h2 class="random-tactic-name"></h2>
</td>
</tr>
<tr>
<th><strong>Technique</strong></th>
<td class="randoms">
<h2 class="random-technique-name"></h2>
</td>
</tr>
<tr>
<th><strong>Atomic Test</strong></th>
<td class="randoms">
<h2 class="random-test-name"></h2>
<blockquote class="random-test-description" style="display: block;"></blockquote>
<div class="random-test-platforms">
<h3>
Platforms:
<em></em>
</h3>
</div>
<div class="random-test-input-arguments">
<h3>Input Arguments:</h3>
<pre></pre>
</div>
<hr/>
<h3 class="random-test-executor-name"></h3>
<pre class="random-test-executor-steps" style="max-width: 700px"></pre>
<hr/>
<p>Learn more at <a class="random-test-link" href="#"></a></p>
</td>
</tr>
</table>