CloakBrowser

repository·main·Indexed 12 days ago

https://github.com/cloakhq/cloakbrowser

A stealth Chromium replacement and drop-in Playwright replacement designed to bypass advanced anti-bot detection. It applies 71+ patches directly to the Chromium C++ source code to modify fingerprints (GPU, WebGL, WebRTC) at the binary level. Features include a transparent humanization layer for realistic mouse movements (Bezier curves), typing, and scrolling, as well as support for pinning specific Chromium versions and GeoIP resolution.

Tokens
43.7K
Snippets
128
Records
181
Agent score
97%

What's inside CloakBrowser

  1. Understand the CloakBrowser Binary License

    main

    The CloakBrowser Binary License governs the use of the compiled CloakBrowser Chromium browser binary ("Binary") distributed by CloakHQ.

    Key Distinctions:

    • The Binary: Proprietary software distributed via GitHub Releases or cloakbrowser.dev. Use of the Binary is subject to this license.
    • The Wrapper Source Code: The source code in the repository is licensed under the MIT License and is separate from the Binary license.

    By downloading, installing, or using the Binary, you agree to these terms. The Binary is built on Chromium (BSD 3-Clause) and ungoogled-chromium components.

  2. Configure license validation and session monitoring

    main
    CloakBrowser includes minimal operational communications required for license validation and monitoring the number of concurrently open sessions. The binary is built on ungoogled-chromium, which removes Google-specific services and telemetry. Any other network activity is attributed to normal browser operation, Chromium subsystems, user configuration, extensions, or the web pages being accessed, rather than CloakHQ telemetry services.
  3. Verify CloakBrowser binary authenticity

    main
    To ensure security, CloakBrowser binary downloads are verified against a pinned Ed25519 signature on the published checksums before extraction. This ensures the binary is authentic and has not been tampered with by a compromised mirror.
  4. Understand the Humanize Layer mechanics

    main

    The humanize layer simulates realistic user behavior through several specialized mechanisms:

    Mouse Motion

    Uses a cubic Bezier curve with perpendicular control points to avoid straight lines. It includes sinusoidal wobble, cubic ease-in-out motion, and a chance of overshooting the target and correcting back.

    Keyboard & Stealth

    • ASCII Characters: Typed one by one with variable delays and occasional "thinking" pauses. Includes a chance for fat-finger typos (nearby QWERTY keys) that are automatically corrected.
    • Stealth Path: For Shift symbols (e.g., @, #), the layer uses the Chrome DevTools Protocol (Input.dispatchKeyEvent) when a CDP session is available. This produces isTrusted = true events without an evaluate stack trace, making them harder for detectors to find.
    • Non-ASCII Characters: Characters like Cyrillic or Emojis are inserted via InsertText to ensure compatibility, while ASCII characters continue using physical key simulation.

    Scrolling

    Simulates an accelerate -> cruise -> decelerate sequence using microsteps, with an optional overshoot and a final settle within a natural viewport band (ScrollTargetZone).

  5. Enable Human Behavior simulation

    main

    Setting humanize: true (JS) or humanize=True (Python) makes all mouse, keyboard, and scroll interactions indistinguishable from real users. This automatically replaces standard automation calls with human-like equivalents (e.g., Bézier curves for mouse movement, per-character typing with pauses, and realistic scrolling).

    Presets

    • default: Normal speed.
    • careful: Slower, more deliberate movements with idle micro-movements between actions.

    Custom Configuration

    You can override specific parameters via humanConfig (JS) or human_config (Python).

    Important for Playwright users: Always use selector-based methods like page.click(selector), page.type(selector, text), or the Locator API. Avoid page.query_selector() because ElementHandle objects bypass the humanization patches, causing mouse movements to teleport and keyboard events to fire without timing.

    // Playwright example
    import { launch } from 'cloakbrowser';
    const browser = await launch({ 
      humanize: true, 
      humanPreset: 'careful',
      humanConfig: {
        mistype_chance: 0.05,
        typing_delay: 100,
        idle_between_actions: true,
        idle_between_duration: [0.3, 0.8],
      }
    });
  6. Determine if you need an OEM/SaaS license

    main

    Whether you need a specialized OEM/SaaS license depends on how the browser is exposed to third parties.

    Permitted Internal Use (No OEM/SaaS license required)

    You can use the Binary for internal business workflows (web scraping, data extraction, automation, research) without an OEM/SaaS license, even if you run it in Docker, CI runners, or internal repositories, provided:

    • You control the browsing process and execution environment.
    • You do not give third parties control over the browser itself.
    • You are delivering a business output (e.g., a report or dataset) rather than providing the browser capability.
    • Listing CloakBrowser as a dependency in your project is permitted and does not constitute redistribution.

    OEM/SaaS License Required

    A separate agreement is required if the Binary is:

    • Bundled, embedded, or exposed through an API.
    • Used to provide browser functionality, hosted-service, or "browser-as-a-service" to third-party customers.
    • Used in a way that gives third-party customers control (the ability to operate, configure, manage, or influence the Binary, its sessions, or execution settings).

    For OEM/SaaS licensing inquiries, contact info@cloakbrowser.dev.

  7. Subscription requirements for CloakBrowser Binary versions

    main

    Access to CloakBrowser versions is determined by their release status:

    • Latest Major Versions: Downloading and using the latest major Binary version requires an active paid subscription at the tier designated by CloakHQ.
    • Older or Free Versions: Binary versions made available without a subscription, or older versions lawfully obtained, remain subject to the full terms of this license but do not require an active paid subscription.

    Subscription tiers and pricing are managed at https://cloakbrowser.dev.

  8. Manage browser fingerprints for stealth

    main

    CloakBrowser is stealthy by default. It automatically generates a random fingerprint seed at startup to spoof GPU, hardware specs, screen dimensions, canvas, WebGL, audio, and fonts. This ensures every launch produces a fresh, coherent identity.

    Fingerprint Modes

    ModeBehavior
    Default (No flags)A random seed is auto-generated. All detectable values are spoofed automatically.
    Deterministic (--fingerprint=seed)Uses a specific seed to create a consistent identity. Use this for session persistence (e.g., appearing as a returning visitor to reCAPTCHA v3 Enterprise).
    Hybrid (--fingerprint=seed + explicit flags)The seed handles most values, but explicit flags override specific auto-generated values.

    Platform Spoofing

    The binary detects its host platform at compile time. However, the wrapper overrides this on Linux by passing --fingerprint-platform=windows to make sessions appear as Windows desktops, which are more common and harder to cluster. You can use --fingerprint-platform to manually specify the target OS.

    # Pin a seed for a persistent identity
    browser = launch(args=["--fingerprint=42069"])
  9. Understand CloakBrowser licensing and versions

    main

    CloakBrowser has different licensing models depending on the version of the binary used:

    Wrapper Code

    The Python, JS, and .NET wrappers are licensed under MIT and are free to use.

    Binary (Compiled Chromium)

    • v146 and earlier: Free for personal and commercial use. Redistribution is not allowed (OEM/SaaS licenses are required for third-party services).
    • v148 and later: Requires an active CloakBrowser Pro subscription to download.

    Free Access for Latest Builds

    You can access the latest build for free by signing in with GitHub via cloakbrowser login or at cloakbrowser.dev/free. This provides one concurrent session. Paid subscriptions increase this limit.

  10. Licensing for CloakBrowser on AWS Lambda

    main

    The patched Chromium binary included in the cloakhq/cloakbrowser upstream image is governed by the CloakBrowser Binary License.

    Usage Rights

    • Free Use: Internal organizational use is permitted. This includes using the binary within a private ECR, your own scraping pipelines, or for your own business operations.
    • Paid API/SaaS Restriction: If you intend to expose this Lambda as a paid API to third-party customers (e.g., providing 'browser-as-a-service'), you must obtain an OEM/SaaS license from CloakHQ (cloakhq@pm.me).

    Prohibited Actions

    • Redistribution: Do not push the resulting Docker image to a public registry. This is considered redistribution and is strictly prohibited.
  11. How the humanize decorator layer works

    main

    Because .NET's Playwright uses sealed interfaces (like IPage, ILocator, IMouse), CloakBrowser cannot use runtime monkey-patching. Instead, it uses a transparent decorator layer powered by a Roslyn source generator ([GenerateInterfaceDelegation]).

    When you set Humanize = true at launch:

    1. NewPageAsync() or NewContextAsync() returns a wrapped object (e.g., HumanizedPage).
    2. Standard Playwright calls (e.g., page.ClickAsync, page.FillAsync, page.Mouse.MoveAsync) are intercepted and passed through the humanize engine.
    3. Non-intercepted members are delegated verbatim to the underlying raw IPage.

    This ensures that your code remains fully statically typed with no reflection on the hot path and requires no changes to your existing Playwright logic.

  12. Understand how CloakBrowser works

    main

    CloakBrowser is a thin wrapper (Python + JavaScript) around a custom-built Chromium binary. The stealth mechanism works as follows:

    1. Installation: Install via pip or npm.
    2. Binary Provisioning: On the first launch, the appropriate Chromium binary (e.g., Chromium 146) is automatically downloaded for your platform.
    3. Execution: When you launch Playwright or Puppeteer, it uses the CloakBrowser binary along with specific stealth arguments.
    4. Stealth Implementation: The binary includes 71 source-level patches (covering canvas, WebGL, audio, fonts, GPU, screen properties, WebRTC, network timing, hardware reporting, automation signal removal, and CDP input behavior mimicking). These patches are compiled into the C++ source of the Chromium binary rather than being injected via JavaScript or set via flags, making them significantly harder to detect.