Instantly share code, notes, and snippets.

@juananpe /main.js Secret
Created Aug 1, 2018

Embed
What would you like to do?
HackIt! 2018 Level 3
var sudoku = $("#su input")
var s ="852931647473862159961547283318476925549328761726159834637294518194685372285713496"
// var s ="852913647473862159961547283728135964549726831316489725637294518194658372285371496"
// var s ="852913647473862159961547283318476925549328761726159834637294518194685372285731496"
for (var i = 0; i < sudoku.length; i++){ sudoku[i].value = s.charAt(i); }
$("video")[0].needs_reload = 1;
!function() {
var o = new Uint8Array([48, 130, 1, 34, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 130, 1, 15, 0, 48, 130, 1, 10, 2, 130, 1, 1, 0, 208, 1, 68, 22, 224, 143, 173, 53, 62, 101, 191, 203, 235, 29, 195, 91, 109, 109, 246, 238, 118, 161, 209, 253, 86, 218, 195, 213, 72, 35, 212, 166, 128, 22, 98, 88, 234, 200, 205, 149, 124, 43, 174, 222, 55, 91, 52, 201, 139, 87, 91, 165, 64, 167, 212, 195, 173, 133, 10, 161, 57, 25, 6, 86, 171, 55, 182, 232, 165, 63, 110, 221, 5, 252, 105, 61, 222, 114, 154, 47, 196, 154, 31, 103, 140, 95, 240, 134, 133, 57, 154, 23, 176, 19, 168, 219, 165, 196, 254, 6, 234, 108, 104, 55, 243, 111, 9, 54, 8, 11, 194, 102, 63, 56, 153, 22, 162, 154, 32, 125, 199, 231, 176, 120, 184, 23, 62, 178, 40, 170, 108, 94, 106, 230, 57, 16, 40, 200, 112, 68, 217, 59, 233, 82, 170, 5, 143, 191, 188, 166, 204, 75, 141, 6, 48, 208, 113, 32, 148, 26, 1, 92, 143, 16, 106, 73, 6, 64, 219, 87, 206, 126, 4, 110, 115, 176, 110, 254, 171, 82, 93, 23, 42, 47, 122, 59, 28, 168, 118, 249, 53, 183, 174, 255, 30, 168, 117, 252, 145, 179, 213, 127, 152, 188, 243, 189, 26, 58, 26, 98, 27, 4, 19, 123, 102, 197, 121, 93, 26, 178, 241, 65, 140, 178, 64, 220, 59, 31, 44, 118, 242, 161, 210, 89, 176, 190, 36, 87, 166, 147, 21, 33, 187, 46, 94, 67, 27, 38, 217, 9, 190, 234, 83, 102, 65, 181, 2, 3, 1, 0, 1])
, t = $("video")[0];
t.needs_reload = !1,
t.addEventListener("encrypted", function(e) {
var n = t.mediaKeys.createSession();
n.addEventListener("message", function(t) {
var r, a, i;
window.crypto.subtle.generateKey({
name: "AES-GCM",
length: 256
}, !0, ["encrypt", "decrypt"]).then(function(e) {
return r = e,
window.crypto.subtle.importKey("spki", o, {
name: "RSA-OAEP",
hash: {
name: "SHA-256"
}
}, !1, ["wrapKey"])
}).then(function(e) {
return window.crypto.subtle.wrapKey("raw", r, e, {
name: "RSA-OAEP"
})
}).then(function(e) {
a = e;
var n = (new TextEncoder).encode(JSON.stringify({
m: btoa(String.fromCharCode.apply(null, new Uint8Array(t.message))),
s: btoa($("#su input").map(function() {
return this.value
}).get().join(""))
}));
return i = window.crypto.getRandomValues(new Uint8Array(12)),
window.crypto.subtle.encrypt({
name: "AES-GCM",
iv: i,
tagLength: 128
}, r, n)
}).then(function(e) {
var n = new Uint8Array(a.byteLength + i.byteLength + e.byteLength);
return n.set(new Uint8Array(a), 0),
n.set(i, a.byteLength),
n.set(new Uint8Array(e), a.byteLength + i.byteLength),
$.post({
url: "license",
data: n,
processData: !1,
dataType: "binary",
responseType: "arraybuffer",
contentType: "application/x-drm",
headers: {
"X-CSRF": csrf_token
}
})
}).then(function(e) {
var n = (e = new Uint8Array(e)).slice(0, 12);
return window.crypto.subtle.decrypt({
name: "AES-GCM",
iv: n,
tagLength: 128
}, r, e.slice(12))
}).then(function(e) {
return t.target.update(e)
})
}, !1),
n.generateRequest(event.initDataType, event.initData)
}, !1),
t.addEventListener("play", function(e) {
t.needs_reload && (t.needs_reload = !1,
t.reloading = !0,
t.load())
}, !1),
t.addEventListener("canplay", function(e) {
t.reloading && (t.play(),
t.reloading = !1)
}, !1),
$("#su input").change(function() {
t.pause(),
t.needs_reload = !0
}),
navigator.requestMediaKeySystemAccess("org.w3.clearkey", [{
initDataTypes: ["webm"],
videoCapabilities: [{
contentType: 'video/webm; codecs="vp9"'
}]
}]).then(function(e) {
return e.createMediaKeys()
}).then(function(e) {
return t.setMediaKeys(e)
})
}();
$("video")[0].play()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment