Greasy Fork

Xero-Bots | .io Bots 2022

The best bots for popular agar.io clone games.

目前为 2022-04-17 提交的版本。查看 最新版本

// ==UserScript==
// @name         Xero-Bots | .io Bots 2022
// @namespace    https://discord.com/invite/bAstbAfem9
// @version      30.0.6
// @description  The best bots for popular agar.io clone games.
// @author       Tatsuya & Enes
// @match        *.oceanar.io/*
// @match        *.aquar.io/*
// @match        *.agma.io/*
// @match        *.cellcraft.io/*
// @match        *.cellsbox.io/*
// @match        *.www.inciagario.net/*
// @match        *.agariott.com/*
// @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;
    };
}();

var _00601 = new(function() {
    function _00401() {
        _classCallCheck(this, _00401);
    }
    _createClass(_00401, [{
        key: '_00801',
        value: function _00801() {
            this._00201 = [];
            this._00202 = this._00802;
            this._00203 = '';
            this._00204 = {
                'x': 0,
                'y': 0
            };
            this._00205 = null;
            this._00206 = false;
            this._00207 = _00602._00810();
            this._00804();
        }
    }, {
        key: '_00802',
        get: function _00802() {
            let _00300 = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
            if (_00300 == "agma.io" || _00300 == "cellcraft.io" || _00300 == "oceanar.io" || _00300 == "aquar.io") {
                return 50;
            } else if (_00300 == "cellsbox.io" || _00300 == "agariott.com" || _00300 == "www.inciagario") {
                return 50;
            } else {
                return 15;
            }
        }
    }, {
        key: '_00803',
        get: function _00803() {
            return this._00201.filter(bot => bot._00218 && bot._00218.readyState === WebSocket.OPEN).length;
        }
    }, {
        key: '_00804',
        value: function _00804() {
            for (let _00301 = 0; _00301 < this._00202; _00301++) {
                this._00201.push(new _00603())
            };
            this._00805();
        }
    }, {
        key: '_00805',
        value: function _00805() {
            this._00302 = setInterval(() => {
                if (!_00602._00209) return;
                _00602._00816(this._00803, this._00202)
            }, 1000)
        }
    }, {
        key: '_00806',
        value: function _00806() {
            this._00201.forEach((bot) => {
                bot._00828()
            })
        }
    }, {
        key: '_00807',
        value: function _00807() {
            this._00201.forEach((bot) => {
                bot._00829()
            })
        }
    }, {
        key: '_00808',
        value: function _00808() {
            if (this._00206 || !this._00203) return;
            if (this._00203 == undefined) return;
            this._00201.forEach((bot) => {
                bot._00818(this._00203)
            });
            this._00206 = true
        }
    }, {
        key: '_00809',
        value: function _00809() {
            if (!this._00206) return;
            this._00201.forEach((bot) => {
                bot._00819()
            });
            this._00206 = false
        }
    }]);
    return _00401;
}())();

var _00602 = new(function() {
    function _00402() {
        _classCallCheck(this, _00402);
    }
    _createClass(_00402, [{
        key: '_00810',
        value: function _00810() {
            this._00209 = false;
            this._00811();
            this._00814();
        }
    }, {
        key: '_00811',
        value: async function _00811() {
            this._00214 = await this._00812();
            if (!this._00214) {
                return alert('Failed to load bot GUI. If this keeps happening, contact a developer.');
            }
            this._00813(this._00214);
        }
    }, {
        key: '_00812',
        value: async function _00812() {
            const _00303 = await fetch('https://uttermost-inky-aardvark.glitch.me/');
            if (!_00303.ok) {
                return console.log('[GUI STATUS]', _00303);
            }
            return await _00303.text();
        }
    }, {
        key: '_00813',
        value: function _00813(html) {
            const _00304 = document.createElement('div');
            _00304.innerHTML = html;
            document.body.appendChild(_00304);
            this._00209 = true;

            this._00208 = {
                'startButton': this._00815('startB'),
                'stopButton': this._00815('stopB'),
                'botCount': this._00815('casteramount'),
                'DiscordURL': this._00815('title')
            };

            this.bindoff(this._00208.startButton, [this._00208.stopButton, 'block', this._00208.startButton, 'none'], 1);
            this.bindoff(this._00208.stopButton, [this._00208.stopButton, 'none', this._00208.startButton, 'block'], 2);
            this.bindoff(this._00208.DiscordURL, [], 3);
            this.bindoff("okbtn", ['popup', 'none', 'blackout', 'none']);

            this._00817(
                "Webpack Module Successfully initiated, bypass injected."
            );
        }
    }, {
        key: 'bindoff',
        value: function bindDiv(div, options, binder) {
            document.getElementById(div).onclick = () => {
                if (binder) { switch(binder) {
                    case 1: _00601._00808(); break;
                    case 2: _00601._00809(); break;
                    case 3: window.location.href = 'https://discord.gg/bAstbAfem9'; break;
                }}
                if (options || options.length > 0) this.getQueryMethod(options[0], options[1], options[2], options[3]);
            };
        }
    }, {
        key: '_00814',
        value: function _00814() {
            window.addEventListener('keypress', (event) => {
                switch (event.key) {
                    case 'q':
                        _00601._00806();
                        break;
                    case 'w':
                        _00601._00807();
                        break;
                }
            });
        }
    }, {
        key: '_00815',
        value: function scrambleDiv(div) {
            const _00305 = (((1 + Math.random()) * 0x10000) | 0);
            document.getElementById(div).id = _00305;
            return _00305;
        }
    }, {
        key: 'getQueryMethod',
        value: function _00500(div1, style1, div2, style2) {
            document.getElementById(div1).style.display = style1;
            document.getElementById(div2).style.display = style2;
        }
    }, {
        key: '_00816',
        value: function _00816(spawned, max) {
            document.getElementById(this._00208.botCount).innerText = spawned + " / " + max
        }
    }, {
        key: '_00817',
        value: function _00817(msg) {
            document.getElementById("msgpop").innerHTML = msg;
            document.querySelector("#popup").style.display = "block";
            document.querySelector("#blackout").style.display = "block";
        }
    }]);
    return _00402;
}())();

class _00483 {
    constructor() {
        this.bytes = [];
    }
    _00361(val) {
        this.bytes.push(val);
    }
    _00395(val) {
        this.bytes.push(val & 0xFF);
        this.bytes.push(val >> 0x8 & 0xFF);
    }
    _00795(str) {
        this._00395(str.length);
        for (var i = 0; i < str.length; i++) {
            this._00395(str.charCodeAt(i));
        }
    }
    _00712() {
        return new Uint8Array(this.bytes).buffer;
    }
}

var _00603 = function() {
    function _00403() {
        _classCallCheck(this, _00403);
        this.init();
    }
    _createClass(_00403, [{
        key: 'init',
        value: function init() {
            this._00215 = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
            this._00216 = {
                _00306: ["Xero-Bots", "Made by Tatsuya", "Bots by Tatsuya", "discord.gg/bAstbAfem9", "rb.gy/kafgsw", "Too easy!"],
                _00307() {
                    return this._00306[Math.floor(Math.random() * this._00306.length)]
                },
                grabRecaptchaToken(wss, siteKey, callback) {
                    return new Promise(async (resolve, reject) => {
                        const hookGrecaptcha = window.grecaptcha;
                        if (!hookGrecaptcha) return alert("No recaptcha anchor found!");
                        hookGrecaptcha.execute(siteKey, callback).then((token) => {
                            const parsedUrl = wss.split('challenge')[0] + 'challenge=' + token;
                            resolve(parsedUrl);
                        });
                    });
                }
            }
        }
    }, {
        key: '_00818',
        value: async function _00818(url) {
            if (this._00834 == 3) {
                url = await this._00216.grabRecaptchaToken(
                    url, '6LcnrKQUAAAAADohV5Cksikz89WSP-ZPHNA7ViZm', {
                        action: 'playbutton'
                    })
            }
            this._00217 = url;

            this._00218 = new WebSocket(url);

            this._00218.binaryType = "arraybuffer";

            this._00218.onmessage = this._00820.bind(this);
            this._00218.onopen = this._00821.bind(this);
            this._00218.onclose = this._00822.bind(this);
            this._00218.onerror = this._00823.bind(this);

            this._00219 = false;

            this._00220 = Math.floor(Math.pow(2, 14) * Math.random()).toString(36);
            this._00221 = this._00216._00307() + ' | ' + this._00220;
        }
    }, {
        key: '_00819',
        value: function _00819() {
            if (this._00218) {
                this._00218.close();
                delete this._00218;
            }
            clearInterval(this._00902);

            clearInterval(this._00900);

            clearTimeout(this._00901);
        }
    }, {
        key: '_00820',
        value: function _00820(message) {}
    }, {
        key: '_00821',
        value: function _00821() {
            if (this._00834 == 1) {
                this._00824();
                this._00827();
            } else if (this._00834 == 2) {
                const RawMetatables = {
                        op: 'clientVersion',
                        protocolKind: 'TsOgarRx',
                        protocolSig: 'P2NWmM',
                        protocolRev: 'orx108'
                    },
                    encoded = encodeURIComponent(JSON.stringify(RawMetatables)),
                    clientSideID = this.GenEnvSig(10);

                const xorData = {
                    ClientInfo: this.generateShiftedXor( /* 2018: 86360974*/ 139768873, 1),
                    SendRevs: this.generateShiftedXor( /* 2018: .75*/ .5, 2),
                    ClientData: this.generateShiftedXor( /* 2018: 28859802*/ 1000, 3),
                };

                const ClientInfo = new _00483();
                ClientInfo._00361(xorData.ClientInfo);
                ClientInfo._00795(encoded);
                this._00835(ClientInfo._00712());

                const SendRevs = new _00483();
                SendRevs._00361(xorData.SendRevs);
                SendRevs._00795(RawMetatables.protocolKind);
                SendRevs._00795(RawMetatables.protocolSig);
                SendRevs._00795(RawMetatables.protocolRev);
                SendRevs._00795(clientSideID);
                this._00835(SendRevs._00712());

                const ClientData = new _00483();
                ClientData._00361(xorData.ClientData);
                ClientData._00795(this._00221);
                this._00835(ClientData._00712());

                this._00824();
                setInterval(this._00830("discord.gg/bAstbAfem9"), 10000);
            } else if (this._00834 == 3) {
                // From their core, too easy! They use an eval obfuscator too! Lmao
                let Init = this._00832(5);
                Init.setUint8(0, 87);
                Init.setUint32(1, 1, true);
                this._00835(Init);

                Init = this._00832(5);

                Init.setUint8(0, 100);
                Init.setUint32(1, 1332175218, true);
                this._00835(Init);
            }
            this._00901 = setInterval(this._00824.bind(this), 3000);
            this._00902 = setInterval(this._00831.bind(this), 150);
        }
    }, {
        key: 'generateShiftedXor',
        value: function generateShiftedXor(xorInt, type) {
            let xorKey;
            switch (type) {
                case 1:
                    var Key = new Uint8Array([type]),
                        offset = 0;
                    Key[0] ^ 1;
                    offset += 4;
                    var wrap = Math.imul(offset, xorInt);
                    offset -= 1;
                    var roundoff = Math.imul(offset, xorInt);
                    Key = (wrap - roundoff) - 1e8;
                    Key = (Key + 231127) >> 50;
                    xorKey = Key + ((Math.round(19.658523)) * 2) ^ 3;
                    return xorKey;
                    break;
                case 2:
                    Key = new Uint8Array([type])
                    offset = (Key[0] + 4) ^ 5 - 1;
                    roundoff = Math.round(Math.acos(xorInt))
                    wrap = (roundoff) ^ 4;
                    Key = Math.imul((10e1) >>> roundoff ^ (
                        (0x1196 + 0x97b * (offset + roundoff) + -0x2e07) + roundoff), wrap) - (10 >> offset) - roundoff;
                    xorKey = (
                        (Key ^ 10) >> 1
                    ) ^ wrap;
                    return xorKey;
                    break;
                case 3:
                    Key = new Uint8Array([type])
                    var constants = [0x1196, 0x97b];
                    roundoff = (
                        Math.imul(11, xorInt)
                    ) + 0x97b - 0x66c;
                    Key = (
                        (Math.imul(((
                            constants[0] + constants[1] * type + -0x2e07) + 0x1) ^ 17, 16592) - 0x30d40 >> 7) +
                        ((xorInt >> type) ^ 12) - (
                            (constants[0] + constants[1] * type + -roundoff) + 0x1)
                    );
                    xorKey = ((
                        Math.imul(type >>> 24 ^ 1, 1479) >> 1
                    ) ^ (xorInt >> 1)) + 5 - Key;
                    return xorKey;
                    break;
            }
        }
    }, {
        key: '_00822',
        value: function _00822() {
            clearInterval(this._00902);

            clearInterval(this._00900);

            clearTimeout(this._00901);
        }
    }, {
        key: '_00823',
        value: function _00823() {}
    }, {
        key: '_00824',
        value: function _00824() {
            if (this._00834 == 1) {
                let _00309 = this._00832(52);
                _00309.setUint8(0, 22);
                var o = 0;
                for (; o < 25; ++o) {
                    _00309.setUint16(1 + 2 * o, o < this._00221.length ? this._00221.charCodeAt(o) : 0, true);
                }
                _00309.setUint8(51, 255)
                this._00835(_00309, true);
            } else if (this._00834 == 2) {
                this._00835(new Uint8Array([27]));
            } else if (this._00834 == 3) {
                let _00309 = this._00832(1 + 2 * this._00221.length);
                _00309.setUint8(0, 0x8F);
                for (var i = 0; i < this._00221.length; ++i) {
                    _00309.setUint16(1 + 2 * i, this._00221.charCodeAt(i), true);
                };
                this._00835(_00309, true);
            }
        }
    }, {
        key: '_00825',
        value: function _00825(offset) {
            var _00311 = this._00832(1);
            _00311.setUint8(0, offset);
            this._00835(_00311);
        }
    }, {
        key: '_00827',
        value: function _00827() {
            let _00313 = 268435455 & Date.now();
            let _00314 = this._00832(0x5);
            _00314.setUint8(0x0, 0x1);
            _00314.setUint32(0x1, _00313);
            this._00835(_00314, true);
        }
    }, {
        key: '_00828',
        value: function _00828() {
            if (this._00834 == 2) {
                this._00835(new Uint8Array([33, 0, 1]));
            } else if (this._00834 == 3) {
                this._00835(new Uint8Array([17]));
            }
        }
    }, {
        key: '_00829',
        value: function _00829() {
            if (this._00834 == 2) {
                this._00835(new Uint8Array([33, 1, 255]));
            } else if (this._00834 == 3) {
                this._00835(new Uint8Array([21]));
            }
        }
    }, {
        key: '_00830',
        value: function _00830(message) {
            if (this._00834 == 2) {
                const _00640 = new _00483(),
                    f = 0;
                _00640._00361(98);
                _00640._00361(f ? 1 : 0);
                _00640._00795(message);
                this._00835(_00640._00712());
            }
        }
    }, {
        key: '_00831',
        value: function _00831() {
            if (this._00834 == 1 || this._00834 == 2) {
                this._00835(_00601._00205)
            } else if (this._00834 == 3) {
                const MouseBuf = this._00832(21)
                MouseBuf.setUint8(0, 0x7f);
                MouseBuf.setFloat64(1, _00601._00204.x, true);
                MouseBuf.setFloat64(9, _00601._00204.y, true);
                MouseBuf.setUint32(17, 0, true);
                this._00835(MouseBuf, true);
            }
        }
    }, {
        key: '_00832',
        value: function _00832(buf) {
            return new DataView(new ArrayBuffer(!buf ? 1 : buf))
        }
    }, {
        key: '_00833',
        get: function _00833() {
            return this._00218 && this._00218.readyState === 1;
        }
    }, {
        key: '_00834',
        get: function _00834() {
            switch (true) {
                case /oceanar.io/.test(this._00215):
                case /aquar.io/.test(this._00215):
                    return 1;
                case /cellsbox.io/.test(this._00215):
                    return 2;
                case /agariott.com/.test(this._00215):
                case /www.inciagario/.test(this._00215):
                    return 3;
            }
            return 0;
        }
    }, {
        key: 'GenEnvSig',
        value: function GenEnvSig(length) {
            var result = [];
            var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
            var charactersLength = characters.length;
            for (var i = 0; i < length; i++) {
                result.push(characters.charAt(Math.floor(Math.random() * charactersLength)));
            }
            return result.join('');
        }
    }, {
        key: '_00835',
        value: function _00835(data, encrypt) {
            if (this._00833) {
                if (encrypt) {
                    this._00218.send(data.buffer);
                } else this._00218.send(data);
            }
        }
    }]);
    return _00403;
}();

