kone base64 자동복호화

base64코드 자동복호화

当前为 2025-05-24 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         kone base64 자동복호화
// @namespace    http://tampermonkey.net/
// @version      0.232
// @description   base64코드 자동복호화
// @author       SYJ
// @match        https://arca.live/*
// @match https://kone.gg/s/somisoft*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=arca.live
// @grant        GM_registerMenuCommand
// @grant        GM_unregisterMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// @grant         GM_addValueChangeListener
// @license MIT
// ==/UserScript==

(async function(){
    let v = await GM_getValue('myValue', 123);
    let menuId;

    function registerMenu(){
        if(menuId) GM_unregisterMenuCommand(menuId);
        // 레이블에 현재 v 를 포함
        menuId = GM_registerMenuCommand(
            `설정 입력 (현재 값: ${v})`,
            async () => {
                const input = prompt('새 값을 입력하세요:', v);
                if(input !== null){
                    const n = parseInt(input);
                    if(!isNaN(n)){
                        v = n;
                        await GM_setValue('myValue', v);
                        registerMenu(); // 메뉴 레이블 갱신
                    } else {
                        alert('숫자만 입력하세요');
                    }
                }
            }
        );
    }

    registerMenu();
    // — 여기서 v 를 실제 화면에 표시하거나 쓰고 싶다면,
    //   document.body.append(`현재 값: ${v}`) 같은 DOM 추가로 처리하세요.
})();


(async function() {
    // 1) 값 로드
    let val = await GM_getValue('toggleVal', false);
    let menuId;

    // 2) 배지 생성
    /* const badge = document.createElement('div');
    Object.assign(badge.style, {
        position: 'fixed',
        top: '10px',
        right: '10px',
        padding: '4px 8px',
        background: 'rgba(0,0,0,0.7)',
        color: '#fff',
        fontSize: '14px',
        borderRadius: '4px',
        zIndex: '9999',
    });
    document.body.append(badge);
    */

    // 3) 렌더 함수
    function render() {
        // 메뉴 해제 후 다시 등록
        if (menuId) GM_unregisterMenuCommand(menuId);
        menuId = GM_registerMenuCommand(
            `자동모드 토글 (현재: ${val?'ON':'OFF'})`,
            toggleValue
        );
        // 배지 업데이트
        //badge.textContent = `현재 값: ${val}`;
    }

    // 4) 토글 함수 (즉시 UI 업데이트 포함)
    async function toggleValue() {
        const newVal = !val;
        await GM_setValue('toggleVal', newVal);
        val = newVal;    // 변수 갱신
        render();        // 메뉴·배지 즉시 갱신
    }

    // 초기 렌더
    render();
})();

async function main(){
    const isAutoMode = await GM_getValue('toggleVal', false);

    if (isAutoMode) {
        setTimeout(autoApply, 1000);
    }
    else {
        setTimeout(manuallyApply, 1000);
}
}

function doDecode(text) {
    ///'use strict';
    let result = text;
    result = dec(/aHR0c[0-9A-Za-z+]{20,}[=]{0,2}/, result); //aHR0c:1회인코딩된것.
    result = dec(/YUhSMGN[0-9A-Za-z]{60,}[=]{0,2}/, result); //YUhSMGN:2회인코딩된것.
    result = dec(/[0-9A-Za-z]{30,}[=]{1,2}/, result); //문자열 30회 + '=' 1~2회
    result = dec(/[0-9A-Za-z]{200,}[=]{0,2}/, result); //문자열 200회 + '=' 0~2회
    return result;


}
function dec(reg, text) {
    let result = text;
    try {
        while (reg.test(result)) {
            const original = reg.exec(result)[0];
            let decoded = original;
            while (decoded.match(/aHR0c[0-9A-Za-z]{8,}[=]{0,2}/) == null){
                decoded = atob(decoded);
            }
            decoded = atob(decoded); console.log(decoded);
            result = result.replace(original, decoded);
        }
        return result;
    }
    catch(e) { console.log('er', e);
return text;}
}


function manuallyApply() {
    document.body.addEventListener('dblclick', function(e) {
        console.log('더블클릭 감지! 🎉',e.target,event.composedPath()[0]);
        const el = e.composedPath()[0];
        const original = el.textContent;
        const decodedLink = doDecode(original);
        if (original === decodedLink) return;
        while(el.firstChild) el.removeChild(el.firstChild);
        el.appendChild(makeATag(decodedLink));
    })
}

function autoApply() {
    const contents = Array.from(document.body.querySelectorAll('main p'));
    for (const el of contents) {
        console.log(doDecode(el.textContent));
        el.textContent = console.log(doDecode(el.textContent));
    }
}


function makeATag(link){
    const aTag = document.createElement('a');
    aTag.href = link;
    aTag.textContent = link;
    aTag.target = '_blank';
    aTag.rel = 'noreferrer';
    return aTag;
}

window.addEventListener('load', main);