코네 base64 오토 디코더
클로드는 신이야!
1
딱 코네에서 base64 디코딩만하고 url만 하이퍼링크화 시켜주는 게 필요해서
클로드 한발 뽑아주니 원큐에 되더라
tampermonkey나 viloetmonkey에 추가해주면 됨
// ==UserScript==
// @name Base64 Auto Decoder
// @namespace http://tampermonkey.net/
// @version 1.1
// @author you
// @match *://*/*
// @run-at document-idle
// @noframes
// @grant none
// ==/UserScript==
(function () {
'use strict';
if (window.__b64DecoderLoaded) return;
window.__b64DecoderLoaded = true;
const DECODED_MARK = 'data-b64decoded';
/* ============================== 설정 ============================== */
const TARGET_SELECTORS = ['#post-article', '#post-comment', '.article-body', '.title'];
const MAX_DECODE = 5;
const MIN_B64_LEN = 7;
const B64_CANDIDATE = new RegExp('[A-Za-z0-9+/]{' + MIN_B64_LEN + ',}={0,2}', 'g');
const URL_REGEX = /((?:https?:\/\/|www\.)[^\s<>"'()]+)/gi;
/* ============================== 유틸 ============================== */
function looksLikeBase64(str) {
return (
str.length >= MIN_B64_LEN &&
str.length % 4 !== 1 &&
/^[A-Za-z0-9+/]+={0,2}$/.test(str)
);
}
function isProbablyText(str) {
if (!str) return false;
let bad = 0;
for (const ch of str) {
const c = ch.codePointAt(0);
if (c < 0x09 || (c > 0x0d && c < 0x20) || c === 0x7f) bad++;
}
return bad / str.length < 0.1;
}
function decodeOnce(str) {
if (!looksLikeBase64(str)) return null;
try {
let s = str;
const rem = s.length % 4;
if (rem === 2) s += '==';
else if (rem === 3) s += '=';
const binary = atob(s);
const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));
return new TextDecoder('utf-8', { fatal: true }).decode(bytes);
} catch (e) {
return null;
}
}
function fullyDecode(str) {
let current = str;
let best = null;
for (let i = 0; i < MAX_DECODE; i++) {
const decoded = decodeOnce(current);
if (decoded === null) break;
if (!isProbablyText(decoded)) break;
best = decoded;
current = decoded;
}
return best;
}
/* ============================== DOM 조립 ============================== */
function buildDecodedNodes(text) {
const nodes = [];
let last = 0;
let m;
URL_REGEX.lastIndex = 0;
while ((m = URL_REGEX.exec(text)) !== null) {
let url = m[0];
const trailMatch = url.match(/[.,;:!?)\]}'"]+$/);
let trail = '';
if (trailMatch) {
trail = trailMatch[0];
url = url.slice(0, url.length - trail.length);
}
const start = m.index;
if (start > last) nodes.push(document.createTextNode(text.slice(last, start)));
const a = document.createElement('a');
a.href = url.toLowerCase().startsWith('http') ? url : 'https://' + url;
a.textContent = url;
a.target = '_blank';
a.rel = 'noopener noreferrer';
nodes.push(a);
if (trail) nodes.push(document.createTextNode(trail));
last = start + m[0].length;
}
if (last < text.length) nodes.push(document.createTextNode(text.slice(last)));
return nodes;
}
function processTextNode(node) {
const text = node.nodeValue;
if (!text) return;
let match;
let last = 0;
let changed = false;
const frag = document.createDocumentFragment();
B64_CANDIDATE.lastIndex = 0;
while ((match = B64_CANDIDATE.exec(text)) !== null) {
const candidate = match[0];
const decoded = fullyDecode(candidate);
if (decoded === null) continue;
changed = true;
if (match.index > last) {
frag.appendChild(document.createTextNode(text.slice(last, match.index)));
}
for (const n of buildDecodedNodes(decoded)) frag.appendChild(n);
last = match.index + candidate.length;
}
if (!changed) return;
if (last < text.length) frag.appendChild(document.createTextNode(text.slice(last)));
const wrapper = document.createElement('span');
wrapper.setAttribute(DECODED_MARK, '1');
wrapper.appendChild(frag);
node.parentNode.replaceChild(wrapper, node);
}
function processContainer(container) {
const walker = document.createTreeWalker(container, NodeFilter.SHOW_TEXT, {
acceptNode(node) {
const p = node.parentNode;
if (!p) return NodeFilter.FILTER_REJECT;
const tag = p.nodeName;
if (tag === 'SCRIPT' || tag === 'STYLE' || tag === 'A' || tag === 'TEXTAREA') {
return NodeFilter.FILTER_REJECT;
}
if (node.parentElement && node.parentElement.closest('[' + DECODED_MARK + ']')) {
return NodeFilter.FILTER_REJECT;
}
if (!node.nodeValue || !node.nodeValue.trim()) return NodeFilter.FILTER_REJECT;
return NodeFilter.FILTER_ACCEPT;
},
});
const targets = [];
let n;
while ((n = walker.nextNode())) targets.push(n);
targets.forEach(processTextNode);
}
/* ====================== 실행 / 동적 콘텐츠 감시 ====================== */
let observer = null;
let scheduled = false;
function runOnce() {
TARGET_SELECTORS.forEach((sel) => {
document.querySelectorAll(sel).forEach((el) => processContainer(el));
});
}
function startObserve() {
if (!observer) observer = new MutationObserver(() => scheduleRun());
const root = document.body || document.documentElement;
if (root) observer.observe(root, { childList: true, subtree: true, characterData: true });
}
function scheduleRun() {
if (scheduled) return;
scheduled = true;
requestAnimationFrame(() => {
scheduled = false;
if (observer) observer.disconnect();
runOnce();
startObserve();
});
}
runOnce();
startObserve();
})(); 22
7 comments
아우로라
ㅁㅊ 너무 편하고
apache
딱 원하는 기능하고 id나 클래스만 지정해주니 알잘딱해줌
s/somisoft
• 163,117 subscribers여러가지 다루는 서브
Rules
- 1. 게시물 규정 양식
업로드 시 링크 암호화 & 필수 정보를 기입할 것
- 2. 질문
국룰, 암호화 링크 등 기본사항 질문 금지, 탭 미준수시 차단 및 삭제
- 3. 요청
요청 기준 및 양식 미준수 & 댓글로만 자료 복구 요청 시 차단
- 4. 미성년자 / 근첩 / 페미 / 다중계정
조금이라도 의심되면 선 차단, 후 해명
- 5. 좆목 / 네임드화
닉언, 네임드화 등 친목질 금지
- 6. 분탕 및 어그로 / 혐짤 / 낚시 / 뇌절
해당 카테고리의 차단 기간 및 가중처벌은 처리자 재량으로 판단
- 7. 홍보 / 판촉 / 거래
허용되지 않은 모든 형태의 홍보, 거래, 교환, 조건부 공유 시 차단
- 8. 쌀먹 / 바이러스
조건부 공유 & 수익성 링크 & 고의적인 바이러스 유포 시 갱신차단
- 9. 자료 분류 / AI
미검수 시 표기 필수, 생성형 AI를 사용한 자료의 제목에 AI 미기입 시 차단
- 10. 실사 / 토들러
업로드시 갱신 차단
- 11. 기타 세부 규정은 서브 공지사항 참고