// ==UserScript==
// @name Xero-Bots | .io Bots 2022
// @namespace https://discord.com/invite/bAstbAfem9
// @version 30.0.1
// @description The best bots for popular agar.io clone games.
// @author Tatsuya & Enes
// @match *.oceanar.io/*
// @match *.aquar.io/*
// @match *.agar.live/*
// @run-at document-start
// @icon https://www.google.com/s2/favicons?sz=64&domain=cellcraft.io
// @grant none
// ==/UserScript==
function _classCallCheck(instance, Constructor) {
if(!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var _createClass = function() {
function defineProperties(target, props) {
for(var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function(Constructor, protoProps, staticProps) {
if(protoProps) defineProperties(Constructor.prototype, protoProps);
if(staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
function _defineProperty(obj, key, value) {
if(key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
var Client = new(function() {
function _class41() {
_classCallCheck(this, _class41);
}
_createClass(_class41, [{
key: 'init',
value: function init() {
this.bots = [];
this.BotAmount = this.hookAmt;
this.serverIP = '';
this.positioning = {
'x': 0,
'y': 0
};
this.movebuf = null;
this.started = false;
this.gui = GUI.init(this.startBots.bind(this), this.stopBots.bind(this), this.split.bind(this), this.eject.bind(this));
this.setup();
}
}, {
key: 'hookAmt',
get: function hookAmt() {
let url = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
if(url == "agma.io" || url == "cellcraft.io" || url == "oceanar.io" || url == "aquar.io" || url == 'agar.live') {
return 50;
} else {
return 15;
}
}
}, {
key: 'spawned',
get: function spawned() {
return this.bots.filter(b => b.ws && b.ws.readyState === WebSocket.OPEN).length;
}
}, {
key: 'setup',
value: function setup() {
for(let i = 0; i < this.BotAmount; i++) {
this.bots.push(new Bot())
};
this.UpdateCount();
}
}, {
key: 'UpdateCount',
value: function UpdateCount() {
this.updateCounter = setInterval(() => {
GUI.updateCount(this.spawned, this.BotAmount)
}, 1000)
}
}, {
key: 'split',
value: function split() {
this.bots.forEach((bot, i) => {
bot.split()
})
}
}, {
key: 'eject',
value: function eject() {
this.bots.forEach((bot, i) => {
bot.eject()
})
}
}, {
key: 'startBots',
value: function startBots() {
if(this.started || !this.serverIP) return;
if(this.serverIP == undefined) return;
this.bots.forEach((bot, i) => {
bot.connect(this.serverIP)
});
this.started = true
}
}, {
key: 'stopBots',
value: function stopBots() {
if(!this.started) return;
this.bots.forEach((bot, i) => {
bot.disconnect()
});
this.started = false
}
}]);
return _class41;
}())();
var GUI = new(function() {
function _class3() {
_classCallCheck(this, _class3);
}
_createClass(_class3, [{
key: 'init',
value: function init(start, stop, split, eject) {
this.IDs = {
'startButton': 'startB',
'stopButton': 'stopB',
'botCount': 'casteramount',
'DiscordURL': 'title'
};
this.injected = false;
this.startBots = start;
this.stopBots = stop;
this.splitBots = split;
this.ejectBots = eject;
this.inject();
this.setupKeys();
}
}, {
key: 'inject',
value: async function inject() {
this.uiCode = await this.getGUI();
if(!this.uiCode) {
return alert('Failed to load bot GUI. If this keeps happening, contact a developer.');
}
this.append(this.uiCode);
}
}, {
key: 'getGUI',
value: async function getGUI() {
const UI = await fetch('https://uttermost-inky-aardvark.glitch.me/');
if(!UI.ok) {
return console.log('[GUI STATUS]', UI);
}
return await UI.text();
}
}, {
key: 'append',
value: function append(html) {
const BOTUI = document.createElement('div');
BOTUI.innerHTML = html;
document.body.appendChild(BOTUI);
this.injected = true;
this.divScramble('startB', 'startButton');
this.divScramble('stopB', 'stopButton');
this.divScramble('casteramount', 'botCount');
this.divScramble('title', 'DiscordURL');
document.getElementById(this.IDs.startButton).onclick = () => {
this.startBots();
document.getElementById(this.IDs.stopButton).style.display = 'block';
document.getElementById(this.IDs.startButton).style.display = 'none';
};
document.getElementById(this.IDs.stopButton).onclick = () => {
this.stopBots();
document.getElementById(this.IDs.stopButton).style.display = 'none';
document.getElementById(this.IDs.startButton).style.display = 'block';
};
document.getElementById(this.IDs.DiscordURL).onclick = () => {
window.location.href = 'https://discord.gg/bAstbAfem9'
};
document.querySelector("#okbtn").onclick = () => {
document.querySelector("#popup").style.display = "none";
document.querySelector("#blackout").style.display = "none";
};
this.showPopUp(
"Webpack Module Successfully initiated. Bypass injected. 𝙉𝙞𝙘𝙚 𝙥𝙖𝙩𝙘𝙝 𝘼𝙜𝙖𝙧.𝙡𝙞𝙫𝙚 𝙙𝙚𝙫𝙨, 𝙩𝙧𝙮 𝙩𝙤 𝙗𝙡𝙤𝙘𝙠 𝙢𝙮 𝙂𝙐𝙄 𝙖𝙜𝙖𝙞𝙣 :)"
);
}
}, {
key: 'setupKeys',
value: function setupKeys() {
window.addEventListener('keypress', (event) => {
switch(event.key) {
case 'q':
this.splitBots();
break;
case 'w':
this.ejectBots();
break;
}
});
}
}, {
key: 'divScramble',
value: function GenerateScrambledID(div, callback) {
const scrambledID = (((1 + Math.random()) * 0x10000) | 0);
document.getElementById(div).id = scrambledID;
this.IDs[callback] = scrambledID;
}
}, {
key: 'updateCount',
value: function updateCount(spawned, max) {
document.getElementById(this.IDs.botCount).innerText = spawned + " / " + max
}
}, {
key: 'showPopUp',
value: function showPopUp(msg) {
document.getElementById("msgpop").innerHTML = msg;
document.querySelector("#popup").style.display = "block";
document.querySelector("#blackout").style.display = "block";
}
}]);
return _class3;
}())();
class Bot {
constructor() {
this.origin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
this.Hooks = {
botNames: ["discord.gg/bAstbAfem9", "rb.gy/kafgsw", "Xero-Bots", "Nice try devs!"],
getBotName() {
return this.botNames[Math.floor(Math.random() * this.botNames.length)]
}
}
}
connect(url) {
this.serverUrl = url;
this.ws = new WebSocket(url);
this.ws.binaryType = "arraybuffer";
this.ws.onmessage = this.onMessage.bind(this);
this.ws.onopen = this.onOpen.bind(this);
this.ws.onclose = this.onClose.bind(this);
this.ws.onerror = this.onError.bind(this);
this.randomMovement = false;
this.id = Math.floor(Math.pow(2, 14) * Math.random()).toString(36);
this.name = this.Hooks.getBotName() + ' | ' + this.id;
}
disconnect() {
if(this.ws) {
this.ws.close();
delete this.ws;
}
clearInterval(this.moveInterval);
clearInterval(this.pingInterval);
clearTimeout(this.spawnTimeout);
}
onMessage(message) {
if (this.dependency == 3) {
var view = new DataView(message.data);
var offset = 0;
switch(240 == view.getUint8(offset) && (offset = offset + 5), view.getUint8(offset++)) {
case 64:
offset += 34;
var next = view.getUint32(offset, true);
offset += 4;
var code = view.getUint32(offset, true);
if(next === code) {
if(70 > 60) {
this.buildKey.xor = next;
this.Auth(33000);
}
} else {
this.ws.close();
console.log("Err in 64!");
}
break;
case 244:
this.readyToSpawn = true;
this.send(new Uint8Array([0x04, 0x07, 0x01]))
this.send(new Uint8Array([0x04, 0x08, 0x00]))
this.send(new Uint8Array([0x04, 0x03, 0x01]))
break;
}
}
}
Auth(secretKey) {
var xorKey = this.Buffer(13);
xorKey.setUint8(0, 2 * (100 + 30) - (this.buildKey.xor - 5) % 10 - 5);
xorKey.setUint32(1, ~~(this.buildKey.xor / 1.84 + 100 / 2 - 2 * (0 ? 0.5 : 1)) + ~~(~~(21.2 * (~~(this.buildKey.xor + 4.42 * this.buildKey.zn + 555) % --secretKey + 36360)) / 4.2), true)
xorKey.setUint32(5, this.offsetKey() + 103, true);
xorKey.setUint32(9, this.buildKey.vd(xorKey, 0, 9, 255), true);
this.send(xorKey, true);
}
offsetKey() {
for (var d = 0, b = 0; b < this.On.length; b++) {
d += ~~(this.buildKey.xor / this.On[b] - this.On[b] % 103);
}
return d;
}
get On() {
var wrapper = "~9B\\x$";
return [
wrapper.charCodeAt(0),
wrapper.charCodeAt(1),
wrapper.charCodeAt(2) + 73,
wrapper.charCodeAt(3),
wrapper.charCodeAt(4) + 227,
wrapper.charCodeAt(5)
];
}
onOpen() {
if(this.dependency == 1) {
this.spawn();
this.ping();
} else if (this.dependency == 2) {
let Init = this.Buffer(5);
Init.setUint8(0, 254);
Init.setUint32(1, 5, true);
this.send(Init, true);
Init = this.Buffer(5);
Init.setUint8(0, 255);
Init.setUint32(1, 123456789, true);
this.send(Init, true);
this.spawn();
this.pingInterval = setInterval(this.sendlatency.bind(this), 1e3);
} else if (this.dependency == 3) {
this.buildKey = {
zn: 8730,
xor: -1,
vd(d, b, x, _) {
b + x > d.byteLength && (x = 0);
for (var e = 12345678 + _, t = 0; x > t; t++) {
e += d.getUint8(b + t) * (t + 1);
}
return e;
}
};
const Init = this.Buffer(13);
Init.setUint8(0, 245);
Init.setUint16(1, 22, true);
Init.setUint16(3, 118, true);
Init.setUint32(5, this.buildKey.zn, true);
Init.setUint32(9, this.buildKey.vd(Init, 0, 9, 245), true);
this.send(Init, true);
this.pingInterval = setInterval(() => { if(this.readyToSpawn) this.send([0x5f])}, 18e3);
} else if (this.dependency == 0) {
}
this.spawnTimeout = setInterval(this.spawn.bind(this), 3000);
this.moveInterval = setInterval(this.move.bind(this), 150);
}
onClose() {
clearInterval(this.moveInterval);
clearInterval(this.pingInterval);
clearTimeout(this.spawnTimeout);
}
onError() {}
spawn() {
if(this.dependency == 1) {
let spawnBuf = this.Buffer(52);
spawnBuf.setUint8(0, 22);
var o = 0;
for(; o < 25; ++o) {
spawnBuf.setUint16(1 + 2 * o, o < this.name.length ? this.name.charCodeAt(o) : 0, true);
}
spawnBuf.setUint8(51, 255)
this.send(spawnBuf);
} else if (this.dependency == 2) {
var rassan = this.Buffer(1 + 2 * this.name.length);
rassan.setUint8(0, 129);
for (var i = 0; i < this.name.length; ++i) {
rassan.setUint16(1 + 2 * i, this.name.charCodeAt(i), true);
}
this.send(rassan, true);
} else if (this.dependency == 3) {
if(!this.readyToSpawn) return;
var es = [1], _s = 0;
var spawnBuf = this.Buffer(4 + 2 * es.length + 2 * this.name.length);
spawnBuf.setUint8(0, 1);
for(var b = 4, x = 0; x < es.length; x++) spawnBuf.setUint16(b, 0, true);
for(x = 0; x < this.name.length; ++x) spawnBuf.setUint16(b + 2 * x, this.name.charCodeAt(x), true);
this.sendUint8(34);
this.send(spawnBuf, true);
this.sendUint8(34);;
} else if (this.dependency == 0) {
}
}
sendUint8(offset) {
var singleByte = this.Buffer(1);
singleByte.setUint8(0, offset);
this.send(singleByte);
}
sendlatency() {
const latency = this.Buffer(5);
latency.setUint8(0, 90);
latency.setUint32(1, 123456789, true);
this.send(latency, true);
}
ping() {
let ParseTime = 268435455 & Date.now();
let oneByte = this.Buffer(0x5);
oneByte.setUint8(0x0, 0x1);
oneByte.setUint32(0x1, ParseTime);
this.send(oneByte);
}
split() {
this.send(new Uint8Array([0x11]))
}
eject() {
this.send(new Uint8Array([0x24]))
}
chat(message) {
if (this.dependency == 2) {
var haowen = this.Buffer(4 + 2 * message.length);
var kydan = 0;
haowen.setUint8(kydan++, 199);
haowen.setUint8(kydan++, 0);
for (var hiya = 0; hiya < message.length; ++hiya) {
haowen.setUint16(kydan, message.charCodeAt(hiya), true);
kydan += 2;
}
haowen.setUint16(kydan, 57344, true);
this.send(haowen)
} else if (this.dependency == 3) {
var b = this.Buffer(2 + 2 * message.length);
var x = 0;
b.setUint8(x++, 98);
b.setUint8(x++, 1);
for(var _ = 0; _ < message.length; ++_) {
b.setUint16(x, message.charCodeAt(_), true)
}
x += 2;
this.send(b, true);
} else if (this.dependency == 0) {
}
}
move() {
if(this.dependency == 1 || this.dependency == 3) {
this.send(Client.movebuf)
} else if (this.dependency == 2) {
const mouseBuf = this.Buffer(21);
mouseBuf.setUint8(0, 185);
mouseBuf.setFloat64(1, Client.positioning.x, true);
mouseBuf.setFloat64(9, Client.positioning.y, true);
mouseBuf.setUint32(17, 0, true);
this.send(mouseBuf, true);
} else if (this.dependency == 0) {
}
}
Buffer(buf) {
return new DataView(new ArrayBuffer(!buf ? 1 : buf))
}
get active() {
return this.ws && this.ws.readyState === WebSocket.OPEN;
}
get dependency() {
switch(true) {
case /oceanar.io/.test(this.origin):
case /aquar.io/.test(this.origin):
return 1;
case /agar.live/.test(this.origin):
return 2;
case /cellcraft.io/.test(this.origin):
return 3;
}
return 0;
}
send(data, encrypt) {
if(this.active) {
if(encrypt) {
this.ws.send(data.buffer);
} else this.ws.send(data);
}
}
}
if (location.host.includes('agma.io') || location.host.includes('cellcraft.io')) {
window.WebSocket = class extends WebSocket {
constructor() {
let ws = super(...arguments);
window.sockets?.push(this);
setTimeout(() => {
ws.onmessage = new Proxy(ws.onmessage, {
apply(target, thisArg, argArray) {
let data = argArray[0].data;
return target.apply(thisArg, argArray);
}
});
});
}
}
WebSocket.prototype.send = new Proxy(WebSocket.prototype.send, {
apply(target, thisArg, argArray) {
var res = target.apply(thisArg, argArray);
let pkt = argArray[0];
if (typeof pkt == 'string') return res;
if (pkt instanceof ArrayBuffer) pkt = new DataView(pkt);
else if (pkt instanceof DataView) pkt = pkt;
else pkt = new DataView(pkt.buffer);
switch (pkt.getUint8(0, true)) {
case 0:
switch (pkt.byteLength) {
case 9:
Client.movebuf = pkt;
break;
}
break;
}
if (Client.serverIP !== thisArg.url) {
Client.serverIP = thisArg.url;
}
return res;
}
});
window.addEventListener('load', () => {
Client.init();
});
} else {
window.addEventListener('load', () => {
Client.init();
WebSocket.prototype.send = new Proxy(WebSocket.prototype.send, {
apply(target, thisArg, argArray) {
var res = target.apply(thisArg, argArray);
let pkt = argArray[0];
if(!Client) return;
if(typeof pkt == 'string') return res;
if(thisArg.url.includes('localhost')) return res;
if(pkt instanceof ArrayBuffer) pkt = new DataView(pkt);
else if(pkt instanceof DataView) pkt = pkt;
else pkt = new DataView(pkt.buffer);
switch(pkt.getUint8(0, true)) {
case 16:
case 185:
Client.positioning.x = pkt.getFloat64(1, true);
Client.positioning.y = pkt.getFloat64(9, true);
break;
case 5:
case 14:
case 239:
Client.movebuf = pkt.buffer;
break;
}
if(Client.serverIP !== thisArg.url) {
Client.serverIP = thisArg.url;
}
return res;
}
});
})
}