entrox-bypass 0.2.0 → 0.3.0

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
@@ -1,215 +1,287 @@
1
- # playwright-captcha
1
+ # ⚡ entrox-bypass
2
2
 
3
- > AI-powered automated CAPTCHA solving for Playwright browser automation
3
+ > AI-Powered Browser Automation & CAPTCHA Bypass Solution
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/playwright-captcha.svg)](https://www.npmjs.com/package/playwright-captcha)
5
+ [![npm version](https://img.shields.io/npm/v/entrox-bypass.svg)](https://www.npmjs.com/package/entrox-bypass)
6
+ [![npm downloads](https://img.shields.io/npm/dm/entrox-bypass.svg)](https://www.npmjs.com/package/entrox-bypass)
6
7
  [![License: ISC](https://img.shields.io/badge/license-ISC-blue.svg)](LICENSE)
8
+ [![TypeScript](https://img.shields.io/badge/typescript-%23007acc.svg)](https://www.typescriptlang.org/)
9
+ [![Playwright](https://img.shields.io/badge/playwright-2EAD33?logo=playwright&logoColor=white)](https://playwright.dev/)
7
10
 
8
- Automated login & CAPTCHA solving built on [Playwright](https://playwright.dev/), [LangChain](https://www.langchain.com/), and Cloudinary. Solves CAPTCHAs in real-time using AI image recognition via OpenRouter (Google Gemma).
11
+ Automated login, CAPTCHA solving, and browser automation — enhanced with AI-powered image recognition, proxy rotation, human-like behavior simulation, and webhook notifications.
9
12
 
10
- ## Features
13
+ ## 🚀 Features
11
14
 
12
- - 🤖 **AI-Powered CAPTCHA Solving** — Uses LLMs to read and solve CAPTCHA images automatically
13
- - 🔐 **Automated Login Flow** — Full end-to-end browser automation with credentials
14
- - 📦 **Dual Module Support** — Works with both ESM (`import`) and CJS (`require`)
15
- - ✍️ **TypeScript First** — Full type definitions included
16
- - ☁️ **Cloudinary Integration** — Efficient image upload & processing pipeline
17
- - 🧩 **Modular Design** — Use individual functions or the full automation suite
15
+ | Feature | Description |
16
+ |---------|-------------|
17
+ | 🤖 **AI CAPTCHA Solver** | Real-time CAPTCHA recognition using Google Gemma via OpenRouter |
18
+ | 🔐 **Smart Login Flow** | Complete automation: fill, solve, submit with retries |
19
+ | 🛡️ **Bot Detection Evasion** | Human-like delays, randomized timing, anti-detection patterns |
20
+ | 🌐 **Proxy Support** | HTTP/SOCKS proxy with authentication and optional rotation |
21
+ | 🔄 **Auto-Retry** | Exponential backoff retry on failures (configurable attempts) |
22
+ | 💾 **Session Persistence** | Save/restore cookies across sessions |
23
+ | 📹 **Video Recording** | Optional MP4 recording of entire automation flow |
24
+ | 🔔 **Webhook Alerts** | Discord/webhook notifications on success/failure |
25
+ | ☁️ **Cloudinary Integration** | Efficient image upload and CDN delivery |
26
+ | 📦 **Dual Module** | Full ESM + CJS compatibility |
27
+ | ✍️ **TypeScript First** | Comprehensive type definitions included |
18
28
 
19
- ## Installation
29
+ ## 📦 Installation
20
30
 
21
31
  ```bash
22
- npm install playwright-captcha playwright
32
+ # Install package + Playwright
33
+ npm install entrox-bypass playwright
23
34
  npx playwright install chromium
24
35
  ```
25
36
 
26
- ## Quick Start
37
+ ## 🛠 Quick Start
27
38
 
28
- ### Environment Variables
39
+ ### 1. Configure Environment Variables
29
40
 
30
- Create a `.env` file with your credentials:
41
+ Create a `.env` file:
31
42
 
32
43
  ```env
33
- # Required: Login credentials
44
+ # Authentication
34
45
  EMAIL=your_email@example.com
35
46
  PASSWORD=your_password
36
47
 
37
- # Required: AI CAPTCHA solver
48
+ # AI Model (OpenRouter)
38
49
  OPENROUTER_API_KEY=sk-or-v1-your-api-key
39
50
 
40
- # Required: Image hosting
51
+ # Image Upload (Cloudinary)
41
52
  CLOUDINARY_CLOUD_NAME=your_cloud_name
42
53
  CLOUDINARY_API_KEY=your_api_key
43
54
  CLOUDINARY_API_SECRET=your_api_secret
44
55
  ```
45
56
 
46
- ### Full Automated Login
57
+ ### 2. Basic Automated Login
47
58
 
48
- ```javascript
49
- import { automateLogin } from 'playwright-captcha';
59
+ ```typescript
60
+ import { automateLogin } from 'entrox-bypass';
50
61
 
51
- (async () => {
52
- const result = await automateLogin({
53
- url: 'https://example.com/login',
54
- headless: false, // Set true for server environments
55
- outputScreenshotPath: './result.png' // Optional screenshot after login
56
- });
62
+ const result = await automateLogin({
63
+ url: 'https://example.com/login',
64
+ });
57
65
 
58
- if (result.success) {
59
- console.log('Logged in successfully!');
60
- console.log('Current URL:', result.url);
61
- console.log('Page title:', result.title);
62
- } else {
63
- console.error('Login failed:', result.error);
64
- }
65
- })();
66
+ if (result.success) {
67
+ console.log('✅ Logged in:', result.url);
68
+ } else {
69
+ console.error('❌ Failed:', result.error);
70
+ }
66
71
  ```
67
72
 
68
- ### Solve CAPTCHA Manually
69
-
70
- ```javascript
71
- import { chromium } from 'playwright';
72
- import { solveCaptchaFromPage } from 'playwright-captcha';
73
-
74
- const browser = await chromium.launch();
75
- const page = await browser.newPage();
73
+ ### 3. Advanced Configuration (All Features)
76
74
 
77
- await page.goto('https://example.com/login');
78
- // ... fill form fields ...
79
-
80
- // Extract CAPTCHA text from the page
81
- const captcha = await solveCaptchaFromPage(page);
82
- console.log('CAPTCHA text:', captcha.text); // e.g., "X7K9P"
83
- console.log('Description:', captcha.description);
84
-
85
- await browser.close();
75
+ ```typescript
76
+ import { automateLogin } from 'entrox-bypass';
77
+
78
+ const result = await automateLogin({
79
+ url: 'https://secure-site.com/login',
80
+
81
+ // Override credentials
82
+ email: 'user@test.com',
83
+ password: 'secret123',
84
+
85
+ // Anti-detection
86
+ headless: true,
87
+ delayRange: { min: 800, max: 2500 },
88
+
89
+ // Retry on failure
90
+ retryCount: 3,
91
+ baseRetryDelay: 1500,
92
+
93
+ // Proxy support
94
+ proxy: {
95
+ server: 'http://proxy.example.com:8080',
96
+ username: 'proxy-user',
97
+ password: 'proxy-pass',
98
+ },
99
+
100
+ // Session persistence
101
+ cookieFile: './cookies.json',
102
+
103
+ // Video recording
104
+ videoPath: './recording.mp4',
105
+
106
+ // Webhook notifications
107
+ webhookUrl: 'https://discord.com/api/webhooks/xxxxx/yyyyyy',
108
+
109
+ // Output
110
+ outputScreenshotPath: './success.png',
111
+ });
86
112
  ```
87
113
 
88
- ## API Reference
114
+ ## 📖 API Reference
89
115
 
90
116
  ### `automateLogin(options)`
91
117
 
92
- Automates the entire login process including CAPTCHA solving.
93
-
94
- **Parameters:**
95
-
96
- | Option | Type | Required | Default | Description |
97
- |--------|------|----------|---------|-------------|
98
- | `url` | `string` | ✅ Yes | — | Target login page URL |
99
- | `loginSelector` | `string` | ❌ No | `#login` | CSS selector for email/login field |
100
- | `passwordSelector` | `string` | ❌ No | `#password` | CSS selector for password field |
101
- | `captchaInputSelector` | `string` | ❌ No | `#captcha` | CSS selector for CAPTCHA input field |
102
- | `submitButtonSelector` | `string` | ❌ No | `button[type='submit']` | CSS selector for submit button |
103
- | `headless` | `boolean` | ❌ No | `false` | Run browser in headless mode |
104
- | `outputScreenshotPath` | `string` | ❌ No | — | Path to save post-login screenshot |
105
- | `screenshotDelay` | `number` | ❌ No | — | Milliseconds to wait before screenshot |
106
-
107
- **Returns:** `Promise<LoginResult>`
118
+ Full end-to-end automated login with AI CAPTCHA solving.
108
119
 
109
120
  ```typescript
121
+ interface LoginOptions {
122
+ // Required
123
+ url: string;
124
+
125
+ // Credentials (override env vars)
126
+ email?: string;
127
+ password?: string;
128
+
129
+ // Selectors
130
+ loginSelector?: string; // default: '#login'
131
+ passwordSelector?: string; // default: '#password'
132
+ captchaInputSelector?: string; // default: '#captcha'
133
+ submitButtonSelector?: string; // default: "button[type='submit']"
134
+
135
+ // Browser config
136
+ headless?: boolean; // default: false
137
+
138
+ // Anti-detection
139
+ delayRange?: {
140
+ min: number; // min delay ms between actions
141
+ max: number; // max delay ms between actions
142
+ };
143
+
144
+ // Retry logic
145
+ retryCount?: number; // default: 2
146
+ baseRetryDelay?: number; // default: 1000 (ms)
147
+
148
+ // Proxy
149
+ proxy?: {
150
+ server: string;
151
+ username?: string;
152
+ password?: string;
153
+ };
154
+
155
+ // Session
156
+ cookieFile?: string; // Path to save/restore cookies
157
+
158
+ // Recording
159
+ videoPath?: string; // Path for MP4 recording
160
+
161
+ // Notifications
162
+ webhookUrl?: string; // Discord/webhook URL
163
+
164
+ // Output
165
+ outputScreenshotPath?: string; // Post-login screenshot path
166
+ }
167
+
110
168
  interface LoginResult {
111
169
  success: boolean;
112
170
  url: string;
113
171
  title: string;
114
- page: Page; // Playwright page instance (for further interactions)
115
- error?: string; // Error message if failed
172
+ page: Page; // Playwright Page instance
173
+ error?: string;
116
174
  }
117
175
  ```
118
176
 
119
- ---
177
+ **Returns:** `Promise<LoginResult>`
120
178
 
121
- ### `solveCaptchaFromPage(page, captchaSelector, outputScreenshotPath?)`
179
+ ---
122
180
 
123
- Extracts and solves a CAPTCHA image displayed on the page using AI.
181
+ ### `solveCaptchaFromPage(page, options?)`
124
182
 
125
- **Parameters:**
183
+ Extract text from CAPTCHA images using AI recognition.
126
184
 
127
- | Parameter | Type | Required | Default | Description |
128
- |-----------|------|----------|---------|-------------|
129
- | `page` | `Page` | ✅ Yes | — | Playwright Page instance |
130
- | `captchaSelector` | `string` | ❌ No | `img.captcha-image` | CSS selector for the CAPTCHA image |
131
- | `outputScreenshotPath` | `string` | ❌ No | — | Path to save CAPTCHA screenshot |
185
+ ```typescript
186
+ async function solveCaptchaFromPage(
187
+ page: Page,
188
+ captchaSelector?: string, // default: 'img.captcha-image'
189
+ options?: {
190
+ outputScreenshotPath?: string;
191
+ maxRetries?: number; // default: 3
192
+ retryDelayMs?: number; // default: 1000
193
+ timeoutMs?: number; // default: 30000
194
+ }
195
+ ): Promise<CaptchaResult>;
196
+ ```
132
197
 
133
198
  **Returns:** `Promise<CaptchaResult>`
134
199
 
135
200
  ```typescript
136
201
  interface CaptchaResult {
137
- text: string; // The extracted CAPTCHA text (e.g., "X7K9P")
138
- description: string; // Brief description of the image content
202
+ text: string; // Extracted text (e.g., 'X7K9P')
203
+ description: string; // Image description
139
204
  }
140
205
  ```
141
206
 
142
207
  ---
143
208
 
144
- ## Customization
209
+ ### Utility Functions
145
210
 
146
- ### Change AI Model
211
+ #### `humanDelay`
212
+ Randomized delay utility for bot detection evasion.
147
213
 
148
- ```env
149
- # In your .env file
150
- LLM_MODEL=google/gemma-4-26b-a4b-it
151
- ```
214
+ ```typescript
215
+ import { humanDelay } from 'entrox-bypass';
152
216
 
153
- Supported models (via OpenRouter):
154
- - `google/gemma-4-26b-a4b-it` (default)
155
- - `openai/gpt-4o`
156
- - `anthropic/claude-3.5-sonnet`
157
- - See [OpenRouter](https://openrouter.ai/models) for more options
217
+ await humanDelay.randomBetween(500, 1500); // Random delay 0.5-1.5s
218
+ ```
158
219
 
159
- ### Custom Selectors
220
+ #### `retry`
221
+ Exponential backoff retry wrapper.
160
222
 
161
- If your login page uses different element selectors:
223
+ ```typescript
224
+ import { retry } from 'entrox-bypass';
162
225
 
163
- ```javascript
164
- await automateLogin({
165
- url: 'https://example.com/signin',
166
- loginSelector: '#email-input',
167
- passwordSelector: '#password-input',
168
- captchaInputSelector: '#captcha-code',
169
- submitButtonSelector: '.btn-signin'
226
+ const result = await retry(async () => fetchSomeData(), {
227
+ maxAttempts: 5,
228
+ delayMs: 1000,
229
+ multiplier: 2,
170
230
  });
171
231
  ```
172
232
 
173
- ## Architecture
233
+ ## 🌍 Supported LLM Models
174
234
 
175
- ```
176
- ┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌──────────┐
177
- │ Playwright │───▶│ Cloudinary │───▶│ OpenRouter │───▶│ JSON │
178
- │ Browser │ │ (Upload IMG) │ │ (Gemma LLM) │ │ Response │
179
- └─────────────┘ └──────────────┘ └─────────────┘ └──────────┘
180
- │ │
181
- ▼ ▼
182
- ┌─────────────┐ ┌──────────────────┐
183
- │ Fill Form │◀─────────────────────────────────────│ Extract Text │
184
- │ Submit │ └──────────────────┘
185
- └─────────────┘
235
+ All models via [OpenRouter](https://openrouter.ai):
236
+
237
+ | Model | Recommended For |
238
+ |-------|-----------------|
239
+ | `google/gemma-4-26b-a4b-it` | CAPTCHA text extraction (default) |
240
+ | `openai/gpt-4o` | Complex visual puzzles |
241
+ | `anthropic/claude-3.5-sonnet` | High accuracy tasks |
242
+ | `meta-llama/llama-3.2-11b-vision-instruct` | Balanced speed/accuracy |
243
+
244
+ Change model in `.env`:
245
+ ```env
246
+ LLM_MODEL=openai/gpt-4o
186
247
  ```
187
248
 
188
- ## Error Handling
249
+ ## 🔒 Security & Best Practices
189
250
 
190
- All functions throw descriptive errors:
251
+ - ✅ **Never commit `.env`** — Use `.env.example` as template
252
+ - ✅ **Use headless mode** on production servers
253
+ - ✅ **Set appropriate timeouts** to prevent hanging
254
+ - ✅ **Respect terms of service** — Only automate sites you own or have permission to test
255
+ - ✅ **Rotate user agents/proxies** when making many requests
191
256
 
192
- ```javascript
193
- try {
194
- await automateLogin({ url: 'https://example.com/login' });
195
- } catch (error) {
196
- if (error.name === 'LlmError') {
197
- console.error('AI service error:', error.message);
198
- } else if (error.name === 'CloudinaryError') {
199
- console.error('Upload failed:', error.message);
200
- } else {
201
- console.error('Browser automation error:', error.message);
202
- }
203
- }
257
+ ## 🏗 Architecture
258
+
259
+ ```
260
+ ┌─────────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐
261
+ │ Playwright │───▶│ Cloudinary │───▶│ OpenRouter │───▶│ AI Parser │
262
+ │ Browser │ │ (Upload) │ │ (LLM Model) │ │ JSON Out │
263
+ └─────────────┘ └──────────────┘ └──────────────┘ └─────────────┘
264
+ │ │
265
+ ▼ ▼
266
+ ┌─────────────────┐ ┌──────────────────────┐
267
+ │ Fill Form Fields │◀────────────────────────────│ Extract Text Content │
268
+ │ Submit Actions │ └──────────────────────┘
269
+ │ Cookie Handling │
270
+ │ Webhook Alerts │
271
+ │ Video Recording │
272
+ └─────────────────┘
204
273
  ```
205
274
 
206
- ## Development
275
+ ## 🧪 Development
207
276
 
208
277
  ```bash
209
- # Clone and install dependencies
210
- git clone <repo-url>
211
- cd playwright-captcha
278
+ # Clone repository
279
+ git clone https://github.com/dev-sajid007/entrox-bypass.git
280
+ cd entrox-bypass
281
+
282
+ # Install dependencies
212
283
  npm install
284
+ npx playwright install chromium
213
285
 
214
286
  # Build bundles (ESM + CJS)
215
287
  npm run build
@@ -217,34 +289,61 @@ npm run build
217
289
  # Run tests
218
290
  npm test
219
291
 
220
- # TypeScript type checking
292
+ # Type checking
221
293
  npx tsc --noEmit
294
+
295
+ # Watch mode during development
296
+ npm run dev
222
297
  ```
223
298
 
224
- ## Project Structure
299
+ ### Project Structure
225
300
 
226
301
  ```
227
- playwright-captcha/
302
+ entrox-bypass/
228
303
  ├── src/
229
- │ ├── index.ts # Public API exports
230
- │ ├── login.ts # automateLogin implementation
231
- │ ├── captchaSolve.ts # CAPTCHA extraction & solving
232
- │ ├── cloudinary.ts # Cloudinary upload config
233
- │ └── llm.ts # OpenRouter / Gemma integration
304
+ │ ├── index.ts # Public API exports
305
+ │ ├── login.ts # automateLogin implementation
306
+ │ ├── captchaSolve.ts # CAPTCHA extraction pipeline
307
+ │ ├── cloudinary.ts # Cloudinary configuration
308
+ │ ├── llm.ts # OpenRouter LLM integration
309
+ │ └── utils/
310
+ │ ├── humanDelay.ts # Bot-evasion timing utilities
311
+ │ └── retry.ts # Exponential backoff retry logic
234
312
  ├── types/
235
- │ └── index.d.ts # TypeScript declarations
236
- ├── dist/ # Built packages (ESM + CJS)
237
- └── test/ # Test suite
313
+ │ └── index.d.ts # TypeScript declarations
314
+ ├── dist/ # Bundled output (published)
315
+ ├── test/ # Jest test suite
316
+ ├── .env.example # Environment template
317
+ ├── tsup.config.ts # Bundle configuration
318
+ └── package.json
238
319
  ```
239
320
 
240
- ## License
321
+ ## 📊 Changelog
322
+
323
+ | Version | Date | Changes |
324
+ |---------|------|---------|
325
+ | 0.3.0 | 2026-10-25 | Added proxy, retry, webhooks, video recording, session persistence |
326
+ | 0.2.0 | 2026-10-25 | Package rename, enhanced AI model support |
327
+ | 0.1.0 | 2026-10-25 | Initial release |
328
+
329
+ ## 📄 License
330
+
331
+ ISC — Feel free to use in personal and commercial projects.
332
+
333
+ ## 🤝 Contributing
334
+
335
+ Contributions welcome! Please:
241
336
 
242
- ISC
337
+ 1. Fork the repository
338
+ 2. Create a feature branch (`feat/your-feature`)
339
+ 3. Write tests for new functionality
340
+ 4. Ensure all tests pass (`npm test`)
341
+ 5. Submit a pull request
243
342
 
244
- ## Contributing
343
+ ## ⚠️ Disclaimer
245
344
 
246
- Contributions, issues, and feature requests are welcome! Feel free to submit a PR.
345
+ Always obtain proper authorization before automating interactions with any website. Respect robots.txt, rate limits, and terms of service. This tool is designed for legitimate testing and automation purposes only.
247
346
 
248
347
  ---
249
348
 
250
- > ⚠️ **Note**: Always use this library responsibly. Ensure you have authorization to automate interactions with any website you're targeting. Respect robots.txt and terms of service.
349
+ **Built with ❤️ using Playwright, LangChain, Cloudinary & OpenRouter**