Skip to main content

Professional Python library for bypassing Cloudflare protection without external services

Project description

CloudflareBypasser

A professional Python library for bypassing Cloudflare protection mechanisms without relying on external paid services, with optional support for captcha solving APIs.

Features

  • Free operation - Uses proprietary techniques without external services
  • Optional API support - Integration with 2captcha, anticaptcha, capmonster, and others
  • Human behavior simulation - Advanced behavioral patterns
  • Fingerprint spoofing - Browser fingerprint randomization
  • Multiple strategies - Various bypass techniques with automatic fallbacks
  • Robust architecture - Built-in retry mechanisms and error handling
  • Simple API - Clean and intuitive interface

Installation

# Basic installation
pip install cloudflare-bypasser

# With advanced dependencies
pip install cloudflare-bypasser[advanced]

# With machine learning support
pip install cloudflare-bypasser[ml]

# Complete installation
pip install cloudflare-bypasser[advanced,ml]

Quick Start

Basic Usage (Free)

from cloudflare_bypass import CloudflareBypasser

# Simple usage
with CloudflareBypasser() as bypasser:
    success = bypasser.bypass_url("https://example.com")
    if success:
        print("Bypass successful")
        print(f"Title: {bypasser.get_title()}")
        print(f"URL: {bypasser.get_current_url()}")

With API Key (More Reliable)

from cloudflare_bypass import CloudflareBypasser

# With captcha service
bypasser = CloudflareBypasser(
    captcha_service="2captcha",  # or "anticaptcha", "capmonster"
    api_key="your_api_key_here"
)

with bypasser:
    success = bypasser.bypass_url("https://protected-site.com")
    if success:
        page_source = bypasser.get_page_source()
        # Continue with your logic

Advanced Configuration

from cloudflare_bypass import CloudflareBypasser, BypassConfig, BypassMode

# Custom configuration
config = BypassConfig(
    mode=BypassMode.STEALTH,
    headless=True,
    simulate_human=True,
    enable_fingerprint_spoofing=True,
    captcha_service="anticaptcha",
    api_key="your_api_key",
    timeout=90,
    max_retries=3
)

with CloudflareBypasser(config=config) as bypasser:
    success = bypasser.bypass_url("https://difficult-site.com")

Predefined Configurations

from cloudflare_bypass import CloudflareBypasser, STEALTH_CONFIG, FAST_CONFIG

# Stealth mode
with CloudflareBypasser(config=STEALTH_CONFIG) as bypasser:
    success = bypasser.bypass_url("https://example.com")

# Fast mode
with CloudflareBypasser(config=FAST_CONFIG) as bypasser:
    success = bypasser.bypass_url("https://example.com")

Advanced Examples

Processing Multiple URLs

from cloudflare_bypass import CloudflareBypasser

urls = [
    "https://site1.com",
    "https://site2.com", 
    "https://site3.com"
]

with CloudflareBypasser(captcha_service="2captcha", api_key="key") as bypasser:
    for url in urls:
        print(f"Processing: {url}")
        if bypasser.bypass_url(url):
            print(f"Success: {bypasser.get_title()}")
        else:
            print(f"Failed: {url}")

Using Proxy

config = BypassConfig(
    proxy="http://proxy:port",
    proxy_auth={"username": "user", "password": "pass"},
    captcha_service="capmonster",
    api_key="your_key"
)

with CloudflareBypasser(config=config) as bypasser:
    success = bypasser.bypass_url("https://example.com")

Error Handling

from cloudflare_bypass import CloudflareBypasser, CloudflareBypassError, DriverError

try:
    with CloudflareBypasser() as bypasser:
        success = bypasser.bypass_url("https://example.com")
        
        if success:
            element = bypasser.find_element("css selector", ".some-class")
            
except DriverError as e:
    print(f"Driver error: {e}")
except CloudflareBypassError as e:
    print(f"Bypass error: {e}")
except Exception as e:
    print(f"General error: {e}")

Configuration

Supported Captcha Services

Service Approximate Cost Speed Accuracy
2captcha $2.99/1k Medium High
anticaptcha $2.00/1k High Very High
capmonster $1.60/1k Very High High
deathbycaptcha $1.39/1k Medium Medium

Bypass Modes

  • AUTO: Automatically detects the best method
  • STEALTH: Stealth mode with advanced techniques
  • AGGRESSIVE: Aggressive mode for difficult cases
  • MINIMAL: Fast mode for simple cases

Performance

Challenge Type Success Rate Average Time
JS Challenge 85-95% 5-15s
Simple Turnstile 70-85% 10-30s
Complex Turnstile 40-60% 30-60s
With API Service 95-99% 15-45s

Command Line Interface

# Basic bypass
cloudflare-bypasser bypass "https://example.com"

# With configuration
cloudflare-bypasser bypass "https://example.com" --mode stealth --headless

# With API key
cloudflare-bypasser bypass "https://example.com" --captcha-service 2captcha --api-key "your_key"

# Save results
cloudflare-bypasser bypass "https://example.com" --output page.html --screenshot shot.png

# Show package info
cloudflare-bypasser info

# Run tests
cloudflare-bypasser test

Development

Development Installation

git clone https://github.com/yourusername/cloudflare-bypass.git
cd cloudflare-bypass
pip install -e .[dev,advanced,ml]

Running Tests

pytest tests/
pytest --cov=cloudflare_bypass tests/

Code Quality

black cloudflare_bypass/
flake8 cloudflare_bypass/
mypy cloudflare_bypass/

Legal Considerations

  • Research and testing purposes
  • Automation of your own websites
  • Educational purposes
  • Respect terms of service
  • No malicious activities
  • No unauthorized scraping

Use this library responsibly and respect website terms of service.

Contributing

Contributions are welcome. Please:

  1. Fork the project
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

Changelog

See CHANGELOG.md for a complete list of changes and version history.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudflare_bypasser-1.0.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloudflare_bypasser-1.0.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file cloudflare_bypasser-1.0.0.tar.gz.

File metadata

  • Download URL: cloudflare_bypasser-1.0.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for cloudflare_bypasser-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b327a6735c40a2753305b35af3a5d560e578fed641737700a541fa1d004efe1e
MD5 e222e5b0130797b9e5fab900f07eb2a3
BLAKE2b-256 18eb7e9e4c6eae2ca50f66a87576b128147c25ab160c70cc5cd230304d58f3e3

See more details on using hashes here.

File details

Details for the file cloudflare_bypasser-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudflare_bypasser-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6cfafbf3ae0536cc6265aac3038c516892d8d2f56e48b6d50790eadb74b54d73
MD5 1a728f02b048baf75ecebdc2221ae10e
BLAKE2b-256 1ca79d189343d3f4153cdb3d4e7071325cc51673def1bb834cd9376f588aec51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page