Stealth Chromium that passes every bot detection test. Drop-in Playwright replacement with source-level fingerprint patches. 50+ tests passed.
Python ai-agentsanti-detectantidetect-browserbot-detectionbrowser-automationcaptcha-bypasschromiumcloudflarecloudflare-bypassfingerprintheadless-browserplaywrightpuppeteerpythonrecaptchaseleniumstealth-browserundetectedweb-scrapingwebscraping
fix(cli): don't launch the binary for Windows info
CloakHQ3af6210134ad
diff --git a/README.md b/README.mdindex 941fd0c..5678757 100644--- a/README.md+++ b/README.md@@ -727,9 +727,9 @@ Every `launch()` call sets these automatically. The **wrapper** applies platform| `--fingerprint` | Random (10000–99999) | Random (10000–99999) | Master seed for canvas, WebGL, audio, fonts || `--fingerprint-platform` | `windows` | `macos` | `navigator.platform`, User-Agent OS, GPU pool selection |-The binary auto-generates everything else from the seed: GPU, hardware concurrency, device memory, and screen dimensions. Each seed produces a unique, consistent fingerprint. Override with explicit flags if needed.+The binary auto-generates everything else from the seed: GPU, hardware concurrency, device memory, and screen dimensions. Each seed produces a unique, consistent fingerprint: those values are drawn together as one coherent package. Keep the seed as the source of identity, since changing single values by hand can break that coherence.-> **Using the binary directly?** It works out of the box with zero flags -- the binary auto-spoofs everything. Pass `--fingerprint=seed` for a persistent identity, or use explicit flags like `--fingerprint-gpu-renderer` to override any auto-generated value.+> **Using the binary directly?** It works out of the box with zero flags -- the binary auto-spoofs everything. Pass `--fingerprint=seed` for a persistent identity: the seed derives every value as one coherent package.### Additional Flags@@ -737,8 +737,7 @@ Supported by the binary but **not set by default** — pass via `args` to custom| Flag | Controls ||------|----------|-| `--fingerprint-gpu-vendor` | WebGL `UNMASKED_VENDOR_WEBGL` (auto-generated from seed + platform) |-| `--fingerprint-gpu-renderer` | WebGL `UNMASKED_RENDERER_WEBGL` (auto-generated from seed + platform) |+| `--fingerprint-gpu-vendor` | **Switch the GPU family** — `NVIDIA` or `Intel`. The binary reports the matching Chrome vendor value, `Google Inc. (NVIDIA)` or `Google Inc. (Intel)`. Auto-generated from seed + platform when unset || `--fingerprint-hardware-concurrency` | `navigator.hardwareConcurrency` (auto-generated: `8`) || `--fingerprint-device-memory` | `navigator.deviceMemory` in GB (auto-generated: `8`) || `--fingerprint-screen-width` | Screen width (auto-generated: `1920` Win/Linux, `1440` macOS) |@@ -825,10 +824,10 @@ browser = launch(stealth_args=False, args=["--fingerprint-platform=windows",])-# Override GPU to look like a specific machine+# Switch the GPU familybrowser = launch(args=[- "--fingerprint-gpu-vendor=Intel Inc.",- "--fingerprint-gpu-renderer=Intel Iris OpenGL Engine",+ "--fingerprint=42069",+ "--fingerprint-gpu-vendor=Intel",])```@@ -1056,7 +1055,7 @@ b4 = pw.chromium.connect_over_cdp()```-Supported query params: `fingerprint`, `timezone`, `locale`, `platform`, `platform-version`, `brand`, `brand-version`, `gpu-vendor`, `gpu-renderer`, `hardware-concurrency`, `device-memory`, `screen-width`, `screen-height`, `proxy`, `geoip`. Same seed reuses the same process (first connection's params win). No seed = shared default process (backward compatible).+Supported query params: `fingerprint`, `timezone`, `locale`, `platform`, `platform-version`, `brand`, `brand-version`, `gpu-vendor`, `hardware-concurrency`, `device-memory`, `screen-width`, `screen-height`, `proxy`, `geoip`. Same seed reuses the same process (first connection's params win). No seed = shared default process (backward compatible).By default, per-seed processes stay alive until `cloakserve` exits; idle cleanup is disabled (`0`). If clients create many unique seeds, set `--idle-timeout=SECONDS` or `CLOAKSERVE_IDLE_TIMEOUT=SECONDS` to automatically terminate a seed's Chrome process after its last CDP WebSocket disconnects. `0`, `off`, `false`, `none`, or `disabled` disable idle cleanup. When cleanup runs, the seed's temporary profile directory under `--data-dir` is removed too. Check active processes at `GET /` (returns JSON with PIDs, ports, connection counts, idle timeout, and pending cleanup status).diff --git a/cloakbrowser/__main__.py b/cloakbrowser/__main__.pyindex 2e18b85..7f2c0c9 100644--- a/cloakbrowser/__main__.py+++ b/cloakbrowser/__main__.py@@ -75,19 +75,11 @@ def _module_available(module: str) -> bool:def _binary_version(binary_path: str) -> tuple[bool, str, str]:"""Launch `<binary> --version` to prove it runs. Returns (ok, version, err).- Chromium only handles --version on POSIX, so on Windows the switch is ignored- and a browser starts instead of printing — the probe then times out and a- healthy install looks broken. --no-startup-window makes it exit right away- without putting a window on screen; a broken binary still exits non-zero, so- the check keeps its meaning. It just reports no version there, as nothing is- printed.+ POSIX only: Windows ignores --version and starts a browser instead."""- argv = [binary_path, "--version"]- if platform.system() == "Windows":- argv.append("--no-startup-window")try:result = subprocess.run(- argv,+ [binary_path, "--version"],capture_output=True,text=True,timeout=10,@@ -296,6 +288,16 @@ def _collect_diagnostics(quick: bool, proxy: str | None = None) -> dict:diag["launch"] = {"tested": False, "reason": "skipped (--quick)"}elif not binary or not (installed or (binary and os.path.isfile(binary))):diag["launch"] = {"tested": False, "reason": "binary not installed"}+ elif platform.system() == "Windows":+ # Windows ignores --version and starts a real browser, which takes a+ # license seat and never frees it. Read the version manifest instead.+ manifest = next(+ (f for f in os.listdir(os.path.dirname(binary)) if f.endswith(".manifest")), ""+ )+ reason = "not launched on Windows (it would take a license seat)"+ if manifest:+ reason += f"; binary {manifest[: -len('.manifest')]}"+ diag["launch"] = {"tested": False, "reason": reason}else:ok, version, err = _binary_version(binary)diag["launch"] = {"tested": True, "ok": ok, "version": version, "error": err}diff --git a/dotnet/src/CloakBrowser/Diagnostics.cs b/dotnet/src/CloakBrowser/Diagnostics.csindex 12c1f72..57d45dd 100644--- a/dotnet/src/CloakBrowser/Diagnostics.cs+++ b/dotnet/src/CloakBrowser/Diagnostics.cs@@ -65,6 +65,15 @@ internal static class Diagnostics{diag["launch"] = new Dictionary<string, object?> { ["tested"] = false, ["reason"] = "binary not installed" };}+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))+ {+ // Windows ignores --version and starts a real browser, which takes a+ // license seat and never frees it. Read the version manifest instead.+ string? manifest = Directory.EnumerateFiles(Path.GetDirectoryName(binPath!)!, "*.manifest").FirstOrDefault();+ string reason = "not launched on Windows (it would take a license seat)";+ if (manifest != null) reason += $"; binary {Path.GetFileNameWithoutExtension(manifest)}";+ diag["launch"] = new Dictionary<string, object?> { ["tested"] = false, ["reason"] = reason };+ }else{var (ok, version, error) = BinaryVersion(binPath!);@@ -245,12 +254,7 @@ internal static class Diagnostics// Launch `<binary> --version` to prove it runs.//- // Chromium only handles --version on POSIX, so on Windows the switch is ignored- // and a browser starts instead of printing — the probe then times out and a- // healthy install looks broken. --no-startup-window makes it exit right away- // without putting a window on screen; a broken binary still exits non-zero, so- // the check keeps its meaning. It just reports no version there, as nothing is- // printed.+ // POSIX only: Windows ignores --version and starts a browser instead.private static (bool ok, string version, string error) BinaryVersion(string binaryPath){try@@ -263,8 +267,6 @@ internal static class DiagnosticsUseShellExecute = false,};startInfo.ArgumentList.Add("--version");- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))- startInfo.ArgumentList.Add("--no-startup-window");using var proc = new Process { StartInfo = startInfo };proc.Start();// Read both pipes asynchronously so a full pipe buffer can't deadlockdiff --git a/js/src/cli.ts b/js/src/cli.tsindex de15c39..40b847e 100644--- a/js/src/cli.ts+++ b/js/src/cli.ts@@ -68,18 +68,11 @@ function moduleAvailable(name: string): boolean {/*** Launch `<binary> --version` to prove it runs.*- * Chromium only handles --version on POSIX, so on Windows the switch is ignored- * and a browser starts instead of printing — the probe then times out and a- * healthy install looks broken. --no-startup-window makes it exit right away- * without putting a window on screen; a broken binary still exits non-zero, so- * the check keeps its meaning. It just reports no version there, as nothing is- * printed.+ * POSIX only: Windows ignores --version and starts a browser instead.*/function binaryVersion(binaryPath: string): { ok: boolean; version: string; error: string } {- const argv = ["--version"];- if (os.platform() === "win32") argv.push("--no-startup-window");try {- const out = execFileSync(binaryPath, argv, {+ const out = execFileSync(binaryPath, ["--version"], {encoding: "utf8",timeout: 10000,killSignal: "SIGKILL",@@ -262,6 +255,13 @@ export async function collectDiagnostics(diag.launch = { tested: false, reason: "skipped (--quick)" };} else if (!binPath || !(installed || fs.existsSync(binPath))) {diag.launch = { tested: false, reason: "binary not installed" };+ } else if (os.platform() === "win32") {+ // Windows ignores --version and starts a real browser, which takes a+ // license seat and never frees it. Read the version manifest instead.+ const manifest = fs.readdirSync(path.dirname(binPath)).find((f) => f.endsWith(".manifest"));+ let reason = "not launched on Windows (it would take a license seat)";+ if (manifest) reason += `; binary ${manifest.slice(0, -".manifest".length)}`;+ diag.launch = { tested: false, reason };} else {const { ok, version, error } = binaryVersion(binPath);diag.launch = { tested: true, ok, version, error };diff --git a/tests/test_cli.py b/tests/test_cli.pyindex 6b6dea2..aee3499 100644--- a/tests/test_cli.py+++ b/tests/test_cli.py@@ -402,24 +402,33 @@ def test_console_glyph_kept_on_utf8(monkeypatch):@pytestmark_posix-def test_binary_version_windows_probe_does_not_hang(tmp_path, monkeypatch):- """Real Windows Chrome ignores --version and starts a browser instead of- printing, so the stub here hangs unless --no-startup-window is passed —- mirroring the binary rather than a stub that prints and exits."""- stub = tmp_path / "winchrome"- stub.write_text(- "#!/bin/sh\n"- 'case "$*" in\n'- " *--no-startup-window*) exit 0 ;;\n"- " *) sleep 30 ;;\n" # stands in for the browser that never returns- "esac\n"- )+def test_info_never_launches_binary_on_windows(tmp_path, monkeypatch, capsys):+ """Windows Chrome ignores --version and starts a real browser, which takes a+ license seat it never releases. info must read the version manifest instead."""+ marker = tmp_path / "ran"+ stub = tmp_path / "chrome.exe"+ stub.write_text(f"#!/bin/sh\ntouch '{marker}'\n")stub.chmod(0o755)+ (tmp_path / "1.2.3.4.manifest").write_text("")+ fake_binary = {+ "version": "1.2.3.4.1",+ "tier": "pro",+ "bundled_version": "x",+ "path": str(stub),+ "installed": True,+ "cache_dir": str(tmp_path),+ "override": None,+ }monkeypatch.setattr(cloakbrowser.__main__.platform, "system", lambda: "Windows")- ok, version, err = _binary_version(str(stub))- assert ok, f"probe hung on a healthy Windows binary: {err}"- assert version == "" # Windows prints no version- assert err == ""+ with (+ patch("cloakbrowser.license.resolve_license_key", return_value=None),+ patch("cloakbrowser.__main__._effective_binary", return_value=fake_binary),+ ):+ cmd_info(Namespace(quick=False, json=True))+ data = json.loads(capsys.readouterr().out)+ assert data["launch"]["tested"] is False+ assert "1.2.3.4" in data["launch"]["reason"]+ assert not marker.exists(), "info launched the binary on Windows"@pytestmark_posix