1. A superficial analysis of the messaging protocol between the server and the client showed that the substitution of messages will not work - the server has internal verification mechanisms.
{
userid: "userid",
events: [ ]
}
function Miner(incr, dripK, delay) { var that = this; this.incr = incr || localStats.bps*1e3; // this.dripK = dripK || 0.5; // this.delay = delay || 100; // document.hasFocus = function () {return true;}; NO_PINGY=1; // , // Redefine postEvent RestEventManager.prototype.postEventData = function(e,t,next) // next, { var r=XORCipher.encode(DataSaver.key,JSON.stringify(e)); // , ! // : return $.ajax({type:"POST",async:!0,url:GAME_URL+(loggedIn?"events":"eventsanon"),data:r,contentType:"text/plain", success: function() { var self = this; that.lastCorrect = localStats.byteCount; // t.apply(self, arguments); // callback setTimeout(function(){ if(localStats.byteCount > localStats.memoryCapacity * that.dripK) $('#btn-addGlobalMem').trigger('click'); // }, 0); if(typeof next == 'function')next(); }, error: function(e) { localStats.byteCount = that.lastCorrect; // console.error(e.responseText); // show error text if(typeof next == 'function') next(); // , }}) } }
Miner.prototype.postEvent = function(mem, time, next) { var d = { userid: networkUser.userId, events: [{ generatedMem: mem, power: null, timeElapsed: time, type: 1 }] } RestEventManager.prototype.postEventData(d, function(){}, next); };
Miner.prototype.start = function() { var that = this; this.stopped = false; this.lastCorrect = localStats.byteCount; // save before the action function post(){ localStats.byteCount+=that.incr; // mine some bytes that.postEvent(localStats.byteCount, 120000, function(){ // tell to server that 2minutes passed if(!that.stopped) that.sI = setTimeout(post, that.delay); // next iteration on response }) } if(this.sI) clearTimeout(this.sI); if(!this.stopped) this.sI = setTimeout(post, this.delay); // first call }; Miner.prototype.stop = function() { this.stopped = true; };
var miner = new Miner(); miner.start();
Source: https://habr.com/ru/post/219889/
All Articles