camofox-browser

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Camofox Browser - Anti-Detection Browser Automation

Camofox浏览器 - 反检测浏览器自动化

Stealth browser automation via Camoufox (Firefox fork). C++ level fingerprint spoofing — undetectable by JavaScript-based bot checks. REST API wrapper using
curl
.
通过Camofox(Firefox分支浏览器)实现隐身浏览器自动化。基于C++层面的指纹伪造技术,可规避基于JavaScript的机器人检测。提供基于
curl
的REST API封装。

Installation

安装

First use automatically downloads and installs the Camoufox browser (~300MB, one-time). No manual setup required — just run any
camofox
command.
首次使用时会自动下载并安装Camoufox浏览器(约300MB,仅需一次)。无需手动配置,只需运行任意
camofox
命令即可。

Quick Start

快速开始

bash
camofox open https://example.com          # Open URL (auto-starts server)
camofox snapshot                          # Get page elements with @refs
camofox click @e1                         # Click element
camofox type @e2 "hello"                  # Type text
camofox screenshot                        # Take screenshot
camofox close                             # Close tab
bash
camofox open https://example.com          # Open URL (auto-starts server)
camofox snapshot                          # Get page elements with @refs
camofox click @e1                         # Click element
camofox type @e2 "hello"                  # Type text
camofox screenshot                        # Take screenshot
camofox close                             # Close tab

Core Workflow

核心工作流程

  1. Navigate:
    camofox open <url>
    — opens tab and navigates
  2. Snapshot:
    camofox snapshot
    — returns accessibility tree with
    @e1
    ,
    @e2
    refs
  3. Interact: Use refs to click, type, select
  4. Re-snapshot: After navigation or DOM changes, get fresh refs
  5. Repeat: Server stays running between commands
bash
camofox open https://example.com/login
camofox snapshot
  1. 导航
    camofox open <url>
    — 打开标签页并导航至目标地址
  2. 快照
    camofox snapshot
    — 返回带有
    @e1
    @e2
    等引用标识的可访问性树
  3. 交互:使用引用标识执行点击、输入、选择等操作
  4. 重新快照:页面导航或DOM内容变更后,获取新的引用标识
  5. 重复操作:服务器会在命令之间保持运行状态
bash
camofox open https://example.com/login
camofox snapshot

@e1 [input] Email @e2 [input] Password @e3 [button] Sign In

@e1 [input] Email @e2 [input] Password @e3 [button] Sign In

camofox type @e1 "user@example.com" camofox type @e2 "password123" camofox click @e3 camofox snapshot # Re-snapshot after navigation
undefined
camofox type @e1 "user@example.com" camofox type @e2 "password123" camofox click @e3 camofox snapshot # Re-snapshot after navigation
undefined

Commands

命令列表

Navigation

导航命令

bash
camofox open <url>                   # Create tab + navigate (aliases: goto)
camofox navigate <url>               # Navigate current tab
camofox back                         # Go back
camofox forward                      # Go forward
camofox refresh                      # Reload page
camofox scroll down                  # Scroll down (also: up, left, right)
bash
camofox open <url>                   # Create tab + navigate (aliases: goto)
camofox navigate <url>               # Navigate current tab
camofox back                         # Go back
camofox forward                      # Go forward
camofox refresh                      # Reload page
camofox scroll down                  # Scroll down (also: up, left, right)

Page State

页面状态命令

bash
camofox snapshot                     # Accessibility snapshot with @refs
camofox screenshot                   # Screenshot to /tmp/camofox-screenshots/
camofox screenshot output.png        # Screenshot to specific path
camofox tabs                         # List all open tabs
bash
camofox snapshot                     # Accessibility snapshot with @refs
camofox screenshot                   # Screenshot to /tmp/camofox-screenshots/
camofox screenshot output.png        # Screenshot to specific path
camofox tabs                         # List all open tabs

Interaction (use @refs from snapshot)

交互命令(使用快照中的@refs)

bash
camofox click @e1                    # Click element
camofox type @e1 "text"              # Type into element
bash
camofox click @e1                    # Click element
camofox type @e1 "text"              # Type into element

Search Macros

搜索宏命令

bash
camofox search google "query"        # Google search
camofox search youtube "query"       # YouTube search
camofox search amazon "query"        # Amazon search
camofox search reddit "query"        # Reddit search
13 macros available — see references/macros-and-search.md.
bash
camofox search google "query"        # Google search
camofox search youtube "query"       # YouTube search
camofox search amazon "query"        # Amazon search
camofox search reddit "query"        # Reddit search
共提供13个宏命令,详情请查看references/macros-and-search.md

Session Management

会话管理

