cloudflare-turnstile-bypass README

README проекта с github.com/henryzawadzki6542/cloudflare-turnstile-bypass. Одним файлом markdown: README.md.

Peak - solve Cloudflare Turnstile & the 5s challenge in ~1s

Cloudflare Turnstile Bypass - How to Bypass the Turnstile Challenge in Python

Cloudflare Turnstile Bypass is a small, dependency-free Python package that bypasses the Cloudflare Turnstile challenge programmatically: it finds the Turnstile sitekey on any page, creates a valid cf-turnstile-response token via the Peak API, and hands you the finished token - no browser, no headless Chrome, no fingerprint fight. Designed for CI pipelines, QA automation, and integration engineering.

Get Free 1000 Solves   Pricing   Read the docs

Table of Contents:

What "bypassing Turnstile" actually means

Cloudflare Turnstile is a challenge widget that issues a signed token. A "bypass" never attacks Cloudflare's edge - that is not practical or legal. What works, and what this package does, is:

  1. find the sitekey the target page is protecting itself with,
  2. solve the challenge for that sitekey through a solving service, and
  3. inject the resulting token into your request exactly like a browser would after completing the widget.

To Cloudflare's backend your request now carries a valid, signed, non-expired cf-turnstile-response - which is the entire contract the widget enforces. That is the bypass.

Quick start

$ export PEAK_API_KEY=pk_your_api_key
$ python -m cloudflare_turnstile_bypass --url https://example.com/
0.AgAAABBqzz...

Or find the sitekey first, then bypass:

from cloudflare_turnstile_bypass import find_sitekey, bypass_turnstile

sitekey = find_sitekey("https://example.com/")
token = bypass_turnstile("pk_...", sitekey, "https://example.com/")
print(token)  # -> "0.AgAAABBqzz..."

Finding a Turnstile sitekey

Turnstile widgets expose the sitekey in the markup:

<div class="cf-turnstile" data-sitekey="0x4AAAAAAAxxxx"></div>

find_sitekey() reads it for you:

from cloudflare_turnstile_bypass import find_sitekey

sitekey = find_sitekey("https://example.com/")
print(sitekey)  # -> "0x4AAAAAAAxxxx"

Invisible (enterprise) widgets render the same attribute; if a page builds the widget from JavaScript instead, the regex also matches sitekey= and render= in the bundle source.

Bypassing the challenge

from cloudflare_turnstile_bypass import bypass_turnstile

token = bypass_turnstile(
    "pk_your_api_key",          # your Peak key (free, no card)
    "0x4AAAAAAAxxxx",           # the sitekey you found
    "https://example.com/",     # the page URL the widget lives on
)
# token is a valid cf-turnstile-response value

With a proxy (the solve runs on residential infrastructure, so the token matches your exit IP region):

token = bypass_turnstile(
    "pk_your_api_key",
    "0x4AAAAAAAxxxx",
    "https://example.com/",
    proxy="http://user:pass@proxy:8080",
)

Python API reference

Function Purpose
read_page(url) Fetch a page's HTML (plain urllib, no dependencies).
find_sitekey(url) Extract the Turnstile sitekey from a page or HTML string.
find_action(html) Extract an optional data-action value.
bypass_turnstile(api_key, sitekey, url) Solve the challenge and return a ready token.
token_for_page(api_key, url) Find + bypass in a single call, returns BypassResult.

BypassResult carries .token, .sitekey, and the raw solver response.

CLI usage

$ python -m cloudflare_turnstile_bypass --url https://example.com/login
0.AgAAABBqzz...

$ python -m cloudflare_turnstile_bypass --url https://example.com/login --proxy http://user:pass@proxy:8080

Exit code 0 + the token on stdout - pipe it straight into curl or your E2E test harness.

Examples

See examples/submit_bypass.py for an end-to-end flow: find the sitekey, bypass the challenge, and POST the token with your form payload.

Why a solver beats headless browsers

FAQ

Does this attack Cloudflare's edge?

No. It solves the widget's challenge for the page's sitekey through the Peak API and injects the resulting token into your request - exactly what the edge sees after a real visitor completes the widget.

Does it work with invisible or enterprise widgets?

