Greasy Fork is available in English.

Auto Simya

심챈 자동 복호화/국룰입력/다운(Kiosk, Mega, GoogleDrive, )

// ==UserScript==
// @name		Auto Simya
// @name:ko		심야 자동 식당
// @namespace	http://tampermonkey.net/
// @description	심챈 자동 복호화/국룰입력/다운(Kiosk, Mega, GoogleDrive, )
// @version		4.15
// @author		김머시기
// @match		https://kiosk.ac/c/*
// @match		https://arca.live/b/*
// @match		https://mega.nz/*
// @match		https://gofile.io/d/*
// @match		https://drive.google.com/file/d/*
// @match		https://drive.google.com/drive/folders/*
// @match		https://drive.usercontent.google.com/download?id*
// @icon		https://lh3.google.com/u/0/d/18OVO7VmnwIuHK6Ke-z7035wKFmMKZ28W=w1854-h959-iv1
// @grant		GM.setValue
// @grant		GM.getValue
// @require		https://openuserjs.org/src/libs/sizzle/GM_config.js
// @grant		GM.registerMenuCommand
// @grant		GM_registerMenuCommand
// @grant		GM_unregisterMenuCommand
// @grant		GM_getValue
// @grant		GM_setValue
// @license		MIT
// @run-at		document-end
// ==/UserScript==
'use strict';
let chkp=[,,,,atob('c21wZW9wbGU=')], Down_Option, PageLoading = [], isT = [,,], MenuID = [null, null], pw = [atob('c21wZW9wbGU='),
// ==============================	  Settings	  ====================================
//	추가하길 원하는 비밀번호 쉼표로 구분해서 바로 아래줄에 따옴표안에 넣으면 됨  ex) '1234', '2024국룰', '!국룰!'

];
		PageLoading[0]	= 500;		//	본인 컴퓨터, 인터넷 사양이 좋지 않아 페이지 로딩시간이 오래걸리면 해당 값 조절하세요(1000당 1초)
		Down_Option		= 0;		//	Kiosk 다운로드 옵션  0:Basic  1:Fast  2:일괄 다운로드
