Attempts to record tasks submitted to kikora and delivers the correct results to everyone else
当前为
// ==UserScript==
// @name Kikora hax
// @namespace Danielv123
// @version 1.0.1
// @description Attempts to record tasks submitted to kikora and delivers the correct results to everyone else
// @author You
// @match *.kikora.no/*
// @require http://code.jquery.com/jquery-3.1.0.js
// @grant GM_xmlhttpRequest
// ==/UserScript==
var haxServer = "http://81.167.2.56:8090";
// Datamine for the correct answer and send it to a server for future abuse
function getCorrectAnswer() {
let url = document.location.href.replace("HWA|", "").replace("|", "/").replace("|", "/").split(/[/:]+/);
let x = false;
try{
x = document.querySelector(".answer-trophy").childNodes[1].childNodes[0].dataset.title;
} catch (e){}
if(x){
//console.log("Found answer! " + x);
GM_xmlhttpRequest({
method: "POST",
url: haxServer + "/api/place",
data: JSON.stringify({name: url[7]+"|"+url[8]+"|"+url[9]+"|"+url[10], answer: x}),
headers: {
"Content-Type": "application/json"
},
onload: function(data) {
if(data /*&& typeof data == "string"*/){
console.log("Sent answer! " + x);
}
}
});
}
}
setInterval(getCorrectAnswer,1000);
function outputSolution(string){
document.querySelector("#userscript").innerHTML = string;
}
// try checking the last hint (which doesn't show up as a hint since its the answer)
url = document.location.href.replace("HWA|", "").replace("|", "/").replace("|", "/").split(/[/:]+/);
console.log(url);
console.log("Book: " + url[7] + " Theme: " + url[8] + " Chapter: " + url[9] + " Task: " + url[10]);
function wasddas(number) {
number = number - 1;
(function(number){
url = document.location.href.replace("HWA|", "").replace("|", "/").replace("|", "/").split(/[/:]+/);
$.ajax({
type: "POST",
url: "/k/json",
data: 'request={"solution":{"containerid":"'+url[9]+'","exerciseid":'+url[10]+',"timeusedforevent":'+666+',"calculationid":0,"solutionid":' + number + ',"newcalculation":false,"lcode":"nb"}}',
dataType: "json",
success: function(data) {
if(data[0].solution){
console.log(number);
console.log("Hint found!");
console.log(JSON.parse(data[0].solution.esl.replace("[[km:","").replace("]]","")).text);
outputSolution(JSON.parse(data[0].solution.esl.replace("[[km:","").replace("]]","")).text);
} else {
console.log("Not found :'(");
if (number>-10){
wasddas(number);
}
}
},
error: function() {
// alert('error handing here');
}
});
})(number);
}
$('body').append("<div id='userscript' style='position:fixed;background-color:white;z-index:100000000;bottom:0px;right:0px;height:50px;width:150px;'></div>");
// start it up
setInterval(function(){
//wasddas(30);
let url = document.location.href.replace("HWA|", "").replace("|", "/").replace("|", "/").split(/[/:]+/);
data = {
name: url[7]+"|"+url[8]+"|"+url[9]+"|"+url[10],
};
GM_xmlhttpRequest({
method: "POST",
url: haxServer + "/api/get",
data: JSON.stringify(data),
headers: {
"Content-Type": "application/json"
},
onload: function(data) {
//console.log("Got answer from server! " + JSON.stringify(data));
if(data && typeof data == "object"){
//console.log("Got answer from server! " + data.responseText);
outputSolution(data.responseText);
}
}
});
console.log("Posted " + JSON.stringify(data));
}, 5000);