Auto Open CAPTCHA

Streamlines the process of engaging with CAPTCHA by automatically activating the verification checkbox.

  1. // ==UserScript==
  2. // @name Auto Open CAPTCHA
  3. // @description Streamlines the process of engaging with CAPTCHA by automatically activating the verification checkbox.
  4. // @version 1.0
  5. // @license GNU General Public License
  6. // @icon https://github.com/Gamby-1791/autoOpenCAPTCHA/raw/main/captcha.png
  7. // @match *://*/recaptcha/*
  8. // @grant none
  9. // @namespace https://greasyfork.org/users/1231264
  10. // ==/UserScript==
  11.  
  12. // Copyright (C) 2023
  13. //
  14. // This program is free software: you can redistribute it and/or modify
  15. // it under the terms of the GNU General Public License as published by
  16. // the Free Software Foundation, either version 3 of the License, or
  17. // (at your option) any later version.
  18. //
  19. // This program is distributed in the hope that it will be useful,
  20. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. // GNU General Public License for more details.
  23. //
  24. // You should have received a copy of the GNU General Public License
  25. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  26.  
  27. function qSelector(selector) {
  28. return document.querySelector(selector);
  29. }
  30.  
  31. (function() {
  32. 'use strict';
  33. var solved = false;
  34. var checkBoxClicked = false;
  35. var requestCount = 0;
  36. const MAX_ATTEMPTS = 1;
  37. const CHECK_BOX = ".recaptcha-checkbox-border";
  38. const AUDIO_BUTTON = "#recaptcha-audio-button";
  39. const PLAY_BUTTON = ".rc-audiochallenge-play-button .rc-button-default";
  40. const AUDIO_SOURCE = "#audio-source";
  41. const IMAGE_SELECT = "#rc-imageselect";
  42. const RESPONSE_FIELD = ".rc-audiochallenge-response-field";
  43. const AUDIO_ERROR_MESSAGE = ".rc-audiochallenge-error-message";
  44. const AUDIO_RESPONSE = "#audio-response";
  45. const RELOAD_BUTTON = "#recaptcha-reload-button";
  46. const RECAPTCHA_STATUS = "#recaptcha-accessible-status";
  47. const DOSCAPTCHA = ".rc-doscaptcha-body";
  48. const VERIFY_BUTTON = "#recaptcha-verify-button";
  49. var recaptchaInitialStatus = qSelector(RECAPTCHA_STATUS) ? qSelector(RECAPTCHA_STATUS).innerText : ""
  50. function isHidden(el) {
  51. return(el.offsetParent === null)
  52. }
  53. try {
  54. if(!checkBoxClicked && qSelector(CHECK_BOX) && !isHidden(qSelector(CHECK_BOX))) {
  55. //console.log("checkbox clicked");
  56. qSelector(CHECK_BOX).click();
  57. checkBoxClicked = true;
  58. }
  59. //Check if the captcha is solved
  60. if(qSelector(RECAPTCHA_STATUS) && (qSelector(RECAPTCHA_STATUS).innerText != recaptchaInitialStatus)) {
  61. solved = true;
  62. console.log("SOLVED");
  63. }
  64. if(requestCount > MAX_ATTEMPTS) {
  65. console.log("Attempted Max Retries. Stopping the solver");
  66. solved = true;
  67. }
  68. //Stop solving when Automated queries message is shown
  69. if(qSelector(DOSCAPTCHA) && qSelector(DOSCAPTCHA).innerText.length > 0) {
  70. console.log("Automated Queries Detected");
  71. }
  72. } catch(err) {
  73. console.log(err.message);
  74. console.log("An error occurred while solving. Stopping the solver.");
  75. }
  76. })();