bash
camofox --session work open <url>    # Isolated session
camofox --session work snapshot      # Use specific session
camofox close                        # Close current tab
camofox close-all                    # Close all tabs in session
bash
camofox --session work open <url>    # Isolated session
camofox --session work snapshot      # Use specific session
camofox close                        # Close current tab
camofox close-all                    # Close all tabs in session

Server Control

服务器控制

bash
camofox start                        # Start server (usually auto)
camofox stop                         # Stop server
camofox health                       # Health check
bash
camofox start                        # Start server (usually auto)
camofox stop                         # Stop server
camofox health                       # Health check

Ref Lifecycle (Important)

引用标识生命周期(重要)

Refs (
@e1
,
@e2
) are invalidated when the page changes. Always re-snapshot after:
  • Clicking links/buttons that navigate
  • Form submissions
  • Dynamic content loading
bash
camofox click @e3                    # Navigates to new page
camofox snapshot                     # MUST re-snapshot
camofox click @e1                    # Use new refs
当页面内容发生变化时,引用标识(
@e1
@e2
等)会失效。在以下操作后必须重新快照:
  • 点击会触发页面导航的链接或按钮
  • 提交表单
  • 动态内容加载完成
bash
camofox click @e3                    # Navigates to new page
camofox snapshot                     # MUST re-snapshot
camofox click @e1                    # Use new refs

When to Use camofox-browser vs agent-browser

Camofox-browser与agent-browser的适用场景对比

ScenarioTool
Normal websites, no bot detectionagent-browser (faster)
Cloudflare / Akamai protectedcamofox-browser
Sites that block Chromium automationcamofox-browser
Need anti-fingerprintingcamofox-browser
Need iOS/mobile simulationagent-browser
Need video recordingagent-browser
场景推荐工具
普通网站,无反机器人检测agent-browser(速度更快)
受Cloudflare / Akamai保护的站点camofox-browser
拦截Chromium自动化工具的站点camofox-browser
需要反指纹伪造功能camofox-browser
需要iOS/移动端模拟agent-browser
需要视频录制功能agent-browser

Anti-Detection Capabilities

反检测能力

  • C++ level fingerprint spoofing (canvas, WebGL, AudioContext, fonts)
  • Firefox-based (not Chromium — different detection surface)
  • Human-like interaction timing (
    humanize
    parameter)
  • WebRTC leak prevention
  • No
    navigator.webdriver
    flag
See references/anti-detection.md for details.
  • 基于C++层面的指纹伪造(覆盖canvas、WebGL、AudioContext、字体等维度)
  • 基于Firefox内核(非Chromium,检测特征完全不同)
  • 类人类交互时序控制(
    humanize
    参数)
  • 防止WebRTC信息泄露
  • navigator.webdriver
    标识
详情请查看references/anti-detection.md

Environment Variables

环境变量

VariableDefaultDescription
CAMOFOX_PORT
9377
Server port
CAMOFOX_SESSION
default
Default session name
CAMOFOX_HEADLESS
true
Headless mode
HTTPS_PROXY
Proxy server
环境变量默认值说明
CAMOFOX_PORT
9377
服务器端口
CAMOFOX_SESSION
default
默认会话名称
CAMOFOX_HEADLESS
true
无头模式开关
HTTPS_PROXY
代理服务器地址

Deep-Dive Documentation

深度文档

ReferenceWhen to Use
references/api-reference.mdFull REST API endpoint docs
references/anti-detection.mdFingerprint spoofing details
references/macros-and-search.md13 search macros
文档链接适用场景
references/api-reference.md完整REST API端点文档
references/anti-detection.md指纹伪造技术细节
references/macros-and-search.md13个搜索宏命令详情

Ready-to-Use Templates

即用型模板

TemplateDescription
templates/stealth-scrape.shAnti-detection scraping workflow
templates/multi-session.shMulti-session isolation
模板链接说明
templates/stealth-scrape.sh反检测爬取工作流模板
templates/multi-session.sh多会话隔离模板

Troubleshooting

故障排查

Server won't start?
bash
camofox health                        # Check if running
camofox stop && camofox start         # Restart
Still getting blocked?
bash
undefined
服务器无法启动?
bash
camofox health                        # Check if running
camofox stop && camofox start         # Restart
仍然被拦截?
bash
undefined

Enable proxy

Enable proxy

HTTPS_PROXY=socks5://127.0.0.1:1080 camofox open <url>

**Bot detection test:**
```bash
camofox open https://bot.sannysoft.com/
camofox screenshot bot-test.png
HTTPS_PROXY=socks5://127.0.0.1:1080 camofox open <url>

**机器人检测测试:**
```bash
camofox open https://bot.sannysoft.com/
camofox screenshot bot-test.png

Cleanup

清理操作

Always close when done:
bash
camofox close-all
camofox stop
使用完毕后请务必执行以下命令:
bash
camofox close-all
camofox stop