bexxcv 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,6 +24,10 @@ High-performance stealth Firefox automation built on top of [Camoufox](https://g
24
24
  | Xvfb module | Internal only | Exported — `needsXvfb`, `startXvfb`, `withXvfb` |
25
25
  | WebGL sampling | `Math.random()` for weighted choice | `crypto.getRandomValues()` |
26
26
  | Main export | `Camoufox` | `bexxcv` (with `Camoufox` kept as alias) |
27
+ | Turnstile | Manual | `turnstile: true` — background auto-click on every page |
28
+ | Cloudflare UAM | Manual | `uam: true` — `page.goto()` waits until the challenge clears |
29
+ | Human behavior | Cursor movement only (`humanize`) | `createHuman(page)` — clicks, typing with typos, scrolling, idle drift |
30
+ | Launch speed | Sequential setup | Public IP lookup runs in parallel with the binary check; telemetry and update prefs off by default |
27
31
 
28
32
  ---
29
33
 
@@ -103,6 +107,8 @@ const browser = await bexxcv({
103
107
  exclude_addons: [], // built-in addon keys to skip
104
108
  fonts: [], // additional font names to inject
105
109
  custom_fonts_only: false, // strip all built-in fonts, use only your list
110
+ turnstile: false,
111
+ uam: false,
106
112
 
107
113
  // --- Low-level ---
108
114
  executable_path: undefined, // path to a custom Firefox binary
@@ -177,6 +183,64 @@ import { launchOptions } from "bexxcv";
177
183
  import { getPossiblePairs } from "bexxcv/webgl"; // if you re-export it
178
184
  ```
179
185
 
186
+ ### `turnstile`
187
+
188
+ Background solver for Cloudflare Turnstile checkboxes, similar to the `turnstile` option in puppeteer-real-browser.
189
+
190
+ ```ts
191
+ const browser = await bexxcv({ turnstile: true });
192
+ const page = await browser.newPage();
193
+ await page.goto("https://example.com");
194
+ ```
195
+
196
+ | Option | Default | Description |
197
+ |---|---|---|
198
+ | `interval` | `1000` | Milliseconds between widget checks |
199
+ | `retryAfter` | `8000` | Minimum milliseconds before the same unsolved widget is clicked again |
200
+
201
+ Pass `turnstile: { interval: 500, retryAfter: 6000 }` to tune it.
202
+
203
+ How it works:
204
+
205
+ - One loop per page, including pages opened later, and it stops when the page closes.
206
+ - It looks for `cf-turnstile-response` inputs and clicks the left side of the widget, where the checkbox is. If none exist it falls back to empty `div` elements about 300px wide.
207
+ - Widgets that already hold a token are skipped, and widgets outside the viewport are scrolled into view first.
208
+ - The pointer moves in several steps and the button is held briefly. Combine it with `humanize: true` for more natural cursor paths.
209
+
210
+ ### `uam`
211
+
212
+ Waits out the Cloudflare "Just a moment" challenge (Under Attack Mode).
213
+
214
+ ```ts
215
+ const browser = await bexxcv({ uam: true });
216
+ const page = await browser.newPage();
217
+ await page.goto("https://example.com");
218
+ ```
219
+
220
+ | Option | Default | Description |
221
+ |---|---|---|
222
+ | `timeout` | `30000` | Maximum milliseconds to wait for a challenge to clear |
223
+ | `interval` | `1500` | Milliseconds between background checks for a new challenge |
224
+ | `waitOnGoto` | `true` | Make `page.goto()` resolve only after the challenge clears |
225
+
226
+ How it works:
227
+
228
+ - While the challenge title is shown, the mouse moves and the page scrolls with real input events.
229
+ - After the title changes it waits for `cf_clearance` to stay stable and `cf_chl_rc_ni` to disappear.
230
+ - Pages without a challenge return immediately, so there is no added delay.
231
+ - Challenges that start from clicks or reloads are handled by the background loop.
232
+
233
+ You can also call it directly:
234
+
235
+ ```ts
236
+ import { waitForUam } from "bexxcv";
237
+
238
+ const result = await waitForUam(page, { timeout: 20000 });
239
+ console.log(result.challenged, result.bypassed, result.cookie);
240
+ ```
241
+
242
+ `turnstile` and `uam` can be enabled together.
243
+
180
244
  ---
181
245
 
182
246
  ## Persistent context
@@ -196,6 +260,44 @@ await context.close();
196
260
 
197
261
  ---
198
262
 
263
+ ## Human-like helper
264
+
265
+ `humanize` only shapes cursor movement inside the browser. `createHuman` adds the rest at the Playwright level.
266
+
267
+ ```ts
268
+ import { bexxcv, createHuman } from "bexxcv";
269
+
270
+ const browser = await bexxcv({ humanize: true });
271
+ const page = await browser.newPage();
272
+ const human = createHuman(page, { speed: 1, typoRate: 0.015 });
273
+
274
+ await page.goto("https://example.com");
275
+ await human.scrollTo("#login");
276
+ await human.click("#email");
277
+ await human.type(null, "hello@example.com");
278
+ await human.pause();
279
+ await human.scroll(400);
280
+ await human.idle(2000);
281
+ ```
282
+
283
+ | Method | Description |
284
+ |---|---|
285
+ | `click(selectorOrPoint)` | Lands at a random point inside the element, hovers briefly, then presses and releases |
286
+ | `type(selector \| null, text)` | Variable delay per key, longer pauses after spaces and punctuation, occasional typo that is corrected |
287
+ | `scroll(deltaY)` | Wheel steps with uneven timing and occasional reading pauses |
288
+ | `scrollTo(selector)` | Scrolls until the element is near the middle of the viewport |
289
+ | `moveTo(x, y)` | Moves the pointer |
290
+ | `pause(min, max)` | Log-normal think time in milliseconds |
291
+ | `idle(ms)` | Small pointer drift |
292
+
293
+ | Option | Default | Description |
294
+ |---|---|---|
295
+ | `speed` | `1` | Higher is faster, from `0.2` to `20` |
296
+ | `nativeCursor` | `true` | Let `humanize` move the cursor. Set `false` to draw Bezier paths from JavaScript |
297
+ | `typoRate` | `0.015` | Probability of a typo per letter, `0` disables |
298
+
299
+ ---
300
+
199
301
  ## Xvfb module
200
302
 
201
303
  bexxcv exports all Xvfb utilities so you can manage virtual displays in your own code:
@@ -328,11 +430,28 @@ npx bexxcv server # Start a Playwright remote server
328
430
 
329
431
  ## Exports
330
432
 
433
+ ### Module formats
434
+
435
+ bexxcv is an ES module package. It also works from CommonJS on Node.js 22.12 or newer, where `require()` can load ES modules.
436
+
437
+ ```js
438
+ import { bexxcv } from "bexxcv";
439
+ ```
440
+
441
+ ```js
442
+ const { bexxcv } = require("bexxcv");
443
+ ```
444
+
445
+ On older Node.js versions load it with `const { bexxcv } = await import("bexxcv");`. TypeScript projects that compile to CommonJS need TypeScript 5.8 or newer with `module` set to `nodenext`.
446
+
331
447
  ```ts
332
448
  // Main entry — everything
333
449
  import { bexxcv, Camoufox, NewBrowser, launchOptions, VirtualDisplay } from "bexxcv";
334
450
  import type { BexxcvOptions, LaunchOptions } from "bexxcv";
335
451
 
452
+ import { createHuman, attachTurnstile, attachUam, waitForUam } from "bexxcv";
453
+ import type { HumanOptions, TurnstileOptions, UamOptions, UamResult } from "bexxcv";
454
+
336
455
  // Xvfb utilities
337
456
  import { needsXvfb, startXvfb, withXvfb } from "bexxcv/xvfb";
338
457
 
@@ -446,6 +565,12 @@ Unauthenticated GitHub API is limited to 60 requests/hour per IP.
446
565
 
447
566
  ---
448
567
 
568
+ ### `WebGL database not found or empty`
569
+
570
+ The package ships `webgl_data.db` inside `dist/data-files`. If you see this error while developing bexxcv itself, place a valid `webgl_data.db` in `src/data-files` and run `pnpm build` again.
571
+
572
+ ---
573
+
449
574
  ### `playwright-core` version mismatch
450
575
 
451
576
  bexxcv requires `playwright-core < 1.63.0`.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { launchServer } from "./server.js";
2
- export { Bexxcv, Camoufox, NewBrowser, type BexxcvOptions } from "./sync_api.js";
2
+ export { Bexxcv, Bexxcv as bexxcv, Camoufox, NewBrowser, type BexxcvOptions, } from "./sync_api.js";
3
3
  export { type LaunchOptions, launchOptions } from "./utils.js";
4
4
  export { VirtualDisplay } from "./virtdisplay.js";
5
5
  export { needsXvfb, startXvfb, withXvfb } from "./xvfb.js";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { launchServer } from "./server.js";
2
- export { Bexxcv, Camoufox, NewBrowser } from "./sync_api.js";
2
+ export { Bexxcv, Bexxcv as bexxcv, Camoufox, NewBrowser, } from "./sync_api.js";
3
3
  export { launchOptions } from "./utils.js";
4
4
  export { VirtualDisplay } from "./virtdisplay.js";
5
5
  export { needsXvfb, startXvfb, withXvfb } from "./xvfb.js";
@@ -0,0 +1,2 @@
1
+ export declare function between(min: number, max: number): number;
2
+ export declare function sleep(ms: number): Promise<void>;
package/dist/random.js ADDED
@@ -0,0 +1,8 @@
1
+ export function between(min, max) {
2
+ const buf = new Uint32Array(1);
3
+ crypto.getRandomValues(buf);
4
+ return min + (buf[0] / 4294967296) * (max - min);
5
+ }
6
+ export function sleep(ms) {
7
+ return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
8
+ }
package/dist/turnstile.js CHANGED
@@ -1,11 +1,6 @@
1
1
  import { onEachPage } from "./pagehooks.js";
2
+ import { between, sleep } from "./random.js";
2
3
  const WATCHED = new WeakSet();
3
- function sleep(ms) {
4
- return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
5
- }
6
- function between(min, max) {
7
- return min + Math.random() * (max - min);
8
- }
9
4
  async function findWidgets(page) {
10
5
  return page.evaluate(() => {
11
6
  const out = [];
package/dist/uam.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { onEachPage } from "./pagehooks.js";
2
+ import { between, sleep } from "./random.js";
2
3
  const CHALLENGE_TITLES = [
3
4
  "just a moment",
4
5
  "tunggu sebentar",
@@ -12,12 +13,6 @@ const CHALLENGE_TITLES = [
12
13
  ];
13
14
  const WATCHED = new WeakSet();
14
15
  const BUSY = new WeakSet();
15
- function sleep(ms) {
16
- return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
17
- }
18
- function between(min, max) {
19
- return min + Math.random() * (max - min);
20
- }
21
16
  async function isChallenge(page) {
22
17
  const title = (await page.title().catch(() => "")).toLowerCase();
23
18
  return CHALLENGE_TITLES.some((t) => title.includes(t));
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "bexxcv",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
7
7
  "build": "rimraf dist && tsc && pnpm copy-files",
8
8
  "test": "vitest",
9
- "copy-files": "mkdir -p dist/data-files && cp -r src/data-files/. dist/data-files/",
10
- "prepack": "pnpm build && node scripts/verify-package.mjs",
9
+ "copy-files": "cp -r src/data-files dist/data-files",
11
10
  "check": "biome check",
12
11
  "fetch": "node dist/__main__.js fetch"
13
12
  },
@@ -33,7 +32,7 @@
33
32
  "url": "https://github.com/fidzzcodex-me/bexxcv/issues"
34
33
  },
35
34
  "engines": {
36
- "node": ">= 22"
35
+ "node": ">= 22.12"
37
36
  },
38
37
  "license": "MPL-2.0",
39
38
  "description": "High-performance stealth Firefox automation. Fork of camoufox-js with parallel IP resolution, crypto-grade fingerprint seeds, exponential backoff, and zero-config Xvfb.",
@@ -82,24 +81,34 @@
82
81
  },
83
82
  "exports": {
84
83
  ".": {
84
+ "types": "./dist/index.d.ts",
85
85
  "import": "./dist/index.js",
86
- "types": "./dist/index.d.ts"
86
+ "require": "./dist/index.js",
87
+ "default": "./dist/index.js"
87
88
  },
88
89
  "./xvfb": {
90
+ "types": "./dist/xvfb.d.ts",
89
91
  "import": "./dist/xvfb.js",
90
- "types": "./dist/xvfb.d.ts"
92
+ "require": "./dist/xvfb.js",
93
+ "default": "./dist/xvfb.js"
91
94
  },
92
95
  "./virtdisplay": {
96
+ "types": "./dist/virtdisplay.d.ts",
93
97
  "import": "./dist/virtdisplay.js",
94
- "types": "./dist/virtdisplay.d.ts"
98
+ "require": "./dist/virtdisplay.js",
99
+ "default": "./dist/virtdisplay.js"
95
100
  },
96
101
  "./exceptions": {
102
+ "types": "./dist/exceptions.d.ts",
97
103
  "import": "./dist/exceptions.js",
98
- "types": "./dist/exceptions.d.ts"
104
+ "require": "./dist/exceptions.js",
105
+ "default": "./dist/exceptions.js"
99
106
  },
100
107
  "./selfupdate": {
108
+ "types": "./dist/selfupdate.d.ts",
101
109
  "import": "./dist/selfupdate.js",
102
- "types": "./dist/selfupdate.d.ts"
110
+ "require": "./dist/selfupdate.js",
111
+ "default": "./dist/selfupdate.js"
103
112
  }
104
113
  }
105
114
  }
Binary file