2018-10-20 15:51:26 -06:00
$ ( document ) . ready ( function ( ) {
2020-04-03 11:14:15 -06:00
$ . get ( "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/Indexes/index.yaml" , function ( data ) {
2018-10-20 15:51:26 -06:00
window . atomic _index = jsyaml . safeLoad ( data ) ;
} ) ;
$ ( '.randoms > *' ) . hide ( )
} ) ;
roll _the _dice = function ( ) {
2021-07-30 10:34:52 -07:00
$ ( '.randoms > *' ) . hide ( ) ;
2018-10-20 15:51:26 -06:00
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 )
2021-07-30 10:34:52 -07:00
$ ( '.random-tactic-name' ) . text ( tactic _name . toUpperCase ( ) ) . fadeIn ( function ( ) {
2018-10-20 15:51:26 -06:00
setTimeout ( function ( ) {
$ ( '.random-technique-name' ) . text ( technique _name ) . fadeIn ( function ( ) {
setTimeout ( function ( ) {
2021-07-30 10:34:52 -07:00
if ( test == undefined ) {
$ ( '.random-test-name' ) . text ( "No Test Found :(" ) . fadeIn ( ) ;
$ ( '.random-test-description' ) . html ( "<a target='_blank' href='https://github.com/redcanaryco/atomic-red-team/wiki/Contributing'>Add your own?</a>" ) . fadeIn ( ) ;
2018-10-20 15:51:26 -06:00
} else {
2021-07-30 10:34:52 -07:00
$ ( '.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 ( )
} // END if/else
2018-10-20 15:51:26 -06:00
} , 500 ) ;
} ) ;
} , 500 ) ;
} ) ;
}