Skip to content

Lwuisyy/ghost-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

    โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–‘โ–‘โ–ˆโ–ˆโ•—โ–‘โ–‘โ–ˆโ–ˆโ•—โ–‘โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
    โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–‘โ–‘โ–ˆโ–ˆโ•‘โ–‘โ–‘โ–ˆโ–ˆโ•‘โ–‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–‘โ–‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–‘โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•
    โ–ˆโ–ˆโ•‘โ–‘โ–‘โ–ˆโ–ˆโ•—โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–‘โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–‘โ–‘โ–‘โ–‘โ–ˆโ–ˆโ•‘โ–‘โ–‘โ–‘
    โ–ˆโ–ˆโ•‘โ–‘โ–‘โ•šโ–ˆโ–ˆโ•—โ–‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–‘โ–‘โ•šโ•โ•โ•โ–ˆโ–ˆโ•—โ–‘โ–‘โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘โ–‘โ–‘โ–‘โ–‘โ–ˆโ–ˆโ•‘โ–‘โ–‘โ–‘
    โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–‘โ–ˆโ–ˆโ•‘โ–‘โ–‘โ–ˆโ–ˆโ•‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–‘โ–‘โ–‘โ–‘โ–ˆโ–ˆโ•‘โ–‘โ–‘โ–‘
    โ–‘โ•šโ•โ•โ•โ•โ•โ•โ–‘โ–‘โ•šโ•โ•โ–‘โ–‘โ•šโ•โ•โ–‘โ•šโ•โ•โ•โ•โ•โ•โ–‘โ–‘โ•šโ•โ•โ•โ•โ•โ•โ•โ–‘โ–‘โ–‘โ–‘โ•šโ•โ•โ–‘โ–‘โ–‘
                    A G E N T

๐Ÿ‘ป Anti-Detection Infrastructure for AI Agents

They see pages. We see through walls.

TypeScript Node License


The Invisible Problem

Every day, thousands of AI agents hit the same wall:

403 Forbidden โ€” Access Denied

CAPTCHAs. IP bans. Fingerprint detection. Bot traps. The web was built for humans, and it knows when you're not one.

Ghost Agent makes your AI agents invisible. Not by hiding โ€” by becoming indistinguishable from real users.


๐Ÿ‘๏ธ What Ghost Sees

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    GHOST AGENT                          โ”‚
โ”‚                                                         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”‚
โ”‚  โ”‚  Proxy    โ”‚  โ”‚  Session โ”‚  โ”‚ Browser  โ”‚              โ”‚
โ”‚  โ”‚  Phantom  โ”‚  โ”‚  Wraith  โ”‚  โ”‚  Mask    โ”‚              โ”‚
โ”‚  โ”‚          โ”‚  โ”‚          โ”‚  โ”‚          โ”‚              โ”‚
โ”‚  โ”‚ 4 strat  โ”‚  โ”‚ isolated โ”‚  โ”‚ realisticโ”‚              โ”‚
โ”‚  โ”‚ auto-healโ”‚  โ”‚ cookies  โ”‚  โ”‚ fingerprintโ”‚            โ”‚
โ”‚  โ”‚ geo-routeโ”‚  โ”‚ dispose  โ”‚  โ”‚ stealth  โ”‚              โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ”‚
โ”‚                                                         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”‚
โ”‚  โ”‚ CAPTCHA  โ”‚  โ”‚  Rate    โ”‚  โ”‚  Block   โ”‚              โ”‚
โ”‚  โ”‚  Breaker โ”‚  โ”‚  Mimic   โ”‚  โ”‚  Sense   โ”‚              โ”‚
โ”‚  โ”‚          โ”‚  โ”‚          โ”‚  โ”‚          โ”‚              โ”‚
โ”‚  โ”‚ reCAPTCHAโ”‚  โ”‚ human    โ”‚  โ”‚ Cloudflareโ”‚             โ”‚
โ”‚  โ”‚ hCaptcha โ”‚  โ”‚ jitter   โ”‚  โ”‚ DataDome โ”‚              โ”‚
โ”‚  โ”‚ Turnstileโ”‚  โ”‚ gaussian โ”‚  โ”‚ PerimeterXโ”‚             โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ”‚
โ”‚                                                         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โšก Possession (Quick Start)

# Summon
git clone https://github.com/Lwuisyy/ghost-agent.git
cd ghost-agent
npm install

# Configure your proxies + CAPTCHA keys
cp .env.example .env
import { GhostAgent } from 'ghost-agent';

const ghost = new GhostAgent();
await ghost.init();

// A new identity materializes
const session = ghost.createSession();

// Walk through walls
const res = await ghost.fetch({
  url: 'https://protected-site.com',
  sessionId: session.id,
  retryOnCaptcha: true,
});

console.log(res.status); // 200 ๐Ÿ‘ป

// Vanish
ghost.destroy();

๐Ÿ”ฎ The Six Masks

1. Proxy Phantom

    โ”Œโ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”
    โ”‚ P1โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ P2โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ P3โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ P1โ”‚  round-robin
    โ””โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”˜

    โ”Œโ”€โ”€โ”€โ”  โœ—  โ”Œโ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”
    โ”‚ P1โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ P2โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ P3โ”‚          auto-retry on failure
    โ””โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”˜

Four rotation strategies: round-robin, random, least-used, geo-target. Dead proxies are automatically quarantined. Health checks run in the background.

2. Session Wraith

Each session is a completely separate identity โ€” unique fingerprint, isolated cookie jar, dedicated proxy binding. When a session expires, every trace vanishes with it.

