Blog
如何使用CapSolver破解cloudflare5schallange

如何绕过/自动识别Cloudflare 5s challenge/5秒挑战验证码

Logo of Capsolver

CapSolver Blogger

How to use capsolver

26-May-2023

如何解决 Cloudflare 挑战

Capsolver 支持的挑战类型

  • 挑战 + 转门

  • 单独挑战

如果是挑战加验证码的情况,创建任务时无需添加特殊参数,因为我们将自动识别出需要解决的验证码。

如何解决 Cloudflare 挑战(5秒 IUAM)

在开始解决 Cloudflare 挑战之前,需要了解一些必要的要求和注意事项:
要求:

  • Capsolver 密钥
  • 代理

如果不遵循以下注意事项,解决方案将无效:

  • getTaskResult 方法返回的 Token 是你需要创建的 cf_clearance cookie 的值。
  • 必须使用 getTaskResult 返回的同一用户代理。
  • 必须使用解决挑战时使用的相同代理 IP。
  • 必须使用响应中的 cookies。
  • 必须使用响应中的 headers。
  • 使用 TLS chrome 120 版本。

要解决 Cloudflare 挑战,请遵循我们的文档某些参数是必需的,某些是可选的。
在这个示例中,我们只使用必需的参数。Cloudflare 的任务类型为:

  • AntiCloudflareTask:这种任务类型需要你自己的代理。

我们将使用 AntiCloudflareTask,因为该网站使用 Cloudflare 挑战 5s。
如果缺少任何参数或提交不正确,你可能会遇到网站不接受令牌的问题。你可以在这张图片中找到所有参数:

解决 Cloudflare 挑战 5s(cf_clearance)的任务对象结构

第一步:向 capsolver 提交信息

使用 createTask 方法提交所需信息:

POST https://api.capsolver.com/createTask

{
  "clientKey": "你的API密钥",
  "task": {
    "type": "AntiCloudflareTask",
    "websiteURL": "https://www.yourwebsite.com",
    "proxy": "158.120.100.23:334:user:pass"
  }
}

第二步:获取结果

你需要持续调用 getTaskResult API 端点,直到验证码被解决。

这里是一个示例请求:

POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json

{
    "clientKey":"你的API密钥",
    "taskId": "由 createTask 方法创建的任务ID"
}

一旦验证码成功解决,你将收到类似于下图所示的响应:

{
    "errorId": 0,
    "taskId": "d8d3a8b4-30cc-4b09-802a-a476ca17fa54",
    "status": "ready",
    "solution": {
        "accept-language": "en-US,en;q=0.9",
        "cookies": {

        },
        "headers": {
            "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
            "accept

-encoding": "gzip, deflate, br",
            "accept-language": "en-US,en;q=0.9",
            "cache-control": "max-age=0",
            "content-type": "application/x-www-form-urlencoded",
            "origin": "",
            "referer": "",
            "sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
            "sec-ch-ua-arch": "\"arm\"",
            "sec-ch-ua-bitness": "\"64\"",
            "sec-ch-ua-full-version": "\"120.0.6099.71\"",
            "sec-ch-ua-full-version-list": "\"Not_A Brand\";v=\"8.0.0.0\", \"Chromium\";v=\"120.0.6099.71\", \"Google Chrome\";v=\"120.0.6099.71\"",
            "sec-ch-ua-mobile": "?0",
            "sec-ch-ua-model": "\"\"",
            "sec-ch-ua-platform": "\"macOS\"",
            "sec-ch-ua-platform-version": "\"10.14.6\"",
            "sec-fetch-dest": "document",
            "sec-fetch-mode": "navigate",
            "sec-fetch-site": "same-origin",
            "sec-fetch-user": "?1",
            "upgrade-insecure-requests": "1",
            "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
        },
        "proxy": "你的代理",
        "token": "cf clearance 令牌",
        "type": "challenge",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
    }
}

通过提交响应中的 cf_clearance cookie 和 token 的值,使用解决挑战时的相同代理 IP、cookies、TLS chrome 120、headers 以及我们在响应中返回的相同用户代理,可以验证收到的验证码令牌。

⚠️ 如果令牌被拒绝,可能表明某些信息缺失或不正确。确保你正确提交令牌值到 cf_clearance cookie,使用解决挑战时的相同代理 IP,TLS chrome 120,响应的 headers 以及我们在响应中返回的相同用户代理。

如果你想解决 Cloudflare Turnstile 验证码,请参考这篇博客:链接

总之,尽管解决 Cloudflare 挑战可能看起来是一项艰巨的任务,capsolver.com 使过程迅速而高效。通过遵循上述步骤,你可以轻松解决 Cloudflare 问题。

Capsolver 团队 💜

More

How to solve Cloudflare Turnstile Captcha with Python
How to solve Cloudflare Turnstile Captcha with Python

In this article, we will show you how to solve cloudflare turnstile captcha with Python.

Cloudflare

13-May-2024

How to solve Cloudflare Turnstile Captcha with NodeJS
How to solve Cloudflare Turnstile Captcha with NodeJS

In this article, we will show you how to solve cloudflare turnstile captcha with NodeJS.

Cloudflare

13-May-2024

How to Solve Cloudflare when Web Scraping in 2024 | Step by Step Guide
How to Solve Cloudflare when Web Scraping in 2024 | Step by Step Guide

This blog post delves into effective techniques for solve these defenses with the help of CapSolver, a tool adept at resolving CAPTCHAs. From explaining Cloudflare's security protocols to providing practical strategies and code samples for circumventing these restrictions.

Cloudflare

07-May-2024

How to Solve Cloudflare in 2024: Solve Cloudflare Turnstile and Challenge By Using CapSolver
How to Solve Cloudflare in 2024: Solve Cloudflare Turnstile and Challenge By Using CapSolver

navigating Cloudflare's sophisticated security barriers like the Turnstile and Challenge CAPTCHA remains a critical task for many users. This blog post explores effective methods to bypass these protections using CapSolver, a tool designed for solving CAPTCHAs efficiently. Covering everything from understanding Cloudflare's security measures to practical strategies and code examples for overcoming the barriers, this guide is essential for anyone looking to access Cloudflare-protected sites without interruptions.

Cloudflare

07-May-2024

How to solve cloudflare captcha
How to solve cloudflare captcha | Solve cloudflare captcha

Cloudflare CAPTCHA serves as a vital security measure to protect websites from automated bots and ensure a safe browsing experience for users...

Cloudflare

19-Apr-2024

How to solve cloudflare turnstile and challenge 5s
How to solve cloudflare turnstile and challenge 5s in 2024 | Best Cloudflare solver

However, as a web user or developer, encountering these security measures can sometimes be a hindrance. This article will guide you...

Cloudflare

19-Apr-2024