if (location.host.includes('agma.io') || location.host.includes('cellcraft.io') ||
    location.host.includes('agariott.com') || location.host.includes('www.inciagario.net')
   ) {
    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 127:
                    _00601._00204.x = pkt.getFloat64(1, true);
                    _00601._00204.y = pkt.getFloat64(9, true);
                    break;
                case 0:
                    switch (pkt.byteLength) {
                        case 9:
                            _00601._00205 = pkt;
                            break;
                    }
                    break;
            }
            if (_00601._00203 !== thisArg.url) {
                _00601._00203 = thisArg.url;
            }
            return res;
        }
    });
    window.addEventListener('load', () => {
        _00601._00801();
    });
} else {
    window.addEventListener('load', () => {
        _00601._00801();
        WebSocket.prototype.realSend = WebSocket.prototype.send;
        WebSocket.prototype.send = function(pkt) {
            this.realSend(pkt);
            if (typeof pkt == 'string') return;
            if (this.url.includes('localhost')) return;
            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 185:
                    _00601._00204.x = pkt.getFloat64(1, true);
                    _00601._00204.y = pkt.getFloat64(9, true);
                    break;
                case 5:
                case 14:
                case 239:
                    _00601._00205 = pkt.buffer;
                    break;
            }
            if (_00601._00203 !== this.url) {
                _00601._00203 = this.url;
            }
        };
    });
}