mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-09 17:06:15 +00:00
feat: Simplify account creation commands and enhance recovery email and 2FA handling
This commit is contained in:
42
README.md
42
README.md
@@ -131,23 +131,20 @@ Access at `http://localhost:3000` to:
|
||||
Automatically create new Microsoft accounts with advanced security features:
|
||||
|
||||
```bash
|
||||
# Basic account creation
|
||||
# Interactive mode (asks everything)
|
||||
npm run creator
|
||||
|
||||
# With referral link (earn rewards credit)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE&ref=rafsrchae
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE
|
||||
|
||||
# With recovery email (will prompt for verification code)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE -r backup@gmail.com
|
||||
|
||||
# With 2FA enabled (will prompt for QR code scan)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE --2fa
|
||||
|
||||
# Skip all prompts (no recovery email or 2FA)
|
||||
# Auto-accept mode (enables recovery + 2FA automatically)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE -y
|
||||
|
||||
# Full security with auto-accept (requires manual code/QR scan)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE -r backup@gmail.com --2fa -y
|
||||
# With specific recovery email (auto-detected, no flag needed!)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE -y backup@gmail.com
|
||||
|
||||
# Just recovery email, no referral
|
||||
npm run creator -y myrecovery@gmail.com
|
||||
```
|
||||
|
||||
**✨ Features:**
|
||||
@@ -162,23 +159,22 @@ npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE -r backup@gmail.co
|
||||
- 🤖 **CAPTCHA support** — Manual solving (human verification)
|
||||
- <20> **Organized storage** — Individual files per account
|
||||
|
||||
**🎛️ Command Arguments:**
|
||||
- `<url>` — Referral URL (optional)
|
||||
- `-r <email>` — Recovery email address
|
||||
- `-y` — Auto-accept mode (skip interactive prompts)
|
||||
- `--2fa` — Enable 2FA setup
|
||||
**🎛️ Command Arguments (SIMPLIFIED!):**
|
||||
- `<url>` — Referral URL (auto-detected if starts with http)
|
||||
- `<email>` — Recovery email (auto-detected if contains @)
|
||||
- `-y` — Auto-accept mode (enables recovery + 2FA automatically)
|
||||
|
||||
**⚙️ How Flags Work:**
|
||||
**That's it! No more confusing flags.** 🎉
|
||||
|
||||
**⚙️ How It Works:**
|
||||
|
||||
| Command | Recovery Email | 2FA | Notes |
|
||||
|---------|---------------|-----|-------|
|
||||
| `npm run creator` | ❓ Prompts | ❓ Prompts | Interactive mode |
|
||||
| `npm run creator -y` | ❌ Skipped | ❌ Skipped | No security features |
|
||||
| `npm run creator -r email` | ✅ Uses email | ❓ Prompts | Only recovery |
|
||||
| `npm run creator --2fa` | ❓ Prompts | ✅ Enabled | Only 2FA |
|
||||
| `npm run creator -r email -y` | ✅ Uses email | ❌ Skipped | No prompt for 2FA |
|
||||
| `npm run creator --2fa -y` | ❌ Skipped | ✅ Enabled | No prompt for recovery |
|
||||
| `npm run creator -r email --2fa -y` | ✅ Uses email | ✅ Enabled | Full automation |
|
||||
| `npm run creator -y` | ✅ Prompts for email | ✅ Enabled | Auto-accept all |
|
||||
| `npm run creator -y backup@gmail.com` | ✅ Uses provided email | ✅ Enabled | Full automation |
|
||||
| `npm run creator URL -y` | ✅ Prompts for email | ✅ Enabled | With referral |
|
||||
| `npm run creator URL -y backup@gmail.com` | ✅ Uses provided email | ✅ Enabled | Complete setup |
|
||||
|
||||
**📋 What happens:**
|
||||
1. Creates Microsoft account (email, password, birthdate, names)
|
||||
|
||||
@@ -12,15 +12,13 @@ export class AccountCreator {
|
||||
private referralUrl?: string
|
||||
private recoveryEmail?: string
|
||||
private autoAccept: boolean
|
||||
private enable2FA: boolean
|
||||
private rl: readline.Interface
|
||||
private rlClosed = false
|
||||
|
||||
constructor(referralUrl?: string, recoveryEmail?: string, autoAccept = false, enable2FA = false) {
|
||||
constructor(referralUrl?: string, recoveryEmail?: string, autoAccept = false) {
|
||||
this.referralUrl = referralUrl
|
||||
this.recoveryEmail = recoveryEmail
|
||||
this.autoAccept = autoAccept
|
||||
this.enable2FA = enable2FA
|
||||
this.dataGenerator = new DataGenerator()
|
||||
this.rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
@@ -631,23 +629,45 @@ export class AccountCreator {
|
||||
let recoveryCode: string | undefined
|
||||
|
||||
try {
|
||||
// Setup recovery email (interactive if no -r flag and no -y flag)
|
||||
if (this.recoveryEmail || !this.autoAccept) {
|
||||
const emailResult = await this.setupRecoveryEmail(confirmedEmail)
|
||||
// Setup recovery email
|
||||
// Logic: If -r provided, use it. If -y (auto-accept), ask for it. Otherwise, interactive prompt.
|
||||
if (this.recoveryEmail) {
|
||||
// User provided -r flag with email
|
||||
const emailResult = await this.setupRecoveryEmail()
|
||||
if (emailResult) recoveryEmailUsed = emailResult
|
||||
} else if (this.autoAccept) {
|
||||
// User provided -y (auto-accept all) - prompt for recovery email
|
||||
log(false, 'CREATOR', '📧 Auto-accept mode: prompting for recovery email...', 'log', 'cyan')
|
||||
const emailResult = await this.setupRecoveryEmail()
|
||||
if (emailResult) recoveryEmailUsed = emailResult
|
||||
} else {
|
||||
log(false, 'CREATOR', 'Skipping recovery email setup (-y without -r)', 'log', 'gray')
|
||||
// Interactive mode - ask user
|
||||
const emailResult = await this.setupRecoveryEmail()
|
||||
if (emailResult) recoveryEmailUsed = emailResult
|
||||
}
|
||||
|
||||
// Setup 2FA (only if --2fa flag OR interactive prompt accepts)
|
||||
if (this.enable2FA || (!this.autoAccept && await this.ask2FASetup())) {
|
||||
// Setup 2FA
|
||||
// Logic: If -y (auto-accept), enable it automatically. Otherwise, ask user.
|
||||
if (this.autoAccept) {
|
||||
// User provided -y (auto-accept all) - enable 2FA automatically
|
||||
log(false, 'CREATOR', '🔐 Auto-accept mode: enabling 2FA...', 'log', 'cyan')
|
||||
const tfaResult = await this.setup2FA()
|
||||
if (tfaResult) {
|
||||
totpSecret = tfaResult.totpSecret
|
||||
recoveryCode = tfaResult.recoveryCode
|
||||
}
|
||||
} else {
|
||||
log(false, 'CREATOR', 'Skipping 2FA setup', 'log', 'gray')
|
||||
// Interactive mode - ask user
|
||||
const wants2FA = await this.ask2FASetup()
|
||||
if (wants2FA) {
|
||||
const tfaResult = await this.setup2FA()
|
||||
if (tfaResult) {
|
||||
totpSecret = tfaResult.totpSecret
|
||||
recoveryCode = tfaResult.recoveryCode
|
||||
}
|
||||
} else {
|
||||
log(false, 'CREATOR', 'Skipping 2FA setup', 'log', 'gray')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
log(false, 'CREATOR', `Post-setup error: ${error}`, 'warn', 'yellow')
|
||||
@@ -2214,7 +2234,7 @@ ${JSON.stringify(accountData, null, 2)}`
|
||||
/**
|
||||
* Setup recovery email for the account
|
||||
*/
|
||||
private async setupRecoveryEmail(_currentEmail: string): Promise<string | undefined> {
|
||||
private async setupRecoveryEmail(): Promise<string | undefined> {
|
||||
try {
|
||||
log(false, 'CREATOR', '📧 Setting up recovery email...', 'log', 'cyan')
|
||||
|
||||
|
||||
@@ -26,60 +26,69 @@ Already integrated - no additional setup needed!
|
||||
### Command Line
|
||||
|
||||
```bash
|
||||
# Basic usage (standalone account)
|
||||
# Basic usage (interactive mode - asks everything)
|
||||
npm run creator
|
||||
|
||||
# With referral link (earns you referral credit)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE&ref=rafsrchae
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE
|
||||
|
||||
# With recovery email
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE -r recovery@gmail.com
|
||||
|
||||
# With auto-accept mode (skip all prompts)
|
||||
# Auto-accept mode (enables recovery email + 2FA automatically)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE -y
|
||||
|
||||
# Enable 2FA automatically
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE --2fa
|
||||
# With specific recovery email (auto-detected)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE -y backup@gmail.com
|
||||
|
||||
# Complete example with all options
|
||||
npm run creator https://rewards.bing.com/welcome?rh=YOUR_CODE -r backup@gmail.com -y --2fa
|
||||
# Minimal - just recovery email without referral
|
||||
npm run creator -y myrecovery@gmail.com
|
||||
```
|
||||
|
||||
### 🎛️ Command Line Arguments
|
||||
|
||||
| Argument | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| `<url>` | Referral URL (optional) | `https://rewards.bing.com/welcome?rh=CODE` |
|
||||
| `-r <email>` | Recovery email address | `-r mybackup@gmail.com` |
|
||||
| `-y` | Auto-accept mode (skip prompts) | `-y` |
|
||||
| `--2fa` | Enable 2FA automatically | `--2fa` |
|
||||
| `<url>` | Referral URL (optional, auto-detected if starts with http) | `https://rewards.bing.com/welcome?rh=CODE` |
|
||||
| `<email>` | Recovery email (optional, auto-detected if contains @) | `recovery@gmail.com` |
|
||||
| `-y` | Auto-accept mode (enables recovery + 2FA automatically) | `-y` |
|
||||
|
||||
**That's it! No more confusing flags.** 🎉
|
||||
|
||||
### 📊 How It Works
|
||||
|
||||
| Command | Recovery Email | 2FA | Behavior |
|
||||
|---------|---------------|-----|----------|
|
||||
| `npm run creator` | ❓ Ask user | ❓ Ask user | Fully interactive |
|
||||
| `npm run creator -y` | ✅ Prompt for email | ✅ Enabled | Auto-accept all |
|
||||
| `npm run creator -y backup@gmail.com` | ✅ Use provided email | ✅ Enabled | Full automation |
|
||||
| `npm run creator URL -y` | ✅ Prompt for email | ✅ Enabled | With referral |
|
||||
| `npm run creator URL -y backup@gmail.com` | ✅ Use provided email | ✅ Enabled | Complete setup |
|
||||
|
||||
**⚠️ Important: How `-y` Works**
|
||||
|
||||
The `-y` flag **skips interactive prompts**, but **respects the flags you provide**:
|
||||
|
||||
- `npm run creator -y` → Skips recovery email AND 2FA (nothing setup)
|
||||
- `npm run creator -r email@example.com -y` → Uses recovery email, skips 2FA
|
||||
- `npm run creator --2fa -y` → Skips recovery email, forces 2FA
|
||||
- `npm run creator -r email@example.com --2fa -y` → Uses both (full automation)
|
||||
The `-y` flag **accepts ALL prompts automatically**:
|
||||
- ✅ Automatically enables 2FA
|
||||
- ✅ Prompts for recovery email (or uses provided one)
|
||||
- ✅ No other flags needed - it's that simple!
|
||||
|
||||
**Examples:**
|
||||
|
||||
```bash
|
||||
# Minimal (no options, will prompt for everything)
|
||||
# Interactive mode (asks everything)
|
||||
npm run creator
|
||||
|
||||
# With referral only (will prompt for recovery email & 2FA)
|
||||
# With referral link (will prompt for recovery email & 2FA)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=B395E9D7
|
||||
|
||||
# With recovery email (will be asked for code, then prompts for 2FA)
|
||||
npm run creator -r mybackup@gmail.com
|
||||
# Auto-accept mode (enables 2FA, prompts for recovery email)
|
||||
npm run creator -y
|
||||
|
||||
# Full automation with 2FA (no prompts, but requires manual code entry)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=B395E9D7 -r backup@gmail.com --2fa -y
|
||||
|
||||
# Skip everything (fastest, no security features)
|
||||
# Auto with referral (enables 2FA, prompts for recovery)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=B395E9D7 -y
|
||||
|
||||
# Full automation with specific recovery email (no prompts)
|
||||
npm run creator https://rewards.bing.com/welcome?rh=B395E9D7 -y backup@gmail.com
|
||||
|
||||
# Just with recovery email, no referral
|
||||
npm run creator -y myrecovery@example.com
|
||||
```
|
||||
|
||||
### Interactive Flow
|
||||
@@ -420,6 +429,12 @@ When you use `--2fa` argument OR answer 'y' to "Enable 2FA?" prompt:
|
||||
|
||||
## <20>🐛 Troubleshooting
|
||||
|
||||
**Q: How do I provide a recovery email?**
|
||||
A: Just add it as an argument: `npm run creator -y myemail@gmail.com` - it's auto-detected!
|
||||
|
||||
**Q: What does `-y` do exactly?**
|
||||
A: It enables EVERYTHING automatically (recovery email prompt + 2FA). One flag, full automation.
|
||||
|
||||
**Q: Email generation too fast?**
|
||||
A: System uses 0.8-2s delays after each input - looks human.
|
||||
|
||||
@@ -445,10 +460,10 @@ A: Check the saved JSONC file - it contains the secret key.
|
||||
A: Use the recovery code from JSONC file to access account.
|
||||
|
||||
**Q: Can I skip recovery email?**
|
||||
A: Yes, don't use `-r` argument and press Enter when asked.
|
||||
A: Yes, in interactive mode just press Enter when asked.
|
||||
|
||||
**Q: Can I skip 2FA?**
|
||||
A: Yes, don't use `--2fa` and answer 'n' when asked (or use `-y` to skip prompt).
|
||||
A: Yes, in interactive mode answer 'n' when asked. With `-y`, 2FA is always enabled.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -9,41 +9,45 @@ async function main(): Promise<void> {
|
||||
let referralUrl: string | undefined
|
||||
let recoveryEmail: string | undefined
|
||||
let autoAccept = false
|
||||
let enable2FA = false
|
||||
|
||||
// Parse arguments
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
const arg = args[i]
|
||||
// Parse arguments - ULTRA SIMPLE
|
||||
for (const arg of args) {
|
||||
if (!arg) continue
|
||||
|
||||
if (arg === '-r' && i + 1 < args.length) {
|
||||
recoveryEmail = args[++i]
|
||||
} else if (arg === '-y') {
|
||||
if (arg === '-y') {
|
||||
autoAccept = true
|
||||
} else if (arg === '--2fa') {
|
||||
enable2FA = true
|
||||
} else if (arg.startsWith('http')) {
|
||||
referralUrl = arg
|
||||
} else if (arg.includes('@')) {
|
||||
// Auto-detect email addresses
|
||||
recoveryEmail = arg
|
||||
}
|
||||
}
|
||||
|
||||
// Validate recovery email if provided
|
||||
if (recoveryEmail && !recoveryEmail.includes('@')) {
|
||||
log(false, 'CREATOR-CLI', '❌ Invalid recovery email format', 'error')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// Banner
|
||||
console.log('\n' + '='.repeat(60))
|
||||
log(false, 'CREATOR-CLI', '🚀 Microsoft Account Creator', 'log', 'cyan')
|
||||
console.log('='.repeat(60) + '\n')
|
||||
|
||||
// Display detected arguments
|
||||
if (referralUrl) {
|
||||
log(false, 'CREATOR-CLI', `✅ Using referral URL: ${referralUrl}`, 'log', 'green')
|
||||
log(false, 'CREATOR-CLI', `✅ Referral URL: ${referralUrl}`, 'log', 'green')
|
||||
} else {
|
||||
log(false, 'CREATOR-CLI', '⚠️ No referral URL provided - account will NOT be linked to rewards', 'warn', 'yellow')
|
||||
log(false, 'CREATOR-CLI', '⚠️ No referral URL - account will NOT be linked to rewards', 'warn', 'yellow')
|
||||
}
|
||||
|
||||
if (recoveryEmail) {
|
||||
log(false, 'CREATOR-CLI', `✅ Recovery email: ${recoveryEmail}`, 'log', 'green')
|
||||
}
|
||||
|
||||
if (autoAccept) {
|
||||
log(false, 'CREATOR-CLI', '⚡ Auto-accept mode: recovery + 2FA will be enabled', 'log', 'cyan')
|
||||
} else {
|
||||
log(false, 'CREATOR-CLI', '🤖 Interactive mode: you will be asked for options', 'log', 'cyan')
|
||||
}
|
||||
|
||||
console.log()
|
||||
|
||||
// Create a temporary bot instance to access browser creation
|
||||
const bot = new MicrosoftRewardsBot(false)
|
||||
const browserFactory = new Browser(bot)
|
||||
@@ -66,7 +70,7 @@ async function main(): Promise<void> {
|
||||
log(false, 'CREATOR-CLI', '✅ Browser opened successfully', 'log', 'green')
|
||||
|
||||
// Create account
|
||||
const creator = new AccountCreator(referralUrl, recoveryEmail, autoAccept, enable2FA)
|
||||
const creator = new AccountCreator(referralUrl, recoveryEmail, autoAccept)
|
||||
const result = await creator.create(browserContext)
|
||||
|
||||
if (result) {
|
||||
|
||||
Reference in New Issue
Block a user