cfsolve is a Rust library and command-line tool that solves Cloudflare Turnstile widgets and challenge pages through HTTP requests, without launching a headless browser. It returns a widget token or, for a challenge page, a cf_clearance cookie and the protected page. Widget solving typically needs the page URL and sitekey; challenge solving fetches the page or accepts its HTML. The tool imitates a browser using a profile that describes its fingerprint and includes recorded responses to Cloudflare’s browser checks. A Safari-on-iPhone profile is provided, while Safari and Chrome-based profiles are supported. Creating additional profiles involves capturing and organizing response data, with a real browser and capture proxy helping collect it.
The project includes a CLI and an async Rust API. Users can select a widget by sitekey and provide its action or custom data, supply existing page HTML, or render a widget on a blank page when they have only its URL and sitekey. A unified operation handles either a widget or a challenge, and requests can use HTTP, HTTPS, or SOCKS proxies. Building requires the pinned Rust toolchain, CMake, a C/C++ compiler, libclang, and Git. The library can be reused across operations, which receive separate connections and cookies; clearance must be used with the same IP address and user agent as the profile. Errors distinguish retryable network or rejection failures from configuration issues and unsupported challenge changes.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.