Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPT 登录系统

基于 BitBrowser 指纹浏览器 + wremail 邮件 API 的 GPT OAuth 自动化登录系统。

功能特性

  • BitBrowser 指纹浏览器:模拟真实浏览器环境,支持代理配置
  • wremail 邮件 API:快速获取 Outlook 邮件验证码
  • 完整错误追踪:错误时自动保存 HTML 快照和截图
  • 数据库存储:Token 和日志存入本地 SQLite 数据库(无需安装数据库服务)
  • 批量登录支持:支持自动化批量登录

系统架构

┌─────────────────────────────────────────────────────────────┐
│                         index.js                            │
│                     (主程序入口)                             │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                        gpt-login.js                         │
│               (GPT OAuth 登录核心流程)                       │
├─────────────────────────────────────────────────────────────┤
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐    │
│  │ bitbrowser.js│  │wremail-module.js│  │error-tracker │    │
│  │  (浏览器)    │  │  (邮件API)   │  │  (错误追踪)  │    │
│  └──────────────┘  └──────────────┘  └──────────────┘    │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                          db.js                              │
│                   (SQLite 数据库操作)                        │
├─────────────────────────────────────────────────────────────┤
│  pool_emails | login_sessions | access_tokens |            │
│  error_snapshots | operation_logs | proxy_assets            │
└─────────────────────────────────────────────────────────────┘

快速开始

1. 安装依赖

npm install

2. 数据库初始化

SQLite 数据库会在首次运行时自动创建,无需手动配置。

3. 配置环境变量

复制 .env.example.env 并配置:

cp .env.example .env

编辑 .env 文件:

# BitBrowser API 地址
BITBROWSER_API_URL=http://127.0.0.1:54345

# wremail 邮件 API 配置
WREMAIL_API_BASE=http://wremail.cc
POOL_EMAIL_CLIENT_ID=your_client_id
POOL_EMAIL_REFRESH_TOKEN=your_refresh_token

4. 添加邮箱数据

const db = require('./db');

// 插入测试邮箱
db.insert(`
    INSERT INTO pool_emails (email, password, client_id, refresh_token, is_active)
    VALUES (?, ?, ?, ?, 1)
`, ['test@example.com', 'password123', 'your_client_id', 'your_refresh_token']);

5. 运行登录

# 使用指定邮箱登录
node index.js login test@example.com

# 从邮箱池获取邮箱登录
node index.js pool

# 批量登录
node index.js batch 5

# 测试邮件 API
node index.js test:email test@example.com

# 测试浏览器连接
node index.js test:browser

数据库表结构

数据库文件位于 data/plus_paypal.db,包含以下表:

pool_emails - 邮箱资产表

字段 类型 说明
id BIGINT 自增ID
email VARCHAR(255) 邮箱地址
password VARCHAR(512) 邮箱密码
client_id VARCHAR(128) wremail API client_id
refresh_token TEXT wremail API refresh_token
registered TINYINT 是否已注册
in_use TINYINT 是否正在使用

login_sessions - 登录会话表

字段 类型 说明
id BIGINT 自增ID
email VARCHAR(255) 邮箱地址
session_id VARCHAR(64) 会话ID
status VARCHAR(32) 状态
error_message TEXT 错误信息

access_tokens - AccessToken 存储表

字段 类型 说明
id BIGINT 自增ID
email VARCHAR(255) 邮箱地址
access_token TEXT Access Token
refresh_token TEXT Refresh Token
id_token TEXT ID Token
account_id VARCHAR(128) ChatGPT 账户ID
raw_response JSON 完整 API 响应

error_snapshots - 错误快照表

字段 类型 说明
id BIGINT 自增ID
session_id VARCHAR(64) 会话ID
step_name VARCHAR(64) 出错时的步骤
html_content MEDIUMTEXT 页面 HTML
screenshot_path VARCHAR(512) 截图路径
cookies JSON 当前 Cookies
local_storage JSON LocalStorage

登录流程步骤

  1. 初始化 - 启动回调服务器
  2. 打开浏览器 - 通过 BitBrowser 打开指纹浏览器
  3. 导航授权页 - 打开 OpenAI OAuth 授权页
  4. 输入邮箱 - 填入邮箱地址
  5. 等待验证码 - 通过 wremail API 获取验证码
  6. 输入验证码 - 填入 6 位验证码
  7. 等待回调 - 等待 OAuth 回调
  8. 交换 Token - 用 code 换取 access_token
  9. 保存结果 - Token 存入数据库

错误处理

错误时系统会自动:

  1. 保存当前页面的 HTML 快照到 snapshots/ 目录
  2. 保存页面截图
  3. 记录 Cookies 和 LocalStorage
  4. 将所有信息存入 error_snapshots

查看错误快照:

node index.js snapshots

API 凭证

wremail API

使用 wremail API 获取 Outlook 邮件验证码:

const wremail = require('./wremail-module');
const result = await wremail.getCode(email, clientId, refreshToken, (round) => {
    if (round % 10 === 0) console.log(`轮询 ${round}...`);
});
const code = result.code;

环境变量

变量 默认值 说明
BITBROWSER_API_URL http://127.0.0.1:54345 BitBrowser API
WREMAIL_API_BASE http://wremail.cc wremail API 地址
POOL_EMAIL_CLIENT_ID - wremail client_id
POOL_EMAIL_REFRESH_TOKEN - wremail refresh_token
BROWSER_PROVIDER bitbrowser 浏览器提供商
HEADFUL 0 是否显示浏览器

许可证

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages