Files
grok-keygen/turnstilePatch/content.js
T
chaos c56d0d240a Add one-click start scripts for Linux and Windows
- start.sh: Linux/Mac one-click launcher
- start.bat: Windows one-click launcher
- Both scripts auto-detect/install:
  - Python 3.13+
  - uv package manager
  - Chrome/Chromium browser
  - Sync Python dependencies
  - Create .env/config.json from templates if missing
- Default to unlimited accounts (--count 0)
- Pass through CLI args for custom runs
2026-07-12 00:04:36 +08:00

71 lines
2.3 KiB
JavaScript

// Turnstile Patch - minimal only
// Full aggressive patches (chrome.runtime delete / permissions / plugins / languages
// / iframe postMessage spam) were observed to break xAI signup with:
// [permission_denied] HTTP 403
// Keep webdriver hide only. Auto-click remains best-effort and local-only.
(function () {
"use strict";
if (window.__grokStealthApplied) return;
window.__grokStealthApplied = true;
// 1. Hide navigator.webdriver (instance + prototype when possible)
try {
Object.defineProperty(navigator, "webdriver", {
get: function () {
return false;
},
configurable: true,
});
} catch (e) {}
try {
var desc = Object.getOwnPropertyDescriptor(Navigator.prototype, "webdriver");
if (!desc || desc.configurable) {
Object.defineProperty(Navigator.prototype, "webdriver", {
get: function () {
return false;
},
configurable: true,
});
}
} catch (e) {}
// 2. Best-effort Turnstile checkbox click (same-origin only; no postMessage spam)
function tryClickTurnstile() {
try {
var iframes = document.querySelectorAll(
'iframe[src*="challenges.cloudflare.com"], iframe[src*="turnstile"]'
);
for (var i = 0; i < iframes.length; i++) {
try {
var body = iframes[i].contentDocument || iframes[i].contentWindow.document;
var checkbox = body.querySelector('input[type="checkbox"], .mark');
if (checkbox && !checkbox.checked) {
checkbox.click();
}
} catch (e) {
// cross-origin: skip
}
}
} catch (e) {}
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", function () {
var n = 0;
var t = setInterval(function () {
n++;
tryClickTurnstile();
if (n > 80) clearInterval(t);
}, 500);
});
} else {
var n = 0;
var t = setInterval(function () {
n++;
tryClickTurnstile();
if (n > 80) clearInterval(t);
}, 500);
}
})();