Skip to content

Repository files navigation

Auro Reg Automation

中文文档

Auro Reg Automation is a local automation toolkit for registering free GPT accounts, orchestrating email-code retrieval, browser-based registration, SMS verification, and Sub2API OAuth account import.

The project is split into two FastAPI services:

  • owned-mail-code-service: reads verification emails from owned Outlook/Hotmail mailboxes through IMAP and Microsoft OAuth refresh tokens.
  • web-register-sub2api-automation: drives the registration and import workflow with Playwright, SMS providers, and Sub2API.

It is designed for controlled local deployments where the operator owns the mailboxes, credentials, browser profile, and target service configuration.

Features

  • Outlook/Hotmail verification-code retrieval through IMAP + OAuth2.
  • Browser automation with Playwright or an existing Chrome/Edge instance through CDP.
  • Unified registration/import entrypoint that can resume interrupted imports.
  • SMS verification through configurable providers, currently 5sim and 62-US.
  • Sub2API OAuth import with group, priority, and concurrency settings.
  • Batch processing with mailbox lifecycle tracking.
  • Local-first deployment with explicit .env.example templates and runtime data ignored by git.

Architecture

owned-mail-code-service (:5050)
        │
        │  /api/code
        ▼
web-register-sub2api-automation (:5060)
        │
        ├─ Playwright / Chrome CDP (:9222)
        ├─ SMS provider (5sim / 62-US)
        └─ Sub2API (:8080)

Components

Component Default Purpose
owned-mail-code-service 127.0.0.1:5050 Mailbox account store and verification-code API
web-register-sub2api-automation 127.0.0.1:5060 Workflow coordinator and public automation API
Chrome CDP 127.0.0.1:9222 Real browser automation for pages that need a normal browser profile
Sub2API 127.0.0.1:8080 Destination service for imported OAuth accounts

Repository Layout

.
├─ owned-mail-code-service/
│  ├─ app/
│  ├─ tests/
│  ├─ .env.example
│  ├─ accounts.example.txt
│  └─ run.ps1
├─ web-register-sub2api-automation/
│  ├─ app/
│  ├─ .env.example
│  ├─ emails.example.txt
│  ├─ inspect_live.py
│  └─ run.ps1
├─ run-all.ps1
└─ README.md

Requirements

  • Windows with PowerShell 5.1 or PowerShell 7+
  • Python 3.10+
  • Google Chrome or Microsoft Edge
  • A running Sub2API instance
  • Owned Outlook/Hotmail mailboxes with Microsoft OAuth refresh tokens for IMAP access
  • A supported SMS provider account (5sim or 62-US)

Quick Start

Clone the repository and create both virtual environments.

git clone <repo-url>
cd auro-reg

Set up the mail-code service:

cd owned-mail-code-service
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install --upgrade pip
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
Copy-Item .env.example .env
Copy-Item accounts.example.txt accounts.txt

Set up the registration/import service:

cd ..\web-register-sub2api-automation
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install --upgrade pip
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
.\.venv\Scripts\python.exe -m playwright install chromium
Copy-Item .env.example .env
Copy-Item emails.example.txt emails.txt

Edit both .env files before starting the services.

Configuration

Mail-Code Service

owned-mail-code-service/accounts.txt stores mailbox credentials, one account per line:

email----password----client_id----refresh_token

The parser splits only on the first three ---- separators, so refresh tokens may contain the same sequence.

Required .env values:

API_KEY=your-mail-code-service-key
ACCOUNTS_FILE=accounts.txt
DB_FILE=mail_codes.db

Useful options:

ENABLE_BACKGROUND_POLLER=false
CODE_POLL_INTERVAL_SECONDS=6
CODE_SINCE_GRACE_SECONDS=90
IMAP_PROXY=

Registration And Import Service

Required .env values:

API_KEY=your-register-service-key
REGISTER_URL=https://your-register-page.example.com
MAIL_CODE_SERVICE_API_KEY=your-mail-code-service-key
SMS_PROVIDER=5sim
FIVESIM_TOKEN=your-5sim-token
SUB2API_BASE=http://127.0.0.1:8080
SUB2API_ADMIN_EMAIL=admin@example.com
SUB2API_ADMIN_PASSWORD=your-sub2api-password
SUB2API_DEFAULT_GROUP_IDS=1

