auto-account-machine/docs/tools/account-register.md
dengqichen bf55bcee27 aaaaa
2025-11-16 19:46:13 +08:00

260 lines
6.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 账号注册工具 (Account Register)
自动化账号注册工具,支持步骤化流程和反检测技术。
## 功能特性
- ✅ 步骤化注册流程(每个网站独立定义)
- ✅ 反检测技术rebrowser-puppeteer
- ✅ 人类行为模拟
- ✅ 自动数据生成(姓名、邮箱、密码等)
- ✅ 支持部分步骤执行
- ✅ 干运行模式
## 快速开始
### 1. 生成账号数据(干运行)
```bash
node src/cli.js register -s windsurf --dry-run
```
输出示例:
```
firstName: John
lastName: Smith
fullName: John Smith
email: user_17001234_abc123@gmail.com
username: quickwolf456
password: Xy9#mK2$pL5@
timestamp: 2024-11-16T11:30:00.000Z
```
### 2. 执行第一步注册
```bash
node src/cli.js register -s windsurf --from-step 1 --to-step 1
```
这将:
1. 生成账号数据
2. 启动浏览器(反检测模式)
3. 打开注册页面
4. 自动填写 First Name, Last Name, Email
5. 点击 Continue 按钮
### 3. 执行完整注册流程
```bash
node src/cli.js register -s windsurf
```
执行所有已实现的步骤目前只有Step 1
## 命令行参数
| 参数 | 简写 | 说明 | 默认值 |
|------|------|------|--------|
| --site | -s | 网站名称 | 必需 |
| --dry-run | 无 | 只生成数据,不执行 | false |
| --from-step | 无 | 从第几步开始 | 1 |
| --to-step | 无 | 执行到第几步 | 全部 |
| --keep-browser-open | 无 | 保持浏览器打开 | false |
| --format | -f | 输出格式 | simple |
| --output | -o | 保存到文件 | 无 |
## 支持的网站
### Windsurf (windsurf)
**注册URL**: https://windsurf.com/account/register
**步骤总数**: 3步目前实现1步
**步骤详情**:
1. ✅ 填写基本信息First Name, Last Name, Email
2. ⏳ 设置密码(待实现)
3. ⏳ 邮箱验证(待实现)
## 使用示例
### 示例1测试数据生成
```bash
# 生成通用账号数据
node src/cli.js register generate
# 生成Windsurf专用数据
node src/cli.js register -s windsurf --dry-run
# JSON格式输出
node src/cli.js register generate -f json
```
### 示例2自动化注册
```bash
# 执行第一步
node src/cli.js register -s windsurf --from-step 1 --to-step 1
# 保持浏览器打开(手动完成后续步骤)
node src/cli.js register -s windsurf --keep-browser-open
# 保存账号数据到文件
node src/cli.js register -s windsurf -o account.json
```
### 示例3分步骤执行
```bash
# 只执行第一步
node src/cli.js register -s windsurf --to-step 1
# 从第二步继续(需要先完成第一步)
node src/cli.js register -s windsurf --from-step 2
```
## 反检测技术
### 使用的技术
1. **rebrowser-puppeteer**: 修补版Puppeteer修复CDP泄漏
2. **人类行为模拟**: 随机延迟、真实鼠标轨迹、自然输入节奏
3. **指纹随机化**: 随机视口、用户代理、语言设置
详细说明请查看: [ANTI-DETECTION.md](../account-register/ANTI-DETECTION.md)
### 测试反检测效果
访问以下网站测试是否被识别为bot
- https://bot-detector.rebrowser.net/
- https://arh.antoinevastel.com/bots/areyouheadless
- https://abrahamjuliot.github.io/creepjs
## 添加新网站
### 1. 创建网站脚本
`src/tools/account-register/sites/` 目录创建新文件,例如 `github.js`
```javascript
const AccountDataGenerator = require('../generator');
const HumanBehavior = require('../utils/human-behavior');
const logger = require('../../../shared/logger');
class GitHubRegister {
constructor() {
this.siteName = 'GitHub';
this.siteUrl = 'https://github.com/signup';
this.dataGen = new AccountDataGenerator();
this.human = new HumanBehavior();
this.currentStep = 0;
// 定义步骤
this.steps = [
{ id: 1, name: '填写邮箱', method: 'step1_fillEmail' },
{ id: 2, name: '设置密码', method: 'step2_setPassword' },
{ id: 3, name: '填写用户名', method: 'step3_fillUsername' },
// 更多步骤...
];
}
generateData(options = {}) {
return this.dataGen.generateAccount(options);
}
async initBrowser() {
// 使用Windsurf的实现
}
async step1_fillEmail() {
// 实现第一步
}
async register(options = {}) {
// 实现主流程
}
}
module.exports = GitHubRegister;
```
### 2. 使用新脚本
```bash
node src/cli.js register -s github
```
工具会自动发现并加载新脚本。
## 编程使用
```javascript
const WindsurfRegister = require('./src/tools/account-register/sites/windsurf');
(async () => {
const register = new WindsurfRegister();
try {
const result = await register.register({
fromStep: 1,
toStep: 1,
keepBrowserOpen: true
});
console.log('注册结果:', result);
} catch (error) {
console.error('注册失败:', error);
}
})();
```
## 注意事项
⚠️ **重要提醒**
1. **遵守服务条款**: 确保使用符合网站的服务条款
2. **频率限制**: 避免短时间内大量注册
3. **验证码**: 遇到验证码时需要手动处理
4. **IP地址**: 建议使用住宅代理避免数据中心IP
5. **法律合规**: 仅用于合法的测试和个人用途
## 故障排除
### 问题1: 浏览器无法启动
**解决方案**:
```bash
# 重新安装依赖
rm -rf node_modules package-lock.json
npm install
```
### 问题2: 元素找不到
**解决方案**:
- 检查网站是否更新了页面结构
- 增加等待时间
- 使用浏览器开发工具查看实际的选择器
### 问题3: 仍然被识别为bot
**解决方案**:
1. 使用住宅代理
2. 增加操作延迟
3. 添加更多人类行为(滚动、鼠标移动)
4. 考虑使用半自动模式
## 性能优化
- 使用 `--headless` 模式(但容易被检测)
- 禁用图片加载
- 使用更快的选择器
- 缓存浏览器实例
## 相关资源
- [反检测技术文档](../account-register/ANTI-DETECTION.md)
- [rebrowser-patches](https://github.com/rebrowser/rebrowser-patches)
- [人类行为模拟最佳实践](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth)