194 lines
8.4 KiB
Python
194 lines
8.4 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
GitHub AutoReg — mass registration via persistent Chrome profile + .de IMAP
|
|
Usage: python reg.py --count 10 --emails mails.txt
|
|
"""
|
|
import asyncio, json, random, string, sys, time, traceback, imaplib, ssl, re
|
|
from pathlib import Path
|
|
from argparse import ArgumentParser
|
|
|
|
# === CONFIG ===
|
|
DEFAULT_EMAILS = r"C:\Users\User\Desktop\_ARCHIVE_CANDIDATES\Downloads_backup_01.07.2026\working_mails_RECOVERED.txt"
|
|
CHROME_PROFILE = r"C:\Users\User\gh_work\chrome_profile"
|
|
OUTPUT_FILE = Path("accounts.txt")
|
|
STATE_FILE = Path("state.json")
|
|
GITHUB_SIGNUP = "https://github.com/signup"
|
|
DELAY_MIN, DELAY_MAX = 120, 300
|
|
|
|
IMAP_SERVERS = {
|
|
't-online.de': ('imap.t-online.de', 993),
|
|
'web.de': ('imap.web.de', 993),
|
|
'gmx.de': ('imap.gmx.net', 993),
|
|
}
|
|
|
|
|
|
def load_emails(filepath):
|
|
emails, seen = [], set()
|
|
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
|
|
for line in f:
|
|
if ':' not in line: continue
|
|
email, pw = line.strip().split(':', 1)
|
|
email = email.strip().strip('"').strip("'").strip('`')
|
|
pw = pw.strip().strip('"').strip("'")
|
|
if email in seen: continue
|
|
seen.add(email)
|
|
if any(d in email.lower() for d in ['@t-online.de', '@web.de', '@gmx.de']):
|
|
emails.append((email, pw))
|
|
return emails
|
|
|
|
|
|
def check_imap(email, pw):
|
|
domain = email.split('@')[1].lower()
|
|
server, port = IMAP_SERVERS.get(domain, (None, None))
|
|
if not server: return False
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False; ctx.verify_mode = ssl.CERT_NONE
|
|
try:
|
|
mail = imaplib.IMAP4_SSL(server, port, ssl_context=ctx, timeout=10)
|
|
mail.login(email, pw); mail.logout()
|
|
return True
|
|
except: return False
|
|
|
|
|
|
def get_code(email, pw, timeout=120):
|
|
domain = email.split('@')[1].lower()
|
|
server, port = IMAP_SERVERS.get(domain, (None, None))
|
|
if not server: return None
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False; ctx.verify_mode = ssl.CERT_NONE
|
|
start = time.time()
|
|
while time.time() - start < timeout:
|
|
try:
|
|
mail = imaplib.IMAP4_SSL(server, port, ssl_context=ctx, timeout=10)
|
|
mail.login(email, pw); mail.select('INBOX'); mail.noop()
|
|
status, data = mail.search(None, '(FROM "noreply@github.com" UNSEEN)')
|
|
if status == 'OK' and data[0]:
|
|
for msg_id in reversed(data[0].split()):
|
|
status, msg_data = mail.fetch(msg_id, '(RFC822)')
|
|
if status == 'OK':
|
|
body = msg_data[0][1].decode('utf-8', errors='ignore')
|
|
codes = re.findall(r'\b(\d{6,8})\b', body)
|
|
if codes: mail.logout(); return codes[0]
|
|
mail.logout()
|
|
except: pass
|
|
time.sleep(5)
|
|
return None
|
|
|
|
|
|
async def reg_one(email, email_pw):
|
|
from playwright.async_api import async_playwright
|
|
username = f"{email.split('@')[0][:20]}-{random.randint(100,9999)}"
|
|
gh_pw = ''.join(random.choice(string.ascii_letters + string.digits + "!@#$%^&*") for _ in range(16))
|
|
|
|
p = await async_playwright().start()
|
|
ctx = await p.chromium.launch_persistent_context(
|
|
CHROME_PROFILE, headless=False,
|
|
args=["--disable-blink-features=AutomationControlled", "--no-sandbox"],
|
|
viewport={"width": 1280, "height": 900},
|
|
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/[REDACTED-IP] Safari/537.36")
|
|
await ctx.add_init_script("Object.defineProperty(navigator,'webdriver',{get:()=>false});delete navigator.__proto__.webdriver;window.chrome={runtime:{}};")
|
|
page = await ctx.new_page()
|
|
|
|
try:
|
|
await page.goto(GITHUB_SIGNUP, wait_until="networkidle", timeout=30000)
|
|
await page.wait_for_timeout(3000)
|
|
await page.evaluate("document.querySelectorAll('.flash-close,[aria-label=\"Dismiss\"]').forEach(e=>e.click());document.querySelectorAll('.flash').forEach(e=>e.remove());")
|
|
await page.wait_for_timeout(1000)
|
|
|
|
print(f" [*] {email} → {username}")
|
|
await page.evaluate("""
|
|
(d) => {
|
|
const setV = (s,v) => { const e=document.querySelector(s); if(e){e.value=v;e.dispatchEvent(new Event('input',{bubbles:true}));e.dispatchEvent(new Event('change',{bubbles:true}));} };
|
|
setV('input[type="email"]',d.email); setV('input[name="user[email]"]',d.email);
|
|
setV('input[type="password"]',d.pw); setV('input[name="user[password]"]',d.pw);
|
|
setV('input[name="user[login]"]',d.user);
|
|
}
|
|
""", {"email":email, "pw":gh_pw, "user":username})
|
|
await page.wait_for_timeout(2000)
|
|
|
|
try:
|
|
btn = await page.wait_for_selector('button:has-text("Create account")', timeout=5000)
|
|
await btn.evaluate("e=>e.disabled=false"); await page.wait_for_timeout(500)
|
|
await btn.click(force=True)
|
|
except:
|
|
await page.evaluate("const f=document.querySelector('form');if(f){f.removeAttribute('novalidate');f.requestSubmit?f.requestSubmit():f.submit();}")
|
|
|
|
await page.wait_for_timeout(5000)
|
|
url = page.url
|
|
|
|
if "account_verifications" in url or "verify" in url.lower():
|
|
print(" [*] Waiting for code...")
|
|
code = get_code(email, email_pw, 120)
|
|
if not code: print(" [!] No code"); return None
|
|
print(f" [*] Code: {code}")
|
|
|
|
filled = False
|
|
for sel in ['input[inputmode="numeric"]','input[type="text"]','input[name="verification_code"]','input[autocomplete="one-time-code"]']:
|
|
try:
|
|
digits = await page.query_selector_all(sel)
|
|
if len(digits) >= 6:
|
|
for i,d in enumerate(code[:len(digits)]): await digits[i].fill(d)
|
|
filled = True; break
|
|
elif len(digits) == 1: await digits[0].fill(code); filled = True; break
|
|
except: continue
|
|
if not filled: await page.keyboard.type(code, delay=50)
|
|
|
|
await page.wait_for_timeout(3000)
|
|
url = page.url
|
|
|
|
if "signup" not in url.lower() and "join" not in url.lower() and "account_verifications" not in url.lower() and "verify" not in url.lower() and "github.com" in url:
|
|
print(f" [OK] {username}")
|
|
return {"email":email, "email_pw":email_pw, "username":username, "gh_pw":gh_pw, "time":time.strftime("%Y-%m-%d %H:%M:%S")}
|
|
else:
|
|
body = await page.evaluate("()=>document.body.innerText[:200]")
|
|
print(f" [X] {url[:100]} | {body}")
|
|
return None
|
|
except Exception as e:
|
|
print(f" [X] {e}"); traceback.print_exc(); return None
|
|
finally:
|
|
await ctx.close(); await p.stop()
|
|
|
|
|
|
async def main():
|
|
p = ArgumentParser(description="GitHub AutoReg")
|
|
p.add_argument("--count", type=int, default=10)
|
|
p.add_argument("--emails", default=DEFAULT_EMAILS)
|
|
p.add_argument("--delay-min", type=int, default=DELAY_MIN)
|
|
p.add_argument("--delay-max", type=int, default=DELAY_MAX)
|
|
args = p.parse_args()
|
|
|
|
emails = load_emails(args.emails)
|
|
print(f"[*] {len(emails)} .de emails")
|
|
|
|
state = json.loads(STATE_FILE.read_text()) if STATE_FILE.exists() else {"processed":[], "accounts":[]}
|
|
processed = set(state["processed"])
|
|
emails = [(e,p) for e,p in emails if e not in processed]
|
|
print(f"[*] {len(emails)} remaining")
|
|
|
|
if not emails: return print("[*] All done. Delete state.json to reset.")
|
|
if not check_imap(emails[0][0], emails[0][1]):
|
|
for e,p in emails[:10]:
|
|
if check_imap(e,p): break
|
|
else: return print("[X] No working IMAP")
|
|
|
|
ok = 0
|
|
for i, (email, pw) in enumerate(emails):
|
|
if i >= args.count: break
|
|
print(f"\n--- {i+1}/{args.count} ---")
|
|
r = await reg_one(email, pw)
|
|
if r:
|
|
ok += 1
|
|
state["accounts"].append(r)
|
|
with open(OUTPUT_FILE, 'a') as f:
|
|
f.write(f"{r['email']}|{r['email_pw']}|{r['username']}|{r['gh_pw']}\n")
|
|
print(f" [OK] Total: {ok}")
|
|
state["processed"].append(email)
|
|
STATE_FILE.write_text(json.dumps(state, indent=2))
|
|
if i < min(args.count, len(emails)) - 1:
|
|
d = random.uniform(args.delay_min, args.delay_max)
|
|
print(f" [*] Wait {d:.0f}s..."); time.sleep(d)
|
|
|
|
print(f"\nDone! Created: {ok}/{args.count}")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main()) |