Auto Simya

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

当前为 2024-05-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Auto Simya
  3. // @name:ko 심야 자동 식당
  4. // @namespace http://tampermonkey.net/
  5. // @description 심챈 자동 복호화/국룰입력/다운(Kiosk,Mega,GoogleDrive)
  6. // @version 3.7
  7. // @author 김머시기
  8. // @match https://kiosk.ac/c/*
  9. // @match https://arca.live/b/*
  10. // @match https://mega.nz/*
  11. // @match https://drive.google.com/file/d/*
  12. // @match https://drive.google.com/drive/folders/*
  13. // @match https://drive.usercontent.google.com/download?id*
  14. // @icon https://lh3.google.com/u/0/d/1jDk6_Mt15I4k9ZfqpfeYZ-Qb5xOWV_uQ=w1854-h959-iv1
  15. // @grant GM.setValue
  16. // @grant GM.getValue
  17. // @require https://openuserjs.org/src/libs/sizzle/GM_config.js
  18. // @grant GM.registerMenuCommand
  19. // @grant GM_registerMenuCommand
  20. // @grant GM_unregisterMenuCommand
  21. // @grant GM_getValue
  22. // @grant GM_setValue
  23. // @license MIT
  24. // @run-at document-end
  25. // ==/UserScript==
  26. 'use strict';
  27. const rpw = atob("c21wZW9wbGU=");
  28. let password = [rpw,"#"+rpw+"#",
  29. // ============================== Settings ====================================
  30. // 추가하길 원하는 비밀번호 쉼표로 구분해서 바로 아래줄에 따옴표안에 넣으면 됨 ex) "1234","2024국룰","!국룰!"
  31. ];
  32. let pageLoadTime = 1200; // 본인 컴퓨터, 인터넷 사양이 좋지 않아 페이지 로딩시간이 오래걸리면 해당 값 조절하세요(1000당 1초)
  33. let d_Option = 1; // Kiosk 다운로드 옵션 0:Basic 1:Fast 2:일괄 다운로드
  34. // ======================================================================================
  35. let rpt,pwi,pwb,btd,dtime,tabTime,autoTab,autoDown,isDown,isTab;
  36. let DownId = null, TabId = null;
  37. let currentHost = document.URL.split("/")[2];
  38. const timer = ms => new Promise(res => setTimeout(res, ms))
  39. async function rnrfnf() {
  40. rpt = await GM.getValue("rpt");
  41. isDown = await GM.getValue("isDown",true);
  42. isTab = await GM.getValue("isTab",false);
  43. updateDown();
  44. updateTab();
  45. if(currentHost == "arca.live") {
  46. if(rpt != rpw) {
  47. const chk = prompt("국룰 확인");
  48. if(chk?.toLowerCase() == rpw) {
  49. await GM.setValue("rpt", rpw);
  50. } else {
  51. GM.setValue("rpt", false);
  52. alert("국룰이 일치하지 않습니다.");
  53. }
  54. }
  55. }
  56. }
  57. async function toggleDown() {
  58. isDown = !isDown;
  59. if(isDown === false && isTab === true) {
  60. isTab = false;
  61. await GM.setValue("isTab",isTab);
  62. }
  63. await GM.setValue("isDown",isDown);
  64. updateDown();
  65. updateTab();
  66. }
  67. async function toggleTab() {
  68. isTab = !isTab;
  69. if(isDown === false && isTab === true) {
  70. isDown = true;
  71. await GM.setValue("isDown",isDown);
  72. }
  73. await GM.setValue("isTab",isTab);
  74. updateDown();
  75. updateTab();
  76. }
  77. function updateDown() {
  78. if(DownId !== null) GM_unregisterMenuCommand(DownId);
  79. DownId = GM_registerMenuCommand(`자동 다운로드  ${isDown ? '켜짐' : '꺼짐'}`, toggleDown);
  80. if(isDown === true) autoDown = "on";
  81. if(isDown === false) autoDown = "off";
  82. }
  83. function updateTab() {
  84. if(TabId !== null) GM_unregisterMenuCommand(TabId);
  85. TabId = GM_registerMenuCommand(`자동 닫기  ${isTab ? '켜짐' : '꺼짐'}`, toggleTab);
  86. if(isTab === false) autoTab = "off";
  87. if(isTab === true) autoTab = "on";
  88. }
  89. function doDecode() {
  90. if(rpt == rpw) {
  91. const article = document.querySelector("body div.article-body > div.fr-view.article-content");
  92. function dec(reg) {
  93. try {
  94. while(reg.test(article.innerHTML)) {
  95. let decoded = reg.exec(article.innerHTML)[0];
  96. while(decoded.match(/aHR0c[0-9A-Za-z+/-]{8,}[=]{0,2}/) == null) {
  97. decoded = atob(decoded);
  98. } decoded = atob(decoded);
  99. article.innerHTML = article.innerHTML.replace(reg, `<a href=${decoded} target='_blank' rel='noreferrer'>${decoded}</a>`);
  100. }
  101. } catch(e) { console.log(e,article); }
  102. }
  103. dec(/aHR0c[0-9A-Za-z+/-]{20,}[=]{0,2}/);
  104. dec(/YUhSMGN[0-9A-Za-z+/-]{80,}[=]{0,2}/);
  105. dec(/[0-9A-Za-z+/-]{30,}[=]{1,2}/);
  106. dec(/[0-9A-Za-z+/-]{200,}[=]{0,2}/);
  107. }
  108. }
  109. async function pw() {
  110. if(rpt == rpw) {
  111. for(var i = 0; i < password.length; i++) {
  112. document.querySelector(pwi).value = password[i];
  113. document.querySelector(pwb).click();
  114. if(i < password.length-1) {
  115. if(password[i] != null && password[i] != "") await timer(700);
  116. } else {
  117. if(autoDown == "on") await setTimeout(dbtn,dtime);
  118. }
  119. }
  120. }
  121. }
  122. async function dbtn() {
  123. let downBtn = document.querySelector(btd);
  124. if(currentHost == "mega.nz") {
  125. let resumeBtn = document.querySelector('.mega-button.positive.resume.js-resume-download');
  126. await resumeBtn.click();
  127. }
  128. await downBtn.click();
  129. if(downBtn != null && autoTab == "on" && currentHost != "mega.nz") setTimeout(() => { window.open('','_self').close(); }, tabTime);
  130.  
  131. }
  132. rnrfnf();
  133. if(currentHost == "arca.live") setTimeout(doDecode, 100);
  134. if(currentHost == "mega.nz") {
  135. pwi = "#password-decrypt-input";
  136. pwb = ".mega-button.positive.fm-dialog-new-folder-button.decrypt-link-button";
  137. btd = ".mega-button.positive.js-default-download.js-standard-download";
  138. dtime = 4000;
  139. tabTime = 1000;
  140. setTimeout(pw, pageLoadTime+1000);
  141. }
  142. if(currentHost == "kiosk.ac") {
  143. pwi = ".input.shadow-xl.flex-grow";
  144. pwb = ".btn.btn-ghost.w-full.mt-2.rounded-md";
  145. if(d_Option == 2) btd = ".flex.justify-between.w-full .flex.gap-2 .btn.btn-ghost";
  146. else btd = ".p-2 li:nth-child("+(d_Option+2)+") button";
  147. dtime = 1000;
  148. tabTime = 1000;
  149. setTimeout(pw, pageLoadTime);
  150. }
  151. if(currentHost == "drive.google.com") {
  152. let googleHost = document.URL.split("/")[3]+document.URL.split("/")[4];
  153. if(googleHost == "filed") window.location.href = `https://drive.usercontent.google.com/download?id=${document.URL.split("/")[5]}&export=download`;
  154. if(googleHost == "drivefolders") {
  155. btd = ".pc7nUb.kXQBpc.Dk9rmd:nth-child(2)";
  156. tabTime = 5300;
  157. setTimeout(() => { if(autoDown == "on") setTimeout(dbtn, 1500)},pageLoadTime);
  158. }
  159. }
  160. if(currentHost == "drive.usercontent.google.com") {
  161. btd = ".goog-inline-block.jfk-button.jfk-button-action";
  162. tabTime = 1000;
  163. setTimeout(() => { if(autoDown == "on") dbtn()},(pageLoadTime/1000));
  164. }