Skip to content

Instantly share code, notes, and snippets.

@CrimsonMaple
Created February 26, 2018 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CrimsonMaple/1c04691eb9a296eb56fcad17a615177c to your computer and use it in GitHub Desktop.
Save CrimsonMaple/1c04691eb9a296eb56fcad17a615177c to your computer and use it in GitHub Desktop.
NoSource JR + NoSource Solve
var enc_key_jr = "nosource"; // -> "easyctf{" -> "soupy"
var enc_key = "heheheh!"; // -> "easyctf{" -> "hoo_hoo!"
var flag_nosource_jr = "Fg4GCRoHCQ4TFh0IBxENAE4qEgwHMBsfDiwJRQImHV8GQAwBDEYvV11BCA==";
var flag_nosource = "DQ4cJgsbCVofB18sNw4wRlhfCwAbXxpTC1wwKVlcGBIaUDAGJzowYDoqTiI=";
function process(a, b) {
'use strict';
var len = Math.max(a.length, b.length);
var out = [];
for (var i = 0, ca, cb; i < len; i++) {
ca = a.charCodeAt(i % a.length);
cb = b.charCodeAt(i % b.length);
out.push(ca ^ cb);
}
return String.fromCharCode.apply(null, out);
}
function dec_flag(flag, boolean) {
flag_tmp = atob(flag);
if (boolean == 0)
console.log(process(flag_tmp, enc_key_jr));
else
console.log(process(flag_tmp, enc_key))
}
dec_flag(flag_nosource_jr, 0);
dec_flag(flag_nosource, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment