Greasy Fork镜像 支持简体中文。

MegaCloud Auto Password Decrypter

try to resolve password in mega cloud

安裝腳本?
作者推薦腳本

您可能也會喜歡 Kioskloud Auto Password Decrpter

安裝腳本
  1. // ==UserScript==
  2. // @name MegaCloud Auto Password Decrypter
  3. // @namespace MGDEC_V1
  4. // @version 1.0
  5. // @description try to resolve password in mega cloud
  6. // @author Laria
  7. // @match https://mega.nz/#P*
  8. // @match https://mega.io/#P*
  9. // @icon https://mega.nz/favicon.ico?v=3
  10. // @license MIT
  11. // @grant none
  12. // ==/UserScript==
  13. /*
  14. * == Change log ==
  15. * 1.0 - Release
  16. */
  17.  
  18. //utility
  19. const currentDate = new Date();
  20. function zeroPad(num, numZeros) {
  21. var n = Math.abs(num);
  22. var zeros = Math.max(0, numZeros - Math.floor(n).toString().length );
  23. var zeroString = Math.pow(10,zeros).toString().substr(1);
  24. if( num < 0 ) {
  25. zeroString = '-' + zeroString;
  26. }
  27. return zeroString+n;
  28. }
  29.  
  30. //script const db
  31. const mapdConstDB = {
  32. //password dictionary, input common password or your own password
  33. //you must change here.
  34. passwordDict: [
  35. 'password01',
  36. 'password02',
  37. 'password03',
  38. 'password04',
  39. 'password05',
  40. 'password06',
  41. ],
  42. //try to resolve decrypt time interval, def:50
  43. timeInterval: 50, //logging prefix
  44. logPrompt: {
  45. default: '['+GM.info.script.namespace+']',
  46. },
  47. };
  48.  
  49. //script internal db
  50. let mapdInternalDB = {
  51. elements: { //define after load
  52. container: null,
  53. passwordVisible: null,
  54. inputArea: null,
  55. decryptButton: null,
  56. megaBanner: null,
  57. decryptionProgress: null,
  58. },
  59. isValidation: false,
  60. };
  61.  
  62. //utility 2
  63.  
  64. const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
  65.  
  66. //https://stackoverflow.com/questions/5525071
  67. function waitForElm(selector) {
  68. return new Promise(resolve => {
  69. if (document.querySelector(selector)) {
  70. return resolve(document.querySelector(selector));
  71. }
  72.  
  73. const observer = new MutationObserver(mutations => {
  74. if (document.querySelector(selector)) {
  75. observer.disconnect();
  76. resolve(document.querySelector(selector));
  77. }
  78. });
  79.  
  80. // If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
  81. observer.observe(document.body, {
  82. childList: true,
  83. subtree: true
  84. });
  85. });
  86. }
  87.  
  88. //input given password and resolve it
  89. async function tryToDecrypt(pwd) {
  90. //remove modal valid msg
  91. await mapdInternalDB.elements.inputArea.dispatchEvent(new Event('input'));
  92. //fill password field
  93. mapdInternalDB.elements.inputArea.value = pwd;
  94. //click confirm
  95. await mapdInternalDB.elements.decryptButton.click();
  96. }
  97.  
  98. //await validation
  99. async function waitForValidation() {
  100. let timeCnt = 0;
  101. while(mapdInternalDB.isValidation) {
  102. if (timeCnt > 100) break;
  103. timeCnt ++;
  104. await delay(mapdConstDB.timeInterval);
  105. }
  106. }
  107.  
  108. //decrypt procedure
  109. async function decrypt() {
  110. //mutation observer - decrypt process
  111. const observer = new MutationObserver(function(mutations) {
  112. mutations.forEach(function(mutation) {
  113. mapdInternalDB.isValidation = !mutation.target.classList.contains('hidden');
  114. });
  115. });
  116.  
  117. observer.observe(mapdInternalDB.elements.decryptionProgress, {
  118. attributes: true,
  119. });
  120.  
  121. //pre-process
  122. await delay(50);
  123. //remove view
  124. await mapdInternalDB.elements.passwordVisible.click();
  125. //remove default input message
  126. mapdInternalDB.elements.inputArea.dispatchEvent(new Event('focus'));
  127.  
  128. //main process
  129. let tryCount = 0;
  130. const startTime = performance.now();
  131. for (let i = 0; i < mapdConstDB.passwordDict.length; i++) {
  132. window.console.log(mapdConstDB.logPrompt.default, 'no.', i, ', try:', mapdConstDB.passwordDict[i]);
  133. await tryToDecrypt(mapdConstDB.passwordDict[i]);
  134. if (i > 0) await waitForValidation();
  135. //correct password
  136. if (mapdInternalDB.elements.container.classList.contains('hidden')) {
  137. const endTime = performance.now();
  138. const durationSec = parseFloat((Math.ceil((endTime-startTime) * 100) / 100000).toFixed(2));
  139. window.console.log(mapdConstDB.logPrompt.default, 'decrypt finished.');
  140. window.console.log(mapdConstDB.logPrompt.default, 'expected password :', mapdConstDB.passwordDict[i]);
  141. window.console.log(mapdConstDB.logPrompt.default, 'tries:', tryCount, ', duration:', durationSec, 'sec');
  142. return;
  143. }
  144. tryCount ++;
  145. }
  146. const endTime = performance.now();
  147. const durationSec = parseFloat((Math.ceil((endTime-startTime) * 100) / 100000).toFixed(2));
  148. //if resolve failed,
  149. window.console.log(mapdConstDB.logPrompt.default, 'cannot find password in dict..');
  150. window.console.log(mapdConstDB.logPrompt.default, 'tries:', tryCount, ', duration:', durationSec, 'sec');
  151. //replace first dict password, show summary, focus input area
  152. await delay(50);
  153. mapdInternalDB.elements.inputArea.value = mapdConstDB.passwordDict[0];
  154. await delay(20);
  155. mapdInternalDB.elements.megaBanner.innerHTML = `<div><b>Auto Decryption Failed</b><br><i style="font-size: 82.5%;">Please input manually..</i><br><span style="font-size: 78.5%;">( tries: ${tryCount}, dur: ${durationSec} sec )</span></div>`;
  156. await mapdInternalDB.elements.inputArea.focus();
  157.  
  158. }
  159.  
  160. //register elements
  161. function registerElements() {
  162. mapdInternalDB.elements.container = document.querySelector('.password-dialog');
  163. mapdInternalDB.elements.passwordVisible = mapdInternalDB.elements.container.querySelector('.pass-visible');
  164. mapdInternalDB.elements.inputArea = mapdInternalDB.elements.container.querySelector('#password-decrypt-input');
  165. mapdInternalDB.elements.decryptButton = mapdInternalDB.elements.container.querySelector('.decrypt-link-button');
  166. mapdInternalDB.elements.megaBanner = mapdInternalDB.elements.container.querySelector('.mega-banner');
  167. mapdInternalDB.elements.decryptionProgress = mapdInternalDB.elements.container.querySelector('.decryption-in-progress');
  168. }
  169.  
  170. async function rootProcedure() {
  171. window.console.log(mapdConstDB.logPrompt.default,'V',GM.info.script.version, '-', GM.info.script.name);
  172. window.console.log(mapdConstDB.logPrompt.default, '- wait modal..');
  173. //await password modal
  174. await waitForElm('.password-dialog');
  175. window.console.log(mapdConstDB.logPrompt.default,'modal loaded, decrypt ready');
  176. //register modal elements
  177. registerElements();
  178. //decrypt start
  179. await decrypt();
  180. window.console.log(mapdConstDB.logPrompt.default,'task finished.');
  181. }
  182.  
  183. window.addEventListener('load', () => setTimeout(rootProcedure, 100));

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址