Risk of Rain 2 CTF by cyber-operations.net

I’ve just gone through my friend’s debut CTF; a Risk of Rain 2 inspired CTF by Joseph of cyber-operations.net. Whilst short, it was practically a game jam for someone who had never constructed a CTF before, only played them. So with that in mind this was certainly a quite well-made, coherent and fun CTF. I certainly enjoyed every minute of it (other than figuring out the password format :P more on that later).

[Read more]

Throwback Thursday: JavaScript DNA Sequencer without Loop Structures

Not as exciting as it sounds, functional loops such as .forEach() and .every() were permitted lol

So I’ve decided to help maintain a regular schedule I’ll make myself post some past work as well as log what I do these days.

"use strict";

const testlib = require( './testlib.js' );

let dna_matches = [];
let dna_freqs = {};

let dna_map = {
	'C': ['C'],
	'T': ['T'],
	'A': ['A'],
	'G': ['G'],
	'R': ['G', 'A'],
	'Y': ['T', 'C'],
	'K': ['G', 'T'],
	'M': ['A', 'C'],
	'S': ['G', 'C'],
	'W': ['A', 'T'],
	'B': ['G', 'T', 'C'],
	'D': ['G', 'A', 'T'],
	'H': ['A', 'C', 'T'],
	'V': ['G', 'C', 'A'],
	'N': ['A', 'G', 'C', 'T'],
}

let last_entered = '';
let buffers = [];
let offset = 0;

function isMatch(current, index) {
	let matchFound = false; 
	if(buffers[index].length != current.length){
		buffers[index].push(last_entered);
	} else {
		matchFound = dna_matches[index].split("").every( (elem, i) => {
			if(elem == buffers[index][i]){
				return true;
			} else {
				return dna_map[elem].includes(buffers[index][i]);
			}
		});

		if(matchFound){
			dna_freqs[current]++;
			testlib.foundMatch(current, offset - buffers[index].length)
		}
		buffers[index].shift();
		buffers[index].push(last_entered);
	}
}

function reset(current,index) {
	dna_freqs[current] = 0;
	buffers[index] = [];
	offset = 0;
}

testlib.on( 'ready', function( patterns ) {
	dna_matches = patterns;
	dna_matches.forEach(reset);
	testlib.runTests();
} );

testlib.on( 'data', function ( data ) {
	last_entered = data;
	dna_matches.forEach(isMatch);
	offset++;
} );

testlib.on( 'end', function() {
	dna_matches.forEach(isMatch);
	testlib.frequencyTable(dna_freqs);
	dna_matches.forEach(reset);
} );

testlib.on( 'reset', function() {
	dna_matches.forEach(isMatch);
	testlib.frequencyTable(dna_freqs);
	dna_matches.forEach(reset);
});

testlib.setup( 3, 0 );

I’ve removed the comments so I can walk through each step (and also maybe show off the fairly short solution).

[Read more]

Hello world!

Gonna be using this simple template until I can figure out how to do a web dev and go with my original idea.

[Read more]