Auto Click "I'm not a robot"

Automatically clicks the "I'm not a robot" checkbox and Solves CloudFlare Turnstile

目前为 2024-07-16 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Auto Click "I'm not a robot"
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.7
  5. // @description Automatically clicks the "I'm not a robot" checkbox and Solves CloudFlare Turnstile
  6. // @author JJJ
  7. // @match *://*/*
  8. // @icon https://pngimg.com/uploads/robot/robot_PNG96.png
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. // Define the delay between clicks (in milliseconds)
  17. const delayBetweenClicks = 100;
  18.  
  19. // Function to pause execution for a specified time
  20. function sleep(ms) {
  21. return new Promise(resolve => setTimeout(resolve, ms));
  22. }
  23.  
  24. // Function to simulate a click event
  25. function simulateClick(element) {
  26. const evt = new MouseEvent('click', {
  27. bubbles: true,
  28. cancelable: true,
  29. view: window
  30. });
  31. element.dispatchEvent(evt);
  32. }
  33.  
  34. // Function to find the reCAPTCHA checkbox element
  35. function findRecaptchaCheckboxElement() {
  36. return document.querySelector('.recaptcha-checkbox-border') ||
  37. document.querySelector('[role="checkbox"][aria-labelledby="recaptcha-anchor-label"]');
  38. }
  39.  
  40. // Function to click the reCAPTCHA checkbox
  41. async function clickRecaptchaCheckbox() {
  42. const recaptchaCheckboxElement = findRecaptchaCheckboxElement();
  43. if (recaptchaCheckboxElement) {
  44. simulateClick(recaptchaCheckboxElement);
  45. await sleep(delayBetweenClicks);
  46. }
  47. }
  48.  
  49. // Function to solve Cloudflare Turnstile challenges
  50. async function solveCloudflareTurnstile() {
  51. const challengeStage = document.querySelector('#challenge-stage');
  52. if (challengeStage) {
  53. const elements = challengeStage.querySelectorAll('*');
  54. for (const element of elements) {
  55. simulateClick(element);
  56. await sleep(50); // Small delay between clicks
  57. }
  58. }
  59. }
  60.  
  61. // Set up a mutation observer to detect when the reCAPTCHA or Turnstile is added to the page
  62. const observer = new MutationObserver((mutations) => {
  63. for (const mutation of mutations) {
  64. if (mutation.type === 'childList') {
  65. const checkbox = findRecaptchaCheckboxElement();
  66. if (checkbox) {
  67. simulateClick(checkbox);
  68. observer.disconnect();
  69. break;
  70. }
  71. solveCloudflareTurnstile(); // Attempt to solve Cloudflare Turnstile challenges
  72. }
  73. }
  74. });
  75.  
  76. // Start observing the document body for changes
  77. observer.observe(document.body, { childList: true, subtree: true });
  78.  
  79. // Try to click immediately on script load
  80. (async function () {
  81. await clickRecaptchaCheckbox();
  82. await solveCloudflareTurnstile();
  83. })();
  84.  
  85. // Set an interval to periodically attempt to click the reCAPTCHA checkbox and solve the Cloudflare Turnstile
  86. setInterval(async () => {
  87. await clickRecaptchaCheckbox();
  88. await solveCloudflareTurnstile();
  89. }, 1500);
  90.  
  91. })();