1.5.7 • Published 7 months ago

cloak-stealth v1.5.7

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
7 months ago

Cloak Stealth (Comming soon) Contact me on Telegram

Cloak Stealth is a powerful browser automation library that allows you to manage browser profiles, control proxy settings, and perform various browser-related tasks with advanced fingerprinting protection.

Installation

ES Modules

If you're using ES modules, you can import the package like this:

import CloakStealth from 'cloak-stealth';

// Use the package
const cloak = new CloakStealth();
// ... rest of your code

CommonJS

If you're using CommonJS, you can require the package like this:

const CloakStealth = require('cloak-stealth');

// Use the package
const cloak = new CloakStealth();
// ... rest of your code

Features

  • Create and manage browser profiles with customizable settings
  • Advanced proxy configuration with rotation and batch assignment
  • Customize browser fingerprints (user agent, resolution, canvas, WebGL, etc.)
  • Run automated tasks across multiple profiles concurrently
  • Handle bookmarks and other browser data
  • Manage browser connections efficiently
  • Bypass Cloudflare protection (optional)
  • Support for various operating systems and device types

Usage

Importing the library

    import { CloakAPIManager, CloakAPIOptions, ProfileCreationOptions, ProxyConfig, BrowserConnection } from 'cloak-stealth';

Creating a CloakAPIManager instance

    const options: CloakAPIOptions = {
      apiKey: "lsk_8eb27803a3ada31587b0f125328b25f7eb4f47xxxxxxxx",
      currentDir: '/path/to/working/directory',
      browsersDir: '/path/to/browser/profiles',
      extensions: ['/path/to/extensions', '/path/to/extensions'],
      windowOptions: { cols: 1280, rows: 720 },
      clearCacheAndHistory: true,
      turnstile: false,
      advancedStealthMode: false,
      proxyConfig: {
        type: 'rotate',
        proxies: ['ip1:port1:user1:pass1', 'ip2:port2:user2:pass2'],
        proxyMode: 'http'
      }
    };
    
    const manager = new CloakAPIManager(options);

Profile Management

Creating a single profile

    const profileOptions: ProfileCreationOptions = {
      name: 'MyProfile',
      os: 'win',
      audioContext: {
         mode: "noise",
      },
      canvas: {
        mode: "off",
      },
      webGL: {
        mode: "off",
      },
      webGLMetadata: {
        mode: "noise",
      },
      navigator: {
        userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
        resolution: '1920x1080',
        language: 'en-US',
        platform: 'Win32',
        hardwareConcurrency: 8,
        deviceMemory: 8
      },
      googleServicesEnabled: true,
      lockEnabled: false
    };
    
    const profileId = await manager.create(profileOptions);
    console.log('Created profile:', profileId);

Quick create multiple profiles

    const profileIds = await manager.quickCreateMultipleProfiles(5, 'BatchProfile', 1000, {
      os: 'lin',
      navigator: {
        resolution: '1366x768'
      }
    });
    console.log('Created profiles:', profileIds);

Checking if a profile exists

    const exists = await manager.profileExists('profile-id');
    console.log('Profile exists:', exists);

Getting all profiles

    const allProfiles = await manager.getAllProfiles(1,10);
    console.log('All profiles:', allProfiles);

Deleting profiles

    // Delete a single profile
    const result = await manager.delete('profile-id');
    console.log('Deletion result:', result);

    // Delete specific profiles
    const specificResults = await manager.deleteAllProfiles(['profile-id-1', 'profile-id-2', 'profile-id-3']);
    console.log('Specific deletion results:', specificResults);

    // Delete all profiles
    const results = await manager.deleteAllProfiles();
    console.log('Deletion results:', results);

Browser Automation

Starting a browser session

    const connection = await manager.start({ profileId: 'your-profile-id' });
    if (connection) {
      const { browser, page } = connection;
      await page.goto('https://example.com');
      // Perform other actions...
      await manager.closeProfile(connection);
    }

Running automation on all profiles

    const automationFunction = async (connection: BrowserConnection, index: number) => {
      const { page } = connection;
      await page.goto('https://example.com');
      // Perform actions...
      const title = await page.title();
      console.log(`Page ${index} title:`, title);
    };
    
    await manager.runAllProfiles(automationFunction, { 
      threads: 5, 
      startIndex: 0, 
      endIndex: 10, 
      delay: 1000,
      autoClose: true
    });

Proxy Configuration

Changing proxy for a profile

    await manager.changeProfileProxy('profile-id', {
      mode: 'http',
      host: 'proxy.example.com',
      port: 8080,
      username: 'user',
      password: 'pass'
    });

Rotating proxies

    const rotateConfig: ProxyConfig = {
      type: 'rotate',
      proxies: ['ip1:port1:user1:pass1', 'ip2:port2:user2:pass2'],
      proxyMode: 'http'
    };
    
    // Use this config when creating the CloakAPIManager instance

Batch proxy assignment

    const batchConfig: ProxyConfig = {
      type: 'batch',
      proxies: ['ip1:port1:user1:pass1', 'ip2:port2:user2:pass2'],
      batchSize: 5,
      proxyMode: 'http'
    };
    
    // Use this config when creating the CloakAPIManager instance
    

Fingerprint Customization

Changing resolution

    await manager.changeProfileResolution('profile-id', { width: 1920, height: 1080 });

Changing user agent

    await manager.changeProfileUserAgent('profile-id', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36');

Setting timezone

    const success = await manager.setProfileTimezone('profile-id', 'America/New_York');
    console.log('Timezone set:', success);

Bookmarks Management

    // Get all bookmarks
    const bookmarks = await manager.getBookmarks('profile-id');
    console.log('Bookmarks:', bookmarks);
    
    // Add a bookmark
    await manager.addBookmark('profile-id', {
      title: 'Example',
      url: 'https://example.com'
    });
    
    // Remove a bookmark
    await manager.removeBookmark('profile-id', 'bookmark-id');

Cleaning Up

    // Exit a specific browser
    await manager.closeBrowser(browserConnection);
    
    // Exit all browsers
    await manager.exitAllBrowsers();
    
    // Exit the CloakAPIManager instance
    await manager.exit();
    
    // Exit all CloakAPIManager instances
    await exitAll();

Advanced Usage

Custom Automation with Error Handling

    const customAutomation = async (connection: BrowserConnection) => {
      const { page } = connection;
      try {
        await page.goto('https://example.com');
        const element = await page.waitForSelector('#specific-element', { timeout: 5000 });
        if (element) {
          await element.click();
          // Perform more actions...
        }
      } catch (error) {
        console.error('Automation error:', error);
      }
    };
    
    await manager.start({ 
      profileId: 'your-profile-id',
      skipCheckBrowser: true
    }, customAutomation);

Proxy Rotation with Retries

    const rotateProxyAutomation = async (connection: BrowserConnection, index: number) => {
      const { page } = connection;
      let retries = 3;
      while (retries > 0) {
        try {
          await page.goto('https://example.com');
          // If successful, break the loop
          break;
        } catch (error) {
          console.error(`Error on attempt ${4 - retries}:`, error);
          retries--;
          if (retries > 0) {
            // Rotate to next proxy
            await manager.assignProxyToProfile(connection.profileId, index + 1);
          }
        }
      }
    };
    
    await manager.runAllProfiles(rotateProxyAutomation, { threads: 3 });

Troubleshooting

  • Proxy Connection Issues: Ensure your proxy settings are correct and the proxies are active. Try using a different proxy or temporarily disabling proxy to isolate the issue.

  • Fingerprinting Detection: If websites are detecting your automated activity, try adjusting the noise settings for canvas, WebGL, and audio context. You may also need to randomize your user agent and other navigator properties more frequently.

  • Performance Issues: If you're running many profiles concurrently, try reducing the number of threads or increasing the delay between actions to reduce resource usage.

  • Bypass Turnstile: Automatically check and bypass Turnstile by ensuring the turnstile option is set to true. If issues persist, consider implementing additional strategies or using specialized services designed for this purpose.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

1.5.7

7 months ago

1.5.6

8 months ago

1.5.5

8 months ago

1.5.4

8 months ago

1.2.0

10 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.4.6

10 months ago

1.2.8

10 months ago

1.4.5

10 months ago

1.2.7

10 months ago

1.0.9

11 months ago

1.4.4

10 months ago

1.2.6

10 months ago

1.0.8

11 months ago

1.2.5

10 months ago

1.4.2

10 months ago

1.2.4

10 months ago

1.0.6

11 months ago

1.4.1

10 months ago

1.2.3

10 months ago

1.0.5

11 months ago

1.4.0

10 months ago

1.2.2

10 months ago

1.0.4

11 months ago

1.2.1

10 months ago

1.0.3

11 months ago

1.3.9

10 months ago

1.3.8

10 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.3.7

10 months ago

1.1.9

10 months ago

1.3.6

10 months ago

1.1.8

10 months ago

1.5.3

9 months ago

1.3.5

10 months ago

1.1.7

10 months ago

1.5.2

9 months ago

1.3.4

10 months ago

1.1.6

10 months ago

1.5.1

9 months ago

1.3.3

10 months ago

1.1.5

10 months ago

1.5.0

9 months ago

1.3.2

10 months ago

1.1.4

10 months ago

1.3.1

10 months ago

1.1.3

10 months ago

1.3.0

10 months ago

1.1.2

11 months ago

1.4.9

9 months ago

1.4.8

9 months ago

1.4.7

9 months ago

1.0.0

11 months ago