Diep.io Automation Pack

automates important constants for diep.io

Tätä skriptiä ei tulisi asentaa suoraan. Se on kirjasto muita skriptejä varten sisällytettäväksi metadirektiivillä // @require https://update.greasyfork.org/scripts/457231/1244636/Diepio%20Automation%20Pack.js.

// ==UserScript==
// @name         Diep.io Automation Pack
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  automates important constants for diep.io
// @author       bismuth
// @match        https://diep.io/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=diep.io
// @license      MIT
// @grant        none
// ==/UserScript==
window.Automator = class Automator {
    static config = {};
    constructor() {}
    hook(before,after) {
        WebAssembly.instantiateStreaming = (r, i) => r.arrayBuffer().then(b => WebAssembly.instantiate(b, i));
        const _instantiate = WebAssembly.instantiate;
        WebAssembly.instantiate = async(bin, imports) => {
            await this.getConfig(bin);
            before();
            return _instantiate(bin, imports).then(wasm => {
                for (const exp of Object.values(wasm.instance.exports)) {
                    if (exp.buffer) {
                        after(exp.buffer, Automator.config);
                    }
                }
                return wasm;
            });
        }
    }
    async getConfig(bin) {
        const buildFetch = async () => {
            const res = await fetch("https://diep.io/", { cache: "no-cache" });
            const text = await res.text();
            const JS_PATH = text.slice(text.indexOf("src=\"/index.") + "src=\"/".length, text.indexOf("\">", text.indexOf("src=\"/index.")));
            const wasm2js = await fetch("https://diep.io/" + JS_PATH).then(res => res.text());
            return wasm2js.slice(wasm2js.lastIndexOf("\"", wasm2js.indexOf(".wasm\"")) + 1, wasm2js.indexOf(".wasm\""));
        }
        const build = await buildFetch();
        try { Automator.config = JSON.parse(window.localStorage.config) }
        catch { Automator.config = {}; }
        if (Automator.config.build !== build) {
            const wasmRegex = (regex, repeat = false, start = 0) => {
                let ret = [], rets = [];
                jump: for (let n = start; n < this.packet.length - regex.length; n++) {
                    this.index = n;
                    ret = [];
                    for (let p = 0; p < regex.length; p++) {
                        if (regex[p] === '*') this.vu();
                        else if (regex[p] === '+') ret.push(this.vu());
                        else if (this.u8() !== regex[p]) continue jump;
                    }
                    if (repeat) rets.push(ret);
                    else return ret;
                }
                return rets.length? rets: false;
            }
            const unreachable = 0x00, nop = 0x01, block = 0x02, loop = 0x03, if_ = 0x04, else_ = 0x05, end = 0x0b, br = 0x0c, br_if = 0x0d,
                  call = 0x10, drop = 0x1a,
                  local_get = 0x20, local_set = 0x21, local_tee = 0x22, global_get = 0x23, global_set = 0x24, i32_load = 0x28, f32_load = 0x2a, f64_load = 0x2b, i32_load8_s = 0x2c, i32_load8_u = 0x2d, i32_load16_u = 0x2f,
                  i32_store = 0x36, i64_store = 0x37, f32_store = 0x38, i32_store8 = 0x3a, i32_store16 = 0x3b,
                  memory_grow = 0x40, i32_const = 0x41, i64_const = 0x42, i32_eqz = 0x45, i32_eq = 0x46, i32_lt_s = 0x48, i32_lt_u = 0x49,
                  f32_eq = 0x5b, f32_lt = 0x5d, f32_gt = 0x5e,
                  i32_add = 0x6a, i32_sub = 0x6b,
                  i32_and = 0x71, i32_or = 0x72, i32_xor = 0x73,
                  f32_sub = 0x93, f32_mul = 0x94,
                  f32_demote_f64 = 0xb6;
            const i32 = 0x7f, i64 = 0x7e, f32 = 0x7d, f64 = 0x4c;
            const param = 0x01, local = 0x02;
            const fieldMap = JSON.parse(atob('W1t7Im5hbWUiOiJwYXJlbnQiLCJ0eXBlIjoiZW50aXR5SUQiLCJncm91cCI6MCwibWVtVHlwZSI6ImVudGlkIiwicmVwZWF0IjoxLCJ1cGRhdGUiOiJlbnRpdHlJRCJ9LHsibmFtZSI6Im93bmVyIiwidHlwZSI6ImVudGl0eUlEIiwiZ3JvdXAiOjAsIm1lbVR5cGUiOiJlbnRpZCIsInJlcGVhdCI6MSwidXBkYXRlIjoiZW50aXR5SUQifSx7Im5hbWUiOiJ0ZWFtIiwidHlwZSI6ImVudGl0eUlEIiwiZ3JvdXAiOjAsIm1lbVR5cGUiOiJlbnRpZCIsInJlcGVhdCI6MSwidXBkYXRlIjoiZW50aXR5SUQifV0sW10sW3sibmFtZSI6InNob290aW5nIiwidHlwZSI6InZ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Z3JvdXAiOjEyLCJtZW1UeXBlIjoiaTMyIiwicmVwZWF0IjoxLCJ1cGRhdGUiOiJ2dSJ9XSxbXSxbeyJuYW1lIjoic2NvcmUiLCJ0eXBlIjoiZjMyIiwiZ3JvdXAiOjE0LCJtZW1UeXBlIjoiX2YzMiIsInJlcGVhdCI6MSwidXBkYXRlIjoiZjMyIn1dLFt7Im5hbWUiOiJ0ZWFtQ29sb3IiLCJ0eXBlIjoidnUiLCJncm91cCI6MTUsIm1lbVR5cGUiOiJpMzIiLCJyZXBlYXQiOjEsInVwZGF0ZSI6InZ1In0seyJuYW1lIjoibW90aGVyc2hpcFgiLCJ0eXBlIjoiZjMyIiwiZ3JvdXAiOjE1LCJtZW1UeXBlIjoiZjMyIiwicmVwZWF0IjoxLCJ1cGRhdGUiOiJmMzIifSx7Im5hbWUiOiJtb3RoZXJzaGlwWSIsInR5cGUiOiJmMzIiLCJncm91cCI6MTUsIm1lbVR5cGUiOiJmMzIiLCJyZXBlYXQiOjEsInVwZGF0ZSI6ImYzMiJ9LHsibmFtZSI6Im1vdGhlcnNoaXAiLCJ0eXBlIjoidnUiLCJncm91cCI6MTUsIm1lbVR5cGUiOiJpMzIiLCJyZXBlYXQiOjEsInVwZGF0ZSI6InZ1In0seyJuYW1lIjoidW5rMSIsInR5cGUiOiJ2dSIsImdyb3VwIjoxNSwibWVtVHlwZSI6ImkzMiIsInJlcGVhdCI6MSwidXBkYXRlIjoidnUifV1d'));
            const field_func = new Array(136).fill().map((_,ind) => ind & 1? '*': block);
            const fieldGroupMap = {};
            const fields = []; //key = index
            const _fields = {}; //key = name
            const funcs = [];
            let uptime, deletion, upcreate, rootVec, entPtr, animated, tankRootVec, recvPacketIndex;
            this.packet = new Uint8Array(bin);
            this.index = 8;
            while (this.index < this.packet.length) {
                const id = this.u8();
                const sectionLen = this.vu();
                if (id !== 10) {
                    this.index += sectionLen;
                    continue;
                }
                const bodyCount = this.vu();
                for (let i = 0; i < bodyCount; i++) {
                    const len = this.vu();
                    funcs.push(this.packet.slice(this.index, this.index += len));
                }
                break;
            }
            for (let n = 0; n < funcs.length; n++) {
                const funcBody = funcs[n];
                let regex;
                this.packet = funcBody;
                if (!uptime && (regex = wasmRegex([i32_const, '+',
                                                   i32_xor,
                                                   local_tee, '*',
                                                   i32_store]))) uptime = regex[0];
                if (!upcreate && (regex = wasmRegex([local_get, '*',
                                                     i32_const, '+',
                                                     i32_add,
                                                     i32_const, '*',
                                                     i32_and,
                                                     i32_xor]))) upcreate = regex[0];
                if (!deletion && (regex = wasmRegex([local_get, '*',
                                                     i32_const, '+',
                                                     i32_add,
                                                     i32_const, '*',
                                                     i32_and,
                                                     local_tee, '*',
                                                     local_get, '*',
                                                     i32_xor]))) deletion = regex[0];
                if (!rootVec && (regex = wasmRegex([i32_const, '+',
                                                    local_get, '*',
                                                    call, '*',
                                                    local_tee, '*',
                                                    local_get, '*',
                                                    i32_store16]))) { rootVec = regex[0] + 512; entPtr = rootVec + 208 }
                if (!animated && (regex = wasmRegex(new Array(4).fill().map(_ => [i32_const, '+',
                                                                                  i32_load, '*', '*',
                                                                                  local_set, '*',
                                                                                  i32_const, '*',
                                                                                  i32_const, '*',
                                                                                  i32_store, '*', '*',
                                                                                  '*', '*', '*', '*', '*', '*', '*', '*', '*']).flat()))) animated = {x: regex[3], y: regex[2], fov: regex[0] }
                /*
                if ((regex = wasmRegex(field_func, false))) {
                    const groupDeclare = [...wasmRegex([local_get, '*',
                                                        i32_load, '*', '+',
                                                        local_set, '+'], true),
                                          ...wasmRegex([local_get, '*',
                                                        i32_load, '*', '+',
                                                        local_tee, '+'], true)];
                    for (const [offset,varName] of groupDeclare) if (offset >= 72) fieldGroupMap[varName] = (offset - 72) >> 2;
                    const fieldDeclare = wasmRegex([local_get, '+',
                                                    i32_const, 0,
                                                    i32_store8, '*', '+'], true);
                    for (const [varName,offset] of fieldDeclare) {
                        const group = fieldGroupMap[varName];
                        const pos = offset-4;
                        const field = fieldMap[group][pos];
                        if (_fields[field.name]) continue;
                        fields.push(field);
                        _fields[field.name] = field;
                    }
                }
                */
            }
            /*
            const fieldGroupOffsets = [8, 0, 8, 12, 8, 0, 8, 8, 20, 8, 28, 8, 12, 0, 8, 8];
            const fieldGroupOrder = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]];
            const typeLengths = {"f32": 8,"_f32":32,"i32":8,"entid":12,"str":16};
            for (let n = 0; n < fields.length; n++) {
                const val = fields[n];
                if (!val.name) continue;
                if (val.memType === '_f32') fieldGroupOffsets[val.group] += fieldGroupOffsets[val.group] & 4;
                _fields[val.name].offset = val.offset = fieldGroupOffsets[val.group];
                val.groupOffset = 72 + (val.group << 2);
                fieldGroupOffsets[val.group] += typeLengths[val.memType] * val.repeat;
                fieldGroupOrder[val.group].push(n);
            }
            */
            const lastUpdatedAt = new Date().toString();
            Automator.config = {
                build,
                fieldMap,
                fields,
                _fields,
                uptime,
                deletion,
                upcreate,
                rootVec,
                entPtr,
                //fieldGroupOrder,
                animated,
                lastUpdatedAt
            };
            window.localStorage.config = JSON.stringify(Automator.config);
            console.log(`%cfinished automation for build ${build}`, 'color: red; font-weight: bold');
            return Automator.config;
        }
    }
    u8() { return this.packet[this.index++] }
    vu() {
        let out = 0, at = 0;
        while (this.packet[this.index] & 0x80) {
            out |= (this.u8() & 0x7f) << at;
            at += 7;
        }
        out |= this.u8() << at;
        return out;
    }
}