autoreg-skills-max: initial public release (restored, redacted, hardened)
This commit is contained in:
149
skills/bulk-account-registration/templates/grok_clerk_api.py
Normal file
149
skills/bulk-account-registration/templates/grok_clerk_api.py
Normal file
@@ -0,0 +1,149 @@
|
||||
"""Grok (x.ai) registration via Clerk API — no browser, no Cloudflare, no CAPTCHA.
|
||||
|
||||
Pattern: Clerk publishable key extracted from page source as `castlePk`.
|
||||
Calls Clerk Frontend API directly + t-online.de IMAP for verification codes.
|
||||
|
||||
Usage: python grok_clerk_api.py 3
|
||||
"""
|
||||
import imaplib, email, re, json, random, string, time, sys, requests
|
||||
from pathlib import Path
|
||||
|
||||
EMAILS_FILE = "C:/Users/User/Desktop/_PROJECTS/GPT-AUTOREG/emails.txt"
|
||||
OUTPUT = "C:/Users/User/projects/vellum-account-farm/accounts/grok_accounts.json"
|
||||
CLERK_PK = "pk_p8GGWvD3TmFJZRsX3BQcqAv9aFVispNz"
|
||||
CLERK_BASE = "https://clerk.x.ai/v1/client"
|
||||
|
||||
def load_emails():
|
||||
emails = []
|
||||
with open(EMAILS_FILE, "r") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#") or line.startswith("---"):
|
||||
continue
|
||||
if ":" in line:
|
||||
user, pw = line.split(":", 1)
|
||||
emails.append((user.strip(), pw.strip()))
|
||||
return emails
|
||||
|
||||
def get_code_tonline(addr, pw, timeout=120):
|
||||
"""Poll t-online.de IMAP for verification code."""
|
||||
deadline = time.time() + timeout
|
||||
while time.time() < deadline:
|
||||
try:
|
||||
mail = imaplib.IMAP4_SSL("secureimap.t-online.de", 993)
|
||||
mail.login(addr, pw)
|
||||
mail.select("inbox")
|
||||
_, msgs = mail.search(None, "UNSEEN")
|
||||
if not msgs[0]:
|
||||
_, msgs = mail.search(None, "ALL")
|
||||
for num in msgs[0].split()[-5:]:
|
||||
_, data = mail.fetch(num, "(RFC822)")
|
||||
for part in data:
|
||||
if not isinstance(part, tuple): continue
|
||||
msg = email.message_from_bytes(part[1])
|
||||
body = ""
|
||||
if msg.is_multipart():
|
||||
for p in msg.walk():
|
||||
if p.get_content_type() in ("text/plain", "text/html"):
|
||||
pl = p.get_payload(decode=True)
|
||||
if pl: body += pl.decode(errors="ignore")
|
||||
else:
|
||||
pl = msg.get_payload(decode=True)
|
||||
if pl: body = pl.decode(errors="ignore")
|
||||
codes = re.findall(r"\b(\d{6,8})\b", body)
|
||||
if codes and codes[0] != "000000":
|
||||
mail.logout()
|
||||
return codes[0]
|
||||
links = re.findall(r"https://[^\s<>]*x\.ai[^\s<>]*confirm[^\s<>]*", body)
|
||||
if links:
|
||||
mail.logout()
|
||||
return "LINK:" + links[0]
|
||||
mail.logout()
|
||||
except Exception as e:
|
||||
print(f" [IMAP] {e}")
|
||||
time.sleep(5)
|
||||
return None
|
||||
|
||||
def register_one(email_addr, email_pw):
|
||||
pw = "".join(random.choices(string.ascii_letters + string.digits + "!@#$%^&*", k=16))
|
||||
s = requests.Session()
|
||||
s.headers.update({
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/[REDACTED-IP]",
|
||||
"Origin": "https://accounts.x.ai",
|
||||
"Referer": "https://accounts.x.ai/",
|
||||
"Content-Type": "application/json",
|
||||
})
|
||||
|
||||
# Step 1: Create sign-up
|
||||
print(f" Creating sign-up for {email_addr}...")
|
||||
r = s.post(f"{CLERK_BASE}/sign_ups", json={
|
||||
"email_address": email_addr,
|
||||
"password": pw,
|
||||
}, headers={"Clerk-Publishable-Key": CLERK_PK})
|
||||
if r.status_code != 200:
|
||||
print(f" [FAIL] Sign-up failed: {r.status_code} {r.text[:200]}")
|
||||
return None
|
||||
|
||||
data = r.json()
|
||||
signup_id = data.get("response", {}).get("id") or data.get("id")
|
||||
if not signup_id:
|
||||
print(f" [FAIL] No sign-up ID in response: {r.text[:200]}")
|
||||
return None
|
||||
|
||||
# Step 2: Prepare email verification
|
||||
r = s.post(f"{CLERK_BASE}/sign_ups/{signup_id}/prepare_verification", json={
|
||||
"strategy": "email_code",
|
||||
}, headers={"Clerk-Publishable-Key": CLERK_PK})
|
||||
print(f" Prepare verification: {r.status_code}")
|
||||
|
||||
# Step 3: Wait for code via IMAP
|
||||
code = get_code_tonline(email_addr, email_pw, timeout=120)
|
||||
if not code:
|
||||
print(" [FAIL] No code received")
|
||||
return None
|
||||
|
||||
if code.startswith("LINK:"):
|
||||
link = code[5:]
|
||||
print(f" Got link: {link[:80]}...")
|
||||
r = s.get(link, allow_redirects=True)
|
||||
print(f" Link result: {r.status_code}")
|
||||
else:
|
||||
# Step 4: Verify email code
|
||||
print(f" Verifying code: {code}...")
|
||||
r = s.post(f"{CLERK_BASE}/sign_ups/{signup_id}/attempt_verification", json={
|
||||
"strategy": "email_code",
|
||||
"code": code,
|
||||
}, headers={"Clerk-Publishable-Key": CLERK_PK})
|
||||
print(f" Verify: {r.status_code} {r.text[:200]}")
|
||||
|
||||
print(f" [OK] Done: {email_addr}")
|
||||
return {"email": email_addr, "password": pw, "site": "grok", "status": "active"}
|
||||
|
||||
def main():
|
||||
count = int(sys.argv[1]) if len(sys.argv) > 1 else 3
|
||||
emails = load_emails()
|
||||
print(f"=== GROK REG (Clerk API): {count} accounts from {len(emails)} emails ===")
|
||||
ok = []
|
||||
for i in range(min(count, len(emails))):
|
||||
addr, epw = emails[i]
|
||||
print(f"\n--- [{i+1}/{count}] {addr} ---")
|
||||
try:
|
||||
r = register_one(addr, epw)
|
||||
if r: ok.append(r)
|
||||
except Exception as e:
|
||||
print(f" [ERROR] {e}")
|
||||
if i < count - 1:
|
||||
d = random.randint(5, 15)
|
||||
print(f" Cooldown {d}s...")
|
||||
time.sleep(d)
|
||||
print(f"\n=== Done: {len(ok)}/{count} ===")
|
||||
if ok:
|
||||
out = Path(OUTPUT)
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
existing = json.loads(out.read_text()) if out.exists() else []
|
||||
existing.extend(ok)
|
||||
out.write_text(json.dumps(existing, indent=2))
|
||||
print(f"Saved: {out}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user