Skip to content

Instantly share code, notes, and snippets.

@chocolatkey
Last active December 14, 2020 20:56
Show Gist options
  • Save chocolatkey/0c98caaee25e425e066d361d0493e534 to your computer and use it in GitHub Desktop.
Save chocolatkey/0c98caaee25e425e066d361d0493e534 to your computer and use it in GitHub Desktop.
Press Shift+D and start reking
// ==UserScript==
// @name RekMathletics.exe
// @version 1.0
// @downloadURL https://gist.githubusercontent.com/chocolatkey/0c98caaee25e425e066d361d0493e534/raw
// @supportURL https://gist.github.com/chocolatkey/0c98caaee25e425e066d361d0493e534
// @description Get reked
// @author chocolatkey
// @homepage https:/github.com/chocolatkey
// @include http://*live.mathletics.com*
// @run-at document-start
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
// @require https://github.com/blueimp/JavaScript-MD5/raw/master/js/md5.min.js
// @require https://gist.github.com/jkjustjoshing/32a3a9cb10449ea009d1/raw/19db2d04f34ba022a2a8fb0887b9b15553e91927/$inject.user.js
// ==/UserScript==
var score = 1;
var level = 1;
(function (unsafeWindow) {
var already = false;
$( document ).ready(function() {
console.log( "Wrecker available" );
$(document).on("keydown", function(e) {
if((e.shiftKey && e.keyCode == 68) && !already)
{
console.log( "Wrecker shown" );
already = true;
$( "body" ).append( "\
<div style='position: fixed; top: 5px; right: 5px; width: 175px; height: auto; background: #e2e2e2; padding: 5px; z-index: 999;'>\
<center><b><h5 id='ebjrp-title'>== RekMathletics&trade; ==</h5></b></center>\
Score:<input type='number' id='eb1' style='width: 40px;' name='quantity' min='1' max='1000000000000' value='1'>\
Lvl.:<input type='number' id='eb2' style='width: 35px;' name='quantity' min='1' max='10' value='1'>\
<button id='ebjrp-start' style='width: 100%;'>Show off math skills</button><br>\
</div>\
" );
$( "#eb1" ).change(function() {
score = $(this).val();
});
$( "#eb2" ).change(function() {
level = $(this).val();
});
$( "#ebjrp-start" ).click(function() {
console.log("Generating match");
// Copied directly from source
var e = {
IsComputerPlayerOnly: true,
CultureCode: null
};
e.UserAuthToken = $inject("evtSrvConfig").getConfigValue("UserToken"); // AngularJS hates me too
e.GameLevel = level;
e.Speed = 0;
var rq = { // Muh stupid post format
request: e
};
$.ajax({
url: "http://mzaue2.live.mathletics.com/LiveMathleticsMatchEngineService-R166/MatchService.asmx/FindMatch", // TODO: no hardcoding
type: "POST",
data: JSON.stringify(rq),
contentType:"application/json;charset=UTF-8",
dataType:"json",
success: function(data){
console.log( "Success! Submitting score of " + score + ", level " + level);
var f = {};
f.UserAuthToken = $inject("evtSrvConfig").getConfigValue("UserToken"); // AngularJS hates me too
f.LevelID = parseInt(level);
f.TotalTime = 60;
f.Attempts = parseInt(score); // same as score in our case
f.IsComputerPlayerOnly = true;
f.OperationEnum = 0;
f.MatchId = data.d.MatchID;
f.UserScore = {
Score: parseInt(score),
Status: 0
};
f.SessionID = null;
f.bonusLevelIncremented = false;
f.EventID = undefined;
f.Hash = md5(f.MatchId + "-" + f.UserScore.Score + "-" + f.UserScore.Status + "-" + elel(data.d.Seed)); // Muh security
var rq = { // Muh stupid post format
request: f
};
$.ajax({
url: "http://mzaue2.liveresults.mathletics.com/LiveMathleticsResultService-R166//FinaliseService.asmx/FinaliseResult",
type: "POST",
data: JSON.stringify(rq),
contentType:"application/json;charset=UTF-8",
dataType:"json",
success: function(data){
console.log("The deed's done");
$("#ebjrp-title").html("<i>+" + data.d.PointsEarned + " Point(s) ;)</i>"); // Beautiful
}
});
}
});
});
}
});
function elel(b) { // This random thing messes with the seed value
var a = b || "333";
a = a.substr(a.length - 3);
if (a === "000") {
a = "333";
}
return b % a;
}
});
})();
@chocolatkey
Copy link
Author

@Depressed12345 they probably fixed it by now or changed their system. I did this in March, it's December now and I don't have a Mathletics account anymore

@mhm611
Copy link

mhm611 commented Dec 14, 2020

i like rice -.-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment