您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Solves Cloudflare Turnstile using 2Captcha
当前为
- // ==UserScript==
- // @name Cloudflare Turnstile Bypass with 2Captcha
- // @namespace http://yourdomain.com/
- // @version 1.0
- // @description Solves Cloudflare Turnstile using 2Captcha
- // @match *://*/*
- // @grant none
- // ==/UserScript==
- (async function () {
- 'use strict';
- const API_KEY = '4429633d0beca8b7e7142514e2965e57'; // <-- আপনার 2Captcha API key
- const PAGE_URL = window.location.href;
- function getSiteKey() {
- const iframe = document.querySelector('iframe[src*="turnstile"]');
- if (!iframe) return null;
- const url = new URL(iframe.src);
- return url.searchParams.get('sitekey');
- }
- const sitekey = getSiteKey();
- if (!sitekey) {
- console.log('No Turnstile found');
- return;
- }
- console.log('Turnstile CAPTCHA found — requesting 2Captcha...');
- // Step 1: Send CAPTCHA solve request
- const reqURL = `https://2captcha.com/in.php?key=${API_KEY}&method=turnstile&sitekey=${sitekey}&pageurl=${encodeURIComponent(PAGE_URL)}&json=1`;
- const req = await fetch(reqURL);
- const reqData = await req.json();
- if (reqData.status !== 1) {
- console.error('2Captcha request failed:', reqData.request);
- return;
- }
- const captchaId = reqData.request;
- // Step 2: Poll result every 5 sec
- async function pollResult() {
- const res = await fetch(`https://2captcha.com/res.php?key=${API_KEY}&action=get&id=${captchaId}&json=1`);
- const resData = await res.json();
- if (resData.status === 1) {
- return resData.request;
- } else if (resData.request === 'CAPCHA_NOT_READY') {
- console.log('Waiting for CAPTCHA solve...');
- await new Promise(r => setTimeout(r, 5000));
- return await pollResult();
- } else {
- console.error('2Captcha error:', resData.request);
- return null;
- }
- }
- const token = await pollResult();
- if (token) {
- console.log('CAPTCHA solved, token:', token);
- // Fill token to response field if found
- const input = document.querySelector('input[name="cf-turnstile-response"]');
- if (input) {
- input.value = token;
- const form = input.closest('form');
- if (form) {
- form.submit(); // Auto-submit if possible
- }
- } else {
- console.warn('No input field found for Turnstile response');
- }
- }
- })();
- const axios = require('axios');
- // API Key from 2Captcha (আপনারটা এখানে বসান)
- const API_KEY = '4429633d0beca8b7e7142514e2965e57';
- // CAPTCHA site key ও target URL (এগুলো আপনার পেজ অনুযায়ী বসাতে হবে)
- const SITE_KEY = 'YOUR_SITE_KEY_HERE';
- const PAGE_URL = 'https://example.com'; // যেই পেজে CAPTCHA আছে
- // Step 1: CAPTCHA Solve Request পাঠানো
- async function requestCaptchaSolution() {
- try {
- const res = await axios.post('http://2captcha.com/in.php', null, {
- params: {
- key: API_KEY,
- method: 'turnstile', // যদি Turnstile হয়, নাহলে 'userrecaptcha'
- sitekey: SITE_KEY,
- pageurl: PAGE_URL,
- json: 1
- }
- });
- if (res.data.status === 1) {
- console.log('Captcha ID:', res.data.request);
- return res.data.request;
- } else {
- throw new Error('CAPTCHA request failed: ' + res.data.request);
- }
- } catch (err) {
- console.error('Error requesting CAPTCHA:', err.message);
- }
- }
- // Step 2: সলিউশন পাওয়ার জন্য Wait ও Poll করা
- async function getCaptchaResult(captchaId) {
- try {
- while (true) {
- const res = await axios.get('http://2captcha.com/res.php', {
- params: {
- key: API_KEY,
- action: 'get',
- id: captchaId,
- json: 1
- }
- });
- if (res.data.status === 1) {
- console.log('CAPTCHA Solved:', res.data.request);
- return res.data.request;
- } else if (res.data.request === 'CAPCHA_NOT_READY') {
- console.log('Waiting for solution...');
- await new Promise(r => setTimeout(r, 5000));
- } else {
- throw new Error('Error getting CAPTCHA result: ' + res.data.request);
- }
- }
- } catch (err) {
- console.error('Error getting solution:', err.message);
- }
- }
- // Full Flow
- (async () => {
- const captchaId = await requestCaptchaSolution();
- if (captchaId) {
- const solution = await getCaptchaResult(captchaId);
- console.log('\nUse this token in your request:', solution);
- // এখানে আপনি এই টোকেন দিয়ে যেই রিকুয়েস্ট করবেন সেটি তৈরি করতে পারেন।
- }
- })();