Recommended defaults:

NO_PROXY=127.0.0.1,localhost
BROWSER_MODE=cdp
CDP_ENDPOINT=http://127.0.0.1:9222
EMAIL_CODE_SUBJECT_KEYWORD=ChatGPT,OpenAI
EMAIL_CODE_FROM_KEYWORD=openai
PHONE_ALLOW_WHATSAPP_FALLBACK=false
OAUTH_MAX_ATTEMPTS=5
BATCH_PARALLELISM=3

EMAIL_CODE_SUBJECT_KEYWORD=ChatGPT,OpenAI is important because registration and OAuth login emails may use different subject wording. Commas are treated as OR.

Running

Start a Chrome instance with CDP enabled:

& "C:\Program Files\Google\Chrome\Application\chrome.exe" `
  --remote-debugging-port=9222 `
  --user-data-dir="$PWD\.chrome-cdp-profile" `
  --no-first-run `
  --no-default-browser-check `
  about:blank

Start both services in separate terminals:

cd owned-mail-code-service
.\.venv\Scripts\python.exe -m app.main
cd web-register-sub2api-automation
.\.venv\Scripts\python.exe -m app.main

The repository also includes a Windows helper:

.\run-all.ps1        # start Chrome, service A, and service B
.\run-all.ps1 -Auto  # start services and launch a batch run
.\run-all.ps1 -Stop  # stop service A/B Python processes

run-all.ps1 resolves project paths from its own location. Adjust the Chrome path, Chrome profile, or Sub2API reference path at the top of the script when needed.

API Overview

All /api/* endpoints require x-api-key.

$h = @{ "x-api-key" = "your-register-service-key"; "Content-Type" = "application/json" }

Synchronize emails.txt from the mailbox account file:

Invoke-RestMethod "http://127.0.0.1:5060/api/emails/sync" -Method Post -Headers $h

Run the unified workflow for the next eligible mailbox:

Invoke-RestMethod "http://127.0.0.1:5060/api/auto/start" `
  -Method Post `
  -Headers $h `
  -Body (@{ group_ids = @(1) } | ConvertTo-Json)

Run a batch:

Invoke-RestMethod "http://127.0.0.1:5060/api/auto/run-batch" `
  -Method Post `
  -Headers $h `
  -Body (@{ sync = $true; parallelism = 3 } | ConvertTo-Json)

Inspect batch state:

Invoke-RestMethod "http://127.0.0.1:5060/api/auto/batches" -Headers $h

Resume accounts that registered successfully but were not imported:

Invoke-RestMethod "http://127.0.0.1:5060/api/imports/resume" `
  -Method Post `
  -Headers $h `
  -Body (@{ group_ids = @(1) } | ConvertTo-Json)

Mailbox Lifecycle

The registration/import service tracks mailbox state to avoid losing accounts after partial failures:

Status Meaning
in_use A job is currently using the mailbox
registered Web registration succeeded; Sub2API import is still pending
used Sub2API import succeeded
failed The job failed, but the mailbox may be retried
unavailable The mailbox cannot receive codes and should be skipped

Only a successful Sub2API import marks a mailbox as used.

Development

Run the mail-code service tests:

cd owned-mail-code-service
.\.venv\Scripts\python.exe -m pytest

Inspect the active CDP browser page:

cd web-register-sub2api-automation
.\.venv\Scripts\python.exe inspect_live.py now

Screenshots and traces are written to runtime directories that are ignored by git.

Data And Security

This project is designed to keep operational data local. The repository ships only templates such as .env.example, accounts.example.txt, and emails.example.txt.

Runtime configuration, mailbox pools, SQLite databases, logs, screenshots, Playwright traces, browser profiles, cookies, and provider tokens are intentionally excluded by .gitignore.

Before publishing a fork or release, review staged files with:

git status --short
git diff --cached --name-only

License

No license has been declared yet. Add a license before distributing or accepting external contributions.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages