Commit d069c7f4 authored by insert's avatar insert 🎺

v0.3 educake

parent 97e73171
// ==UserScript==
// @name Educake Exploit
// @name Educaked
// @namespace https://insrt.uk
// @version 0.2
// @version 0.3
// @description provides answers for questions during test
// @author insert
// @match https://www.educake.co.uk/*
......@@ -13,38 +13,123 @@
(function () {
'use strict';
let version = '0.2';
let name = 'educaked';
let version = '0.3';
let Log = message => console.log('%c[educake] ' + message, 'text-shadow: 2px 2px black');
console.log('%c > insrt.uk', 'font-size: 4em;');
console.log('%c @ educake exploit ', 'font-size: 2em; color: #8888aa');
console.log('%c @ ' + name + ' ', 'font-size: 2em; color: #8888aa');
Log("Enabling v" + version + ", created by insert <insrt.uk>.");
let ls = window.localStorage;
let exa = ls.getItem('ex_autofill');
let exs = ls.getItem('ex_styling');
let exp = ls.getItem('ex_privacy');
const config = {
autofill: exa ? exa === 'true' : false,
styling: exs ? exs === 'true' : true,
privacy: exp ? exp === 'true' : true
};
const settings = {
save: (key, value) => {
ls.setItem('ex_' + key, value ? 'true' : 'false');
config[key] = value;
}
};
document.onreadystatechange = function () {
if (document.readyState === "interactive") {
let node = document.createElement('style');
node.innerHTML = '.logedin_details { filter: blur(7px); } .logedin_details:hover { filter: blur(0px); }';
document.body.appendChild(node);
if (config.privacy) {
let node = document.createElement('style');
node.innerHTML = '.logedin_details { filter: blur(7px); } .logedin_details:hover { filter: blur(0px); }';
document.body.appendChild(node);
}
// settings menu
let settings;
{
let root = document.createElement('div');
root.style.position = 'fixed';
root.style.background = '#2a2a2a';
root.style.borderRadius = '3px';
root.style.left = 'calc(50% - 175px)';
root.style.top = 'calc(50% - 100px)';
root.style.width = '350px';
root.style.height = '200px';
root.style.padding = '12px';
function createTitle(text, size = '24px') {
let title = document.createElement('p');
title.style.font = size + '/' + size + ' Conv_VAGRoundedStd-Bold,Arial,Helvetica,sans-serif;';
title.style.fontSize = size;
title.innerText = text;
title.style.marginBottom = '12px';
return title;
}
root.append(createTitle('settings', '36px'));
function createToggle(option) {
let title = createTitle(option + ': ' + (config[option] ? 'on' : 'off'));
title.addEventListener('click', () => {
settings.save(option, !config[option]);
title.innerText = option + ': ' + (config[option] ? 'on' : 'off');
});
return title;
}
root.append(createToggle('autofill'));
root.append(createToggle('styling'));
root.append(createToggle('privacy'));
let close = createTitle('close', '12px');
close.addEventListener('click', () => {
root.parentNode.removeChild(root);
});
root.append(close);
settings = root;
}
// styling
let border = $('.border');
border.css('borderTop', '3px solid #315181');
border.css('borderBottom', '3px solid #315181');
if (config.styling) {
let border = $('.border');
border.css('borderTop', '3px solid #315181');
border.css('borderBottom', '3px solid #315181');
$('.text_box, .multiplelabel, .contrastbutton, .logedin_details, .showMainButton, a.bluebutton.buttontemplate.marginfifteenright.right')
.attr('style', 'background: #2a2a2a !important');
$('.text_box, .multiplelabel, .contrastbutton, .logedin_details, .showMainButton, a.bluebutton.buttontemplate.marginfifteenright.right')
.attr('style', 'background: #2a2a2a !important');
$('#back_image').css('display', 'none');
$('body').css('background', '#0a0a0a');
$('#header, #footer, #educake_text, #analyse_section, #teacher_view_results').attr('style', 'background: #1a1a1a !important');
$('#back_image').css('display', 'none');
$('body').css('background', '#0a0a0a');
$('#header, #footer, #educake_text, #analyse_section, #teacher_view_results').attr('style', 'background: #1a1a1a !important');
}
// the actual exploit
if (document.URL == 'https://www.educake.co.uk/online-test') {
let txtBox = $('#template_container_onlinetest_question_widget > div > .text_box');
let elt = document.createElement('p');
elt.innerHTML = 'autofill: ' + (config.autofill ? 'on' : 'off');
elt.addEventListener('click', () => {
settings.save('autofill', !config.autofill);
elt.innerHTML = 'autofill: ' + (config.autofill ? 'on' : 'off');
});
txtBox.append(elt);
let els = document.createElement('p');
els.innerHTML = 'settings';
els.addEventListener('click', () => {
document.body.append(settings);
});
txtBox.append(els);
let eln = document.createElement('p');
eln.innerHTML = 'educake exploit v' + version;
$('#template_container_onlinetest_question_widget > div > .text_box').append(eln);
eln.innerHTML = name + ' v' + version;
txtBox.append(eln);
$.post('/online-test', {
flag: 1
......@@ -52,30 +137,47 @@
Log("Pulled answer.");
let data = JSON.parse(res);
let ans = /(The right answer is [\s\S]+)<\/p>/g.exec(data.html);
let el = document.createElement('div');
el.classList.add('head');
el.classList.add('fadein');
el.style.marginTop = '0';
el.style.fontWeight = '800';
el.innerHTML = ans[1].replace(/\n/g, '');
let widget = $('#template_container_onlinetest_question_widget > div');
Log("Injecting element into body.");
$('.head.fadein').after(el);
let parsed;
if (ans[0].includes('"')) {
parsed = /"([\s\S]+?)"/g.exec(ans[0]);
} else {
parsed = /The right answer is ([\s\S]+)<\/p>/g.exec(ans[0]);
}
let fin = parsed[1].trim();
if (parsed != null) {
Log('Found suitable answer, autofilling..');
let ansBtn = document.createElement('a');
ansBtn.classList.add('btn');
ansBtn.style.display = 'block';
ansBtn.style.marginRight = '12px';
ansBtn.innerText = 'Get Answer';
$('#submitAnswer').after(ansBtn);
let show = () => {
ansBtn.parentNode.removeChild(ansBtn);
$('.multiplelabel').each((i, v) => {if (v.innerText == fin) v.click()});
$('#answerspace').val(fin);
$('#answerspace').focus();
}
let el = document.createElement('div');
el.classList.add('head');
el.classList.add('fadein');
el.style.marginTop = '0';
el.style.fontWeight = '800';
el.innerHTML = ans[1].replace(/\n/g, '');
let widget = $('#template_container_onlinetest_question_widget > div');
Log("Injecting element into body.");
widget.children()[2].after(el);
let parsed;
if (ans[0].includes('"')) {
parsed = /"([\s\S]+?)"/g.exec(ans[0]);
} else {
parsed = /The right answer is ([\s\S]+)<\/p>/g.exec(ans[0]);
}
let fin = parsed[1].trim();
if (parsed != null) {
Log('Found suitable answer, autofilling..');
$('.multiplelabel').each((i, v) => {if (v.innerText == fin) v.click()});
$('#answerspace').val(fin);
$('#answerspace').focus();
}
};
ansBtn.addEventListener('click', show);
if (config.autofill) show();
});
} else {
Log('Not a Q/A page.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment