Hcaptcha-challenger
是一个开源的 Python 软件包,旨在破译 hCaptcha 验证码系统。hCaptcha 是一种人机验证系统,被许多网站用于保护其服务免受恶意自动化行为的侵害。然而,这种保护机制对于某些合法用户来说可能过于繁琐。
Hcaptcha-challenger
通过使用机器学习和图像处理技术,可以自动分析和识别 hCaptcha 验证码,从而帮助用户绕过人机验证步骤。
Hcaptcha-challenger
使用先进的机器学习和图像处理技术来识别和破解 hCaptcha 验证码,从而为用户提供了一种简单而有效的解决方案。Hcaptcha-challenger
提供了多种识别模式,以满足不同用户的需求。Hcaptcha-challenger
提供客户端和服务器端两种使用方式,方便用户根据自己的需求选择。hcaptcha-challenger
软件包,并根据指示进行安装。pip insatll -U pip
pip install -U hcaptcha-challenger[playwright]
hcaptcha-challenger
,并进行初始化设置。# -*- coding: utf-8 -*-
# Time : 2023/9/2 3:30
# Author : QIN2DIM
# GitHub : https://github.com/QIN2DIM
# Description:
from __future__ import annotations
import asyncio
from pathlib import Path
from loguru import logger
from playwright.async_api import BrowserContext as ASyncContext, async_playwright
import hcaptcha_challenger as solver
from hcaptcha_challenger.agents import AgentT
from hcaptcha_challenger.utils import SiteKey
# Init local-side of the ModelHub
clip_available = True
solver.install(upgrade=True, clip=clip_available)
# Save dataset to current working directory
tmp_dir = Path(__file__).parent.joinpath("tmp_dir")
sitekey = SiteKey.user_easy
@logger.catch
async def hit_challenge(context: ASyncContext, times: int = 8):
page = await context.new_page()
agent = AgentT.from_page(page=page, tmp_dir=tmp_dir, self_supervised=clip_available)
await page.goto(SiteKey.as_sitelink(sitekey))
await agent.handle_checkbox()
for pth in range(1, times):
result = await agent.execute()
probe = list(agent.qr.requester_restricted_answer_set.keys())
question = agent.qr.requester_question
print(f">> {pth} - Challenge Result: {result} - {question=} {probe=}")
match result:
case agent.status.CHALLENGE_BACKCALL:
await page.wait_for_timeout(500)
fl = page.frame_locator(agent.HOOK_CHALLENGE)
await fl.locator("//div[@class='refresh button']").click()
case agent.status.CHALLENGE_SUCCESS:
return
async def bytedance():
# playwright install chromium --with-deps
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False)
context = await browser.new_context(locale="en-US")
await hit_challenge(context)
if __name__ == "__main__":
asyncio.run(bytedance())
hcaptcha-challenger
提供的识别函数,对提取的图像进行识别操作。该步骤将自动处理验证码图像并尝试破解其内容。创作不易分享,赞,在看,三连支持一波,感谢。↓↓↓