Yes. Invisible widgets render the same data-sitekey attribute, and the sitekey regex also matches sitekey= and render= when the widget is built from JavaScript. If you already know the sitekey, pass it directly and skip the discovery step.

Do I need Selenium or a headless browser?

No. There is no browser anywhere in the flow - one dependency-free Python file. That is also why there is no fingerprint to fight and nothing to keep patched when Chromium changes.

Where do I get an API key?

Create a free key at Peak - no card required, and it starts with 1,000 free solves. Use code PEAKGH for bonus trial credit.

This package uses Peak to solve Turnstile.

  • Solve Cloudflare Turnstile & the 5s challenge in about a second
  • Pay only for successful solves - from $0.8 / 1,000
  • 1,000 free solves to start - no card. Grab 1,000 free solves

Get your free API key · Docs · Pricing


Want your service to rank higher on GitHub?

Get your product or repository into the top 1–5 search results for your keywords:

Message me on Telegram and I'll share the details:

Telegram - @AlpinTamhas928

License

MIT - see LICENSE.

Finding the sitekey on a saved page

examples/find_sitekey.py scans a page you already have and prints each sitekey with the attribute it matched.

cloudflare-turnstile-bypass (henryzawadzki6542/cloudflare-turnstile-bypass)

Ищем в базе…

Что это?Python-библиотека и CLI без зависимостей, которые находят sitekey Cloudflare Turnstile на странице и решают капчу через сторонний API, отдавая вам валидный токен cf-turnstile-response для ваших запросов.
Это самостоятельный решатель или обёртка над платным сервисом?Это тонкая Python-библиотека (плюс CLI), которая лишь находит sitekey и формирует запрос; само решение выполняет платный сторонний сервис Peak, а не этот пакет.
Как с его помощью получить токен?Вызовите findsitekey(url), чтобы извлечь sitekey, затем bypassturnstile(apikey, sitekey, url), чтобы решить капчу, или используйте tokenforpage(apikey, url), чтобы сделать всё одним вызовом; CLI печатает токен прямо в stdout, чтобы передавать его в curl или тестовый стенд по конвейеру.
Нужен ли API-ключ Peak?Да, чтобы реально решить капчу, нужен API-ключ Peak; Peak даёт 1 000 бесплатных решений на старте без карты, дальше — от $0.8 за 1 000 решений.
Он напрямую атакует серверы Cloudflare?Нет. В проекте прямо сказано, что он никогда не атакует инфраструктуру Cloudflare; он лишь находит sitekey, поручает Peak решить конкретную капчу и подставляет полученный подписанный токен в ваш запрос, как это обычно делает браузер.
Почему бы просто не использовать headless-браузер вроде Selenium или Playwright?Turnstile снимает отпечаток окружения браузера, и headless Chrome с CDP-автоматизацией — ровно то, что он создан распознавать. Этот пакет вообще обходится без браузера, ему не нужен соответствующий билд Chromium в CI, а платите вы только за успешные решения, а не жжёте вычисления на провальные headless-прогоны.
Что такое Peak?Peak — внешний сервис решений, который вызывает эта библиотека, чтобы действительно пройти капчу Turnstile. Он заявляет решение Turnstile и «5-секундной капчи» примерно за секунду, используя инфраструктуру residential-IP.
Можно пускать решение через прокси?Да, bypassturnstile принимает прокси, чтобы решение шло на residential-инфраструктуре, совпадающей с регионом вашего выходного IP, — география токена остаётся согласованной с запросом, который вы отправите.
Работает ли он с невидимыми/enterprise-виджетами Turnstile?Да, findsitekey обрабатывает и невидимые (enterprise) виджеты, так как у них тот же атрибут sitekey, а если виджет строится динамически, срабатывает фолбэк — поиск по регулярным выражениям sitekey= и render= в JavaScript-бандле страницы.
Какие есть похожие проекты?nopecha-extension, botasaurus, turnstile-bypass, cfsolve, puppeteer, SeleniumBase, CloakBrowser, grok-register
Размер
0.5 MB
Звёзды
325
Обновлён
КоммитOct 12
Возраст
2 мес
Коммиты · 90 дней