// ======================================================================================
async function toggleDown() {
	isT[0] = !isT[0];
	if(isT[0] == false && isT[1] == true) {
		isT[1] = false;
		await GM.setValue('isT[1]', isT[1]);
	}
	await GM.setValue('isT[0]', isT[0]);
	updateDown();
	updateTab();
}
async function toggleTab() {
	isT[1] = !isT[1];
	if(isT[0] == false && isT[1] == true) {
		isT[0] = true;
		await GM.setValue('isT[0]', isT[0]);
	}
	await GM.setValue('isT[1]', isT[1]);
	updateDown();
	updateTab();
}
function updateDown() {
	if(MenuID[0] !== null) GM_unregisterMenuCommand(MenuID[0]);
	MenuID[0] = GM_registerMenuCommand(`자동 다운로드  ${isT[0] ? 'ON' : 'OFF'}`, toggleDown, { autoClose: false, title: `자동 다운로드 ${isT[0] ? '켜짐' : '꺼짐'}`});
}
function updateTab() {
	if(MenuID[1] !== null) GM_unregisterMenuCommand(MenuID[1]);
	MenuID[1] = GM_registerMenuCommand(`자동 탭 닫기  ${isT[1] ? 'ON' : 'OFF'}`, toggleTab, { autoClose: false, title: `자동 탭 닫기 ${isT[1] ? '켜짐' : '꺼짐'}`});
}
function doDec() {
	if(chkp[3] == chkp[4]) {
		const atc = document.querySelector('body div.article-body > div.fr-view.article-content');
		function dec(reg) {
			try {
				while(reg.test(atc.innerHTML)) {
					let DECed = reg.exec(atc.innerHTML)[0];
					while(DECed.match(/aHR0c[0-9A-Za-z+/-]{8,}[=]{0,2}/g) == null) {
						DECed = atob(DECed);
					} DECed = atob(DECed);
					atc.innerHTML = atc.innerHTML.replace(reg, `<a href=${DECed} target='_blank' rel='noreferrer'>${DECed}</a>`);
				}
			} catch(e) { console.log(e, atc) }
		}
		dec(/aHR0c[0-9A-Za-z+/-]{8,}[=]{0,2}/);
		dec(/YUhSMG[0-9A-Za-z+/-]{8,}[=]{0,2}/);
		dec(/WVVoU[0-9A-Za-z+/-]{8,}[=]{1,2}/);
		dec(/V1ZWb[0-9A-Za-z+/-]{8,}[=]{0,2}/);
	}
}
async function chkPW() {
	chkp[3] = await GM.getValue('chkp[3]');
	isT[0] = await GM.getValue('isT[0]', true);
	isT[1] = await GM.getValue('isT[1]', false);
	updateDown();
	updateTab();
	if(document.URL.split('/')[2] == 'arca.live') {
		if(chkp[3] != chkp[4]) {
			const chk = prompt(decodeURI(atob('JUVBJUI1JUFEJUVCJUEzJUIwJUVEJTk5JTk1JUVDJTlEJUI4')));
			if(chk?.toLowerCase() == chkp[4]) await GM.setValue('chkp[3]', chkp[4]);
			else {
				GM.setValue('chkp[3]', false);
				alert(decodeURI(atob('JUVBJUI1JUFEJUVCJUEzJUIwJUVDJTlEJUI0JTIwJUVDJTlEJUJDJUVDJUI5JTk4JUVEJTk1JTk4JUVDJUE3JTgwJTIwJUVDJTk1JThBJUVDJThBJUI1JUVCJThCJTg4JUVCJThCJUE0')));
			}
		}
	}
}
async function inputPW() {
	if(chkp[3] == chkp[4]) {
		try {
			for(var i = 0; i < pw.length; i++) {
				document.querySelector(chkp[0]).value = pw[i];
				document.querySelector(chkp[1]).click();
				if(i < pw.length - 1) { if(pw[i] != null && pw[i] != '') await new Promise(res => setTimeout(res, 800));
				} else { if(isT[0] == true) await setTimeout(DBtn, PageLoading[1]); }
			}
		} catch(e) { if(isT[0] == true && document.URL.split('/')[2] == 'gofile.io') await setTimeout(DBtn, PageLoading[1]); }
	}
}
async function DBtn() {
	if(document.URL.split('/')[2] == 'mega.nz') await document.querySelector('.mega-button.positive.resume.js-resume-download').click();
	try {
		await document.querySelector(chkp[2]).click();
		if(document.URL.split('/')[2] == 'mega.nz') await setTimeout(() => { document.querySelector('.mega-button.large.positive.download.continue-download').click() }, 2000);
		if(document.querySelector(chkp[2]) != null && isT[1] == true && isT[2] == true && document.URL.split('/')[2] != 'gofile.io') setTimeout(() => { window.open('', '_self').close() }, 1000);
		else if(document.querySelector(chkp[2]) != null && isT[1] == true && isT[2] == true && document.URL.split('/')[2] == 'gofile.io') setTimeout(() => { window.open('', '_self').close() }, 4000);
	} catch(e) { if(isT[1] == true && isT[2] == true) setTimeout(() => { window.open('', '_self').close() }, 1000); }
}
function FindPW() {
	const atc = document.querySelector('body div.article-body > div.fr-view.article-content');
	atc.innerHTML = atc.innerHTML.replace(/국룰/g,'ㄱㄹ');
	let rgx = /[(<p>)]{0,0}[ㄱ-ㅣ가-힣0-9A-Za-z\s~`!^\_+@\#$%&=]{0,}(ㄱㄹ){1,}[ㄱ-ㅣ가-힣0-9A-Za-z\s~`!^\_+@\#$%&=\(\)]{0,}[(</p>)]{0,0}/
	let regexx = /(대문자)/
    if(regexx.test(regexx.exec(atc.innerHTML))===true) pw[pw.length]=atob('U01QRU9QTEU');
	function dec(reg) {
		try {
			while(reg.test(atc.innerHTML)) {
				let DECed = reg.exec(atc.innerHTML)[0].replace(/(ㄱㄹ)/g,'국룰');
                let DECedd = DECed.replace(/\s|[+]|(&nbsp)|은|는|이|(전부)|(대문자로)|(대문자)|(비밀번호)|(패스워드)|(비번)|(ㅂㅂ)|(암호)|(ㅇㅎ)|(키오스크맘)|(키오스크)/g, '');
				DECedd = DECedd.split(/[(입)(임)(이다)(이고)(이며)(입니다)(임다)(같)(처럼)(틀)]/g)[0];
				let dat = document.querySelector('.date .body').innerText.split(" ")[0];
				let regexa = /(오늘)|(날짜)|(날자)/g
				if(regexa.test(DECedd)===true){
					DECedd = DECedd.replace(regexa,'');
					let md = [dat.split(/\-/g)[1] + dat.split(/\-/g)[2],dat.split(/\-/g)[1] +'-'+ dat.split(/\-/g)[2],dat.replace(/\-/g,''),dat];
					for(var i=0;i<4;i++) {
                        pw[pw.length]=DECedd.replace(/국룰/g,chkp[4])+md[i];}
				} else { if(pw.indexOf(DECedd.replace(/국룰/g,chkp[4])) == '-1') pw[pw.length]=DECedd.replace(/국룰/g,chkp[4]);
				} atc.innerHTML = atc.innerHTML.replace(reg,'1ㅂㅁ2ㅈㄴ3ㄷㅇ4ㄱㄹ1qa2ws3ed4rf');
				atc.innerHTML = atc.innerHTML.replace(/(1ㅂㅁ2ㅈㄴ3ㄷㅇ4ㄱㄹ1qa2ws3ed4rf)/g,DECed);
            } GM.setValue('pw', pw);
        } catch(e) { console.log(e, atc); }
        //console.log(pw);
	} dec(/[(<p>)]{0,0}[ㄱ-ㅣ가-힣0-9A-Za-z\s~`!^\_+@\#$%&=]{0,}(ㄱㄹ){1,1}[ㄱ-ㅣ가-힣0-9A-Za-z\s~`!^\_+@\#$%&=]{0,}[(</p>)]{0,0}/);
	setTimeout(aaa, 100);
}
async function aaa(){ pw=await GM.getValue('pw'); }
chkPW();
if(document.URL.split('/')[2] == 'arca.live') {
	FindPW();
	setTimeout(doDec, 10);
}
if(document.URL.split('/')[2] == 'mega.nz') {
	aaa();
	chkp[0] = '#password-decrypt-input';
	chkp[1] = '.mega-button.positive.fm-dialog-new-folder-button.decrypt-link-button';
	chkp[2] = '.mega-button.positive.js-default-download.js-standard-download';
	PageLoading[1] = 4000;
	isT[2] = false;
	setTimeout(inputPW, PageLoading[0] + 1800);
}
if(document.URL.split('/')[2] == 'kiosk.ac') {
	aaa();
	chkp[0] = '.input.shadow-xl.flex-grow';
	chkp[1] = '.btn.btn-ghost.w-full.mt-2.rounded-md';
	if(Down_Option == 2) chkp[2] = '.flex.justify-between.w-full .flex.gap-2 .btn.btn-ghost';
	else chkp[2] = '.p-2 li:nth-child(' + (Down_Option + 2) + ') button';
	if(Down_Option == 0) isT[2] = true;
	else isT[2] = false;
	PageLoading[1] = 1000;
	setTimeout(inputPW, PageLoading[0]);
}
if(document.URL.split('/')[2] == 'drive.google.com') {
	aaa();
	if(document.URL.split('/')[3] + document.URL.split('/')[4] == 'filed') window.location.href = `https://drive.usercontent.google.com/download?id=${document.URL.split('/')[5]}&export=download`;
	if(document.URL.split('/')[3] + document.URL.split('/')[4] == 'drivefolders') {
		setTimeout(() => { if(isT[0] == true) setTimeout(() => { document.querySelector('.pc7nUb.kXQBpc.Dk9rmd:nth-child(2)').click() }, 1500) }, PageLoading[0]);
		chkp[2] = '.h-De-Vb.h-De-Y';
		PageLoading[1] = 1;
		isT[2] = true;
		setTimeout(() => { if(isT[0] == true) setTimeout(DBtn, 3500) }, PageLoading[0]);
	}
}
if(document.URL.split('/')[2] == 'drive.usercontent.google.com') {
	aaa();
	chkp[2] = '.goog-inline-block.jfk-button.jfk-button-action';
	isT[2] = true;
	setTimeout(() => { if(isT[0] == true) DBtn() }, 1);
}
if(document.URL.split('/')[2] == 'gofile.io') {
	aaa();
	chkp[0] = '#filesErrorPasswordInput';
	chkp[1] = '#filesErrorPasswordButton';
	chkp[2] = '.btn.btn-outline-secondary.btn-sm.p-1.text-white';
	//chkp[2] = '.dropdown-item.filesContentOption.filesContentOptionDownloadAll';
	PageLoading[1] = 3000;
	isT[2] = true;
	setTimeout(inputPW, PageLoading[0]);
}