const alice = ghost.createSession();
const bob   = ghost.createSession();

alice.fingerprint.userAgent !== bob.fingerprint.userAgent  // true
alice.fingerprint.canvasHash !== bob.fingerprint.canvasHash // true
// Same agent. Two ghosts.

3. Browser Mask

Generates internally consistent browser fingerprints. Not random noise โ€” realistic profiles where every detail matches:

Layer What's Masked
User-Agent Chrome 120โ€“128, Firefox 121โ€“128, Safari 17โ€“18, Edge
Platform Windows, macOS, Linux (consistent with UA)
WebGL Realistic GPU vendors + renderers
Canvas Unique but stable hash per session
Audio AudioContext fingerprint
Fonts Plausible installed font lists
Headers Sec-Ch-Ua, Sec-Fetch, proper ordering
Timezone Matched to proxy geo when available

4. CAPTCHA Breaker

Unified solver for the big three. Auto-detects challenges in responses and solves them transparently:

// You don't call this. Ghost does.
ghost.on('captcha-detected', (task, session) => {
  // reCAPTCHA v2/v3 โ€ข hCaptcha โ€ข Cloudflare Turnstile
  console.log(`Breaking ${task.type} for session ${session}...`);
});

Supports 2captcha and anti-captcha with automatic fallback.

5. Rate Mimic

Humans don't send 47 requests per second. Ghost doesn't either:

rateLimit: {
  minDelay: 1000,      // minimum pause
  maxDelay: 5000,      // maximum pause
  humanJitter: true,   // gaussian distribution
  maxConcurrent: 3,    // parallel limit
}

Delays follow a Gaussian-like distribution โ€” not uniform, not predictable. Just like a real person scrolling.

6. Block Sense

Ghost knows when it's been spotted:

ghost.on('block-detected', (url, session) => {
  // Cloudflare challenge page
  // DataDome / PerimeterX WAF
  // Generic 403 / "Access Denied"
  // "Just a moment..." interstitial
});

๐Ÿ‘ป Haunt at Scale

// 50 URLs. 5 concurrent ghosts. Each with their own identity.
const results = await ghost.fetchBatch(
  urls.map(url => ({ url, retryOnCaptcha: true })),
  5
);

๐Ÿ•ฏ๏ธ Sรฉance (Events)

ghost.on('request',          (req) => { /* outgoing request */ });
ghost.on('response',         (res) => { /* incoming response */ });
ghost.on('block-detected',   (url, session) => { /* we've been spotted */ });
ghost.on('captcha-detected', (task, session) => { /* challenge ahead */ });
ghost.on('proxy-fail',       (proxy, err) => { /* proxy is dead */ });
ghost.on('session-created',  (session) => { /* new ghost born */ });
ghost.on('session-destroyed',(id) => { /* ghost vanished */ });

๐Ÿ—๏ธ Configuration

Every setting works through environment variables or constructor options:

# โ”€โ”€ Proxies โ”€โ”€
PROXY_LIST=http://user:pass@proxy1.com:8080,socks5://proxy2.com:1080
PROXY_STRATEGY=round-robin          # round-robin | random | least-used | geo-target
PROXY_MAX_RETRIES=3
PROXY_HEALTH_CHECK_INTERVAL=30000

# โ”€โ”€ CAPTCHA โ”€โ”€
CAPTCHA_PROVIDER=2captcha           # 2captcha | anti-captcha | capsolver
CAPTCHA_API_KEY=your-key

# โ”€โ”€ Sessions โ”€โ”€
MAX_SESSIONS=10
SESSION_TTL=300000

# โ”€โ”€ Rate Limit โ”€โ”€
RATE_LIMIT_MIN_DELAY=1000
RATE_LIMIT_MAX_DELAY=5000
HUMAN_JITTER=true

# โ”€โ”€ Logging โ”€โ”€
LOG_LEVEL=info                      # trace | debug | info | warn | error

๐Ÿ“œ The Ritual (Examples)

# Web scraping through haunted proxies
npm run example:scrape

# API testing with multiple ghost identities
npm run example:api

# Run the smoke test sรฉance
npx tsx tests/smoke-test.ts

๐Ÿ—บ๏ธ The Roadmap

Status Feature
โ—ป๏ธ TLS fingerprint masking (JA3/JA4) โ€” spoof the TLS handshake itself
โ—ป๏ธ Playwright / Puppeteer bridge โ€” real browser automation with ghost stealth
โ—ป๏ธ Proxy provider APIs โ€” BrightData, Oxylabs, Smartproxy auto-integration
โ—ป๏ธ Session persistence โ€” save & restore ghost identities across restarts
โ—ป๏ธ Cloudflare challenge auto-solver โ€” bypass the "Just a moment..." wall
โ—ป๏ธ Residential proxy auto-rotation โ€” per-domain residential IP cycling
โ—ป๏ธ Request/response recording โ€” full trajectory capture for debugging
โ—ป๏ธ MCP server โ€” let AI agents (Claude, Cursor, etc.) invoke ghost as a tool

Want to contribute? Pick an item, open a PR, and join the haunting.


๐Ÿชฆ License

MIT โ€” Use it. Fork it. Haunt the web with it.


        .-.
       (o o) boo!
       | O |
      _|   |_
     / |   | \
    /  |   |  \
       '---'

  made for agents that refuse to be seen

About

๐Ÿ‘ป Anti-detection infrastructure for AI agents โ€” proxy rotation, browser fingerprinting, session isolation, CAPTCHA solving

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors