Skip to content

Repository files navigation

Human Agent Browser Automation

A Node.js-based browser automation solution using Puppeteer with Jornaya detection evasion, proxy rotation, and geo-based lead matching.

Features

  • Jornaya Detection Evasion: Uses Puppeteer with stealth plugins to avoid bot detection
  • Proxy Rotation: Works with FoxyProxy extension for automatic IP rotation every 300 seconds
  • Geo-based Lead Matching: Detects current IP location and matches with leads from database
  • Human-like Behavior: Implements realistic typing delays, mouse movements, and form interactions
  • Time Management: Ensures form completion within 200 seconds before proxy rotation
  • Database Integration: PostgreSQL integration for lead management

Prerequisites

  • Node.js 16+
  • PostgreSQL database
  • Google Chrome browser
  • FoxyProxy extension (for proxy rotation)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd human-agent
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp env.example .env
    # Edit .env with your configuration
  4. Set up database

    CREATE TABLE leads (
      id SERIAL PRIMARY KEY,
      first_name VARCHAR(100) NOT NULL,
      last_name VARCHAR(100) NOT NULL,
      email VARCHAR(255) NOT NULL,
      phone VARCHAR(20) NOT NULL,
      address TEXT NOT NULL,
      city VARCHAR(100) NOT NULL,
      state VARCHAR(50) NOT NULL,
      zip_code VARCHAR(10) NOT NULL,
      used BOOLEAN DEFAULT FALSE,
      used_at TIMESTAMP,
      created_at TIMESTAMP DEFAULT NOW()
    );

Configuration

Environment Variables (.env)

# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=leads_db
DB_USER=your_username
DB_PASSWORD=your_password

# Browser Configuration
HEADLESS=false
CHROME_PATH=/usr/bin/google-chrome

# Target Website
TARGET_URL=https://example.com/form

# Proxy Configuration
PROXY_ENABLED=true
FOXY_PROXY_PATH=/path/to/foxy-proxy-extension

# Logging
LOG_LEVEL=info

Form Selectors

Update the form selectors in config.js to match your target website:

formSelectors: {
  firstName: 'input[name="firstName"]',
  lastName: 'input[name="lastName"]',
  email: 'input[name="email"]',
  phone: 'input[name="phone"]',
  address: 'input[name="address"]',
  city: 'input[name="city"]',
  state: 'select[name="state"]',
  zipCode: 'input[name="zipCode"]',
  submitButton: 'button[type="submit"]'
}

Usage

Run a single test cycle

npm start -- --test

Start the automation scheduler

npm start

Development mode with auto-restart

npm run dev

How It Works

  1. IP Detection: The system detects the current IP address and geolocation
  2. Lead Matching: Finds unused leads from the database matching the current IP's state/region
  3. Browser Initialization: Launches Chrome with stealth settings to avoid detection
  4. Form Filling: Fills the form with human-like behavior (typing delays, mouse movements)
  5. Submission: Submits the form and marks the lead as used
  6. Scheduling: Runs every 250 seconds to complete before the 300-second proxy rotation

Key Components

FormAutomation.js

  • Main automation logic with Puppeteer
  • Human-like behavior simulation
  • Jornaya detection evasion
  • Form filling and submission

GeoDetector.js

  • IP geolocation detection
  • Database lead matching
  • Lead management (mark as used)

index.js

  • Orchestrates the automation cycles
  • Handles scheduling and timing
  • Graceful shutdown management

Jornaya Evasion Features

  • Stealth Plugin: Uses puppeteer-extra-plugin-stealth
  • User Agent Rotation: Random realistic user agents
  • Human-like Delays: Random typing and movement delays
  • Realistic Headers: Proper HTTP headers
  • Viewport Management: Realistic browser viewport
  • Mouse Movements: Curved mouse movement paths

Proxy Integration

The system is designed to work with FoxyProxy extension:

  • Form filling completes within 200 seconds
  • Proxy rotation occurs every 300 seconds
  • 50-second buffer ensures completion before IP change

Database Schema

CREATE TABLE leads (
  id SERIAL PRIMARY KEY,
  first_name VARCHAR(100) NOT NULL,
  last_name VARCHAR(100) NOT NULL,
  email VARCHAR(255) NOT NULL,
  phone VARCHAR(20) NOT NULL,
  address TEXT NOT NULL,
  city VARCHAR(100) NOT NULL,
  state VARCHAR(50) NOT NULL,
  zip_code VARCHAR(10) NOT NULL,
  used BOOLEAN DEFAULT FALSE,
  used_at TIMESTAMP,
  created_at TIMESTAMP DEFAULT NOW()
);

Troubleshooting

Common Issues

  1. Chrome not found: Set CHROME_PATH in .env
  2. Database connection: Check database credentials and connection
  3. Form selectors: Update selectors in config.js to match your target site
  4. Proxy issues: Ensure FoxyProxy is properly configured

Logs

Check the console output for detailed logs. The system logs:

  • IP detection results
  • Lead matching information
  • Form filling progress
  • Error details

Security Considerations

  • Store sensitive data in environment variables
  • Use secure database connections
  • Implement rate limiting if needed
  • Monitor for detection and adjust behavior accordingly

License

MIT License

About

Browser automation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages