To add a new website or protection system to the benchmark, follow these three steps:
1. Define the Target
Modify config/benchmark_targets.py to add a new Target object:
Target(
name="custom_site",
url="https://example.com",
check_function="check_custom_bypass",
description="Custom site protection test"
)
2. Implement the Check Function
Create a function in utils/targets/check_bypass (e.g., custom_bypass.py) that accepts a BrowserEngine and returns a boolean indicating if the bypass was successful (e.g., True if no captcha was found).
from engines.base import BrowserEngine
async def check_custom_bypass(engine: BrowserEngine) -> bool:
# Use engine.locator to find elements
element_found, element_html = await engine.locator('//div[@class="captcha"]')
return not element_found
3. Register the Checker
Add your new function to the checkers dictionary in config/benchmark_targets.py within the BypassTargetsSettings class:
checkers: Dict[str, Callable] = Field(
default_factory=lambda: {
"check_cloudflare_bypass": check_cloudflare_bypass,
"check_custom_bypass": check_custom_bypass,
}
)
from engines.base import BrowserEngine
async def check_custom_bypass(engine: BrowserEngine) -> bool:
element_found, element_html = await engine.locator('//div[@class="captcha"]')
return not element_found