Moon Captcha v2 Solver

Moon Captcha Captcha Solver by @satology @vikiweb @stealtosvra.

目前为 2023-03-14 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Moon Captcha v2 Solver
  3. // @namespace moon.captcha.v2.solver
  4. // @version 0.5
  5. // @description Moon Captcha Captcha Solver by @satology @vikiweb @stealtosvra.
  6. // @author stealtosvra
  7. // @match *://*/*
  8. // @resource hashes https://stealtosvra.github.io/udImages/hashes32.json
  9. // @require https://unpkg.com/jimp@0.5.2/browser/lib/jimp.min.js
  10. // @icon https://stealtosvra.github.io/udImages/udp.png
  11. // @grant GM_getResourceText
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. 'use strict';
  17.  
  18. const captchaImgs = document.querySelectorAll('.rscapimg, .captchaOptions');
  19. const hashes = JSON.parse(GM_getResourceText('hashes'));
  20.  
  21. function readAsPng(base64Src) {
  22. return new Promise(resolve => {
  23. const base64Data = base64Src.replace(/^data:image\/png;base64,/, '');
  24. const buffer = Buffer.from(base64Data, 'base64');
  25. Jimp.read(buffer, (err, image) => {
  26. resolve(image);
  27. });
  28. });
  29. }
  30.  
  31. async function checkImages() {
  32. const promises = Array.from(captchaImgs).map(async (img, i) => {
  33. const image = await readAsPng(img.src);
  34. const hash = image.hash(32);
  35. console.log(`IMG Hash : ${i}: ${hash}`);
  36. const resp = hashes.filter(x => x === hash);
  37. if (resp.length > 0) {
  38. console.log(`Matched Hash : ${i}! ${resp}`);
  39. img.click()
  40. } else {
  41. console.log(`Not Upside Down! ${i}!`);
  42. }
  43. });
  44. await Promise.all(promises);
  45. console.log('end');
  46. setTimeout(function(){
  47. document.querySelector("button[type='submit']").click();}, 20000);}
  48.  
  49. checkImages();
  50. })();