Files
CloakBrowser/bin/cloakserve
T
CloakHQ 1c93951f23 release: v0.3.11 — Linux build 145.0.7632.159.3
- Version bump: 0.3.10 → 0.3.11 (Python + JS)
- Linux Chromium: 145.0.7632.159.2 → 159.3
- CHANGELOG: v0.3.11 entry
- README: patch count 26→31, humanize docs
- bin/cloakserve: use --remote-debugging-address, remove socat
- Dockerfile: remove socat dependency
2026-03-08 23:19:39 +01:00

54 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python3
"""Launch stealth Chromium as a CDP server for remote connections.
Usage:
cloakserve # headless on port 9222
cloakserve --headless=false # headed (uses Xvfb in Docker)
cloakserve --proxy-server=host:port # with proxy
Connect from host:
playwright.chromium.connect_over_cdp("http://localhost:9222")
"""
import signal
import subprocess
import sys
import time
from cloakbrowser.config import get_default_stealth_args
from cloakbrowser.download import ensure_binary
PORT = 9222
binary = ensure_binary()
chrome_args = [
binary,
f"--remote-debugging-port={PORT}",
"--remote-debugging-address=0.0.0.0",
# Sane defaults for running Chrome directly (outside Playwright)
"--no-first-run",
"--no-default-browser-check",
"--disable-dev-shm-usage",
"--disable-extensions",
"--disable-popup-blocking",
"--disable-background-networking",
"--metrics-recording-only",
] + get_default_stealth_args() + sys.argv[1:]
chrome = subprocess.Popen(chrome_args)
time.sleep(2)
print(f"CloakBrowser CDP server ready on port {PORT}", flush=True)
def cleanup(sig, frame):
chrome.terminate()
sys.exit(0)
signal.signal(signal.SIGTERM, cleanup)
signal.signal(signal.SIGINT, cleanup)
chrome.wait()