E-Code

Evades Coder

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.greasyfork.org/scripts/438621/1022930/E-Code.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @license      MIT
// @name         E-Code
// @version      1.1
// @description  Evades Coder
// @author       0vC4
// @match        http://*/*
// @match        https://*/*
// @grant        none
// @run-at       document-start
// @namespace    https://greasyfork.org/users/670183
// ==/UserScript==

const Coder = await (async () => {
    const getFile = async url => await fetch(url).then(d=>d.text());
    const use = code => new Function('return '+code)();

    eval(await getFile('https://cdn.jsdelivr.net/gh/dcodeIO/[email protected]/dist/light/protobuf.min.js'));
    const appUrl = await getFile(location.href).then(d=>d.match(/app\.[a-z0-9]*\.js/)[0]);
    const mainJS = await getFile(location.href+'/'+appUrl);
    const scheme = use(mainJS.match(/(?<=\.addJSON\()\{(.|\n)+?\}(?=\);)/)[0]);

    const coder = new protobuf.Root();
    coder.addJSON(scheme);

    return {
        protobuf: coder,
        decode: {
            server(packet) {
                return coder.FramePayload.toObject(coder.FramePayload.decode(new Uint8Array(packet)));
            },
            client(packet) {
                return coder.ClientPayload.toObject(coder.ClientPayload.decode(new Uint8Array(packet)));
            }
        },
        encode: {
            server(object) {
                return coder.FramePayload.encode(object).finish();
            },
            client(object) {
                return coder.ClientPayload.encode(object).finish();
            }
        }
    };
})();