crowllm.com autoreg: Google OAuth flow, Turnstile, httpOnly refresh-cookie key extraction

This commit is contained in:
reform
2026-11-14 20:51:06 +02:00
commit 981c5e4f5e
4 changed files with 304 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
__pycache__/
*.pyc
*.log
keys.jsonl
fail.jsonl
accounts.jsonl
prof_*/
*.session
+91
View File
@@ -0,0 +1,91 @@
# crowllm-autoreg
Browser-driven account registration for **crowllm.com** — an OpenAI-compatible aggregator (new-api fork) that exposes **76 `:free` models** and grants **50 000 000 free-model tokens** on signup, no card.
Signup is **Google OAuth only** — the email/password form does not exist (`/login` → 404 page). Both Cloudflare Turnstile and a mandatory consent checkbox sit in front of the OAuth button, so a plain HTTP replay is dead (`curl` on `/sign-up` → 403). This repo drives a real headful Chrome instead.
## What you get per account
| field | value |
|---|---|
| `quota` | 5 000 000 |
| `earned_quota` | 50 000 000 |
| `used_quota` | counts tokens spent (9 units for an 8-token request) |
| plan | `free` — free catalogue only |
`quota` unit ≈ 1 token, so "**$100 credit**" advertised by the site = 50M free-model tokens, not wallet cash. Rate limit: 12 parallel chats → 5×200, 7×429; keep ≤5 concurrent.
## Free catalogue (sample from a live `GET /v1/models`)
```
gemini-3.1-pro:free gemini-3.8-flash:free gemini-2.5-pro:free
deepseek-v4.1-flash:free deepseek-v4-flash:free deepseek-v4.1-flash-uncensored:free
kimi-k3 (runpod/) llama-3.3-70b:free minimax-m3.1-flash:free
nemotron-3-ultra-550b-a55b:free crow-limitless:free
crow-uncensored:free qwen-3.8-max:free qwen-3.8-27b-uncensored:free
```
Verified live: `gemini-3.1-pro:free`, `gemini-3.8-flash:free`, `deepseek-v4.1-flash:free`, `crow-limitless:free`, `qwen-3.8-max:free` → HTTP 200, content in ~1.2 s.
## Requirements
```
Python 3.11
playwright (pip install -r requirements.txt)
Google Chrome installed (playwright's bundled chromium is NOT used)
accounts with a Google login (any domain that has Google OAuth — Google Workspace / Edu lots work)
```
## Usage
```bash
export CROWL_BANK=/path/to/accounts.jsonl # {"email": "...", "password": "..."} per line
export CROWL_OUT=/path/to/keys.jsonl # created: {email,password,uid,quota,earned,key,...}
export CROWL_FAIL=/path/to/fail.jsonl
export CROWL_PROFILE=/path/to/chrome-profile-1 # one profile per worker
export CROWL_DOMAINS=example.com # optional comma-separated filter
export CROWL_CHROME="C:/Program Files/Google/Chrome/Application/chrome.exe"
python crowllm_reg.py 1
```
Parallel wave = one process per index with its own `CROWL_PROFILE`:
```bash
for i in 1 2 3 4; do
CROWL_PROFILE=/tmp/crowl-prof-$i python crowllm_reg.py $i &
done
```
## Flow (what the script actually does)
1. `GET /sign-up?aff=<aff>` in headful Chrome; wait for `span[role=checkbox][data-slot=checkbox]`.
2. Poll `input[name=cf-turnstile-response]` until `len > 50` — Turnstile solves itself in headful Chrome in 5-20 s.
3. Click the consent checkbox.
4. **Click the Google button with a real mouse event** (`page.mouse.move` then `page.mouse.click` at the button centre). JS `element.click()` and `locator.click(force=True)` fire **no network request at all** — the OAuth popup is gated on user activation.
5. Google: `input[name=identifier]` → `#identifierNext button` → `input[name=Passwd]` (a hidden `hiddenPassword` field breaks generic `input[type=password]`) → `#passwordNext button`.
6. Consent screen (`Sign in to crowllm.com / You'll share this info`): click Continue (text match `continue` / `allow`, fallback = 85% of the `Cancel\nContinue` container width).
7. Landing `/onboarding` = account created. Landing `/sign-in` = OAuth produced no session → logged to the fail file.
8. Key extraction: the session lives in the **httpOnly cookie `new_api_refresh`**, not in `localStorage`. `POST /api/user/auth/refresh` → `data.access_token` (396 chars) → use it as `Authorization: Bearer` for `/api/user/self`, `POST /api/token/`, `GET /api/token/?p=1&size=10`, `POST /api/token/{id}/key`.
9. The key endpoint answers `{"data":{"key":"..."}}`. The script stores only the `.key` string (48 alnum chars).
## Verify a key
```bash
curl -s -H "Authorization: Bearer $KEY" https://crowllm.com/v1/models | head -c 200
curl -s -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"model":"gemini-3.8-flash:free","messages":[{"role":"user","content":"Reply with exactly: PONG"}],"max_tokens":20}' \
https://crowllm.com/v1/chat/completions
```
## Pitfalls hit while building this
- OAuth button needs the mouse event (see step 4) — this is the single biggest time sink.
- `401 AUTH_UNAUTHORIZED, invalid access token` on `/api/user/self` only means the Bearer token is missing; the refresh cookie is still valid.
- Turnstile needs a warm profile: a brand-new profile often returns `cf-turnstile-response` empty for 90 s, while a profile that already passed the challenge solves it in ~5 s.
- Success rate in our runs ≈ 57% — failures are `/sign-in` landings and unsolved Turnstile.
- Chrome profiles grow ~20 MB each; prune `Cache/`, `Code Cache/`, `GPUCache/`, `Crashpad/` between waves.
## Legal
For research on your own accounts. The service's ToS apply; multi-accounting may get accounts revoked.
+204
View File
@@ -0,0 +1,204 @@
import os, time, json, sys, random
sys.path.insert(0,"C:/Users/User/tmp/crowllm")
from playwright.sync_api import sync_playwright
BASE=os.environ.get("CROWL_DIR", os.getcwd())
BANK=os.environ.get("CROWL_BANK", os.path.join(BASE,"accounts.jsonl"))
OUT=os.environ.get("CROWL_OUT", os.path.join(BASE,"keys.jsonl"))
FOUT=os.environ.get("CROWL_FAIL", os.path.join(BASE,"fail.jsonl"))
_doms=os.environ.get("CROWL_DOMAINS","")
DOMS=[d.strip() for d in _doms.split(",") if d.strip()]
IDX=sys.argv[1] if len(sys.argv)>1 else "1"
PROF=os.environ.get("CROWL_PROFILE") or os.path.join(BASE,f"prof_{IDX}")
LOGF=os.environ.get("CROWL_LOG") or os.path.join(BASE,f"reg_{IDX}.log.txt")
log=open(LOGF,"a",encoding="utf-8")
def L(*a):
s=" ".join(str(x) for x in a)
log.write(s+"\n"); log.flush()
print(s.encode('ascii','replace').decode(), flush=True)
used=set()
for f in (OUT,FOUT):
try:
for l in open(f,encoding='utf-8'):
if l.strip():
j=json.loads(l)
if j.get('email'): used.add(j['email'])
except FileNotFoundError: pass
bank=[json.loads(l) for l in open(BANK,encoding='utf-8') if l.strip()]
cand=[b for b in bank if b['email'] not in used and (not DOMS or any(d in b['email'] for d in DOMS))]
if not cand: cand=[b for b in bank if b['email'] not in used]
if not cand:
L("NO CANDIDATES"); sys.exit(3)
acc=random.choice(cand); EMAIL,PW=acc['email'],acc['password']
L("ACC", EMAIL)
res={'email':EMAIL,'dom':EMAIL.split('@')[-1],'profile':PROF}
CHROME=os.environ.get("CROWL_CHROME")
if not CHROME or not os.path.exists(CHROME):
CHROME=None
for c in ["C:/Program Files/Google/Chrome/Application/chrome.exe",
"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",
os.path.expandvars(r"%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe"),
"/usr/bin/google-chrome", "/usr/bin/chromium"]:
if c and os.path.exists(c): CHROME=c; break
if not CHROME:
raise SystemExit("Chrome not found - set CROWL_CHROME")
def ev(pg, expr, default=None, tries=3, wait=1.0):
for i in range(tries):
try: return pg.evaluate(expr)
except Exception: time.sleep(wait)
return default
def live(ctx): return [x for x in ctx.pages if not x.is_closed()]
def gpage(ctx):
for x in live(ctx):
try:
if "accounts.google.com" in x.url: return x
except Exception: pass
return None
GOOGLE_BTN_JS="() => { const bs=[...document.querySelectorAll('button')]; const g=bs.find(b=>(b.innerText||'').includes('Google')); if(!g) return null; const r=g.getBoundingClientRect(); return [r.x+r.width/2, r.y+r.height/2]; }"
CONSENT_JS=("() => { const want=['continue','allow']; const nodes=[...document.querySelectorAll('button,[role=button],span[jsname],input[type=submit]')];"
" const el=nodes.find(e=>{const t=((e.innerText||e.getAttribute('aria-label')||'')+'').trim().toLowerCase(); const r=e.getBoundingClientRect();"
" return r.width>40&&r.height>18&&r.width<500&&want.some(w=>t===w||t.startsWith(w));});"
" if(el){const r=el.getBoundingClientRect(); return [r.x+r.width/2,r.y+r.height/2,'direct']}"
" const c=[...document.querySelectorAll('div')].find(e=>{const t=(e.innerText||'').toLowerCase(); const r=e.getBoundingClientRect();"
" return t.includes('cancel')&&t.includes('continue')&&r.height<90&&r.height>20&&r.width<950;});"
" if(c){const r=c.getBoundingClientRect(); return [r.x+r.width*0.85,r.y+r.height/2,'zone']}"
" return null }")
BODY_JS="() => document.body.innerText.replace(/\\n/g,' | ').slice(0,400)"
with sync_playwright() as p:
ctx=p.chromium.launch_persistent_context(user_data_dir=PROF, headless=False, executable_path=CHROME,
args=["--disable-blink-features=AutomationControlled","--no-first-run","--no-default-browser-check",
"--disable-dev-shm-usage","--disable-popup-blocking"],
viewport={"width":1280,"height":900}, ignore_default_args=["--enable-automation"])
pg=live(ctx)[0]
pg.goto("https://crowllm.com/sign-up?aff=ezPS", wait_until="domcontentloaded", timeout=90000)
try: pg.wait_for_selector('span[role=checkbox][data-slot=checkbox]', state="visible", timeout=45000)
except Exception as e:
L("noform", str(e)[:60]); res['stage']='no_form'
if res.get('stage') is None:
t=0
for i in range(45):
t=ev(pg, "() => { const e=document.querySelector('input[name=cf-turnstile-response]'); return e?e.value.length:0 }", 0) or 0
if t>50: break
time.sleep(2)
L("ts", t)
pg.locator('span[role=checkbox][data-slot=checkbox]').first.click(force=True, timeout=10000)
time.sleep(0.8)
rs=ev(pg, GOOGLE_BTN_JS); L("grect", rs)
gp=None
for attempt in range(4):
if rs:
try:
pg.mouse.move(rs[0]-40, rs[1]-8); time.sleep(0.2)
pg.mouse.click(rs[0], rs[1]); L("gclick", attempt)
except Exception as e: L("mouse err", str(e)[:60])
time.sleep(4)
gp=gpage(ctx)
if gp is None and "accounts.google" in pg.url: gp=pg
if gp is not None: break
rs=ev(pg, GOOGLE_BTN_JS)
if gp is None:
res['stage']='no_google_page'
else:
ok=False
for i in range(12):
try:
loc=gp.locator("input[name=identifier]").first
if loc.count()>0: loc.fill(EMAIL, timeout=10000); ok=True; break
except Exception: pass
time.sleep(1.5)
L("emailfill", ok)
if not ok: res['stage']='no_email_field'
else:
time.sleep(0.7)
ev(gp, "() => { const b=document.querySelector('#identifierNext button')||document.querySelector('#identifierNext'); if(b) b.click(); return 1 }")
pwok=False
for i in range(20):
time.sleep(2)
u=gp.url
if "deletedaccount" in u or "rejected" in u: res['stage']='account_dead'; break
try:
pw=gp.locator("input[name=Passwd]").first
if pw.count()>0 and pw.is_visible(): pwok=True; break
except Exception: pass
L("pwok", pwok)
if res.get('stage') is None and pwok:
try: gp.locator("input[name=Passwd]").first.fill(PW, timeout=12000); pok=True
except Exception: pok=False
if pok:
time.sleep(0.7)
ev(gp, "() => { const b=document.querySelector('#passwordNext button')||document.querySelector('#passwordNext'); if(b) b.click(); return 1 }")
clicked=0
for i in range(45):
time.sleep(2)
host=gp.url.split("/")[2] if "://" in gp.url else ""
if host.endswith("crowllm.com"):
L("landed", gp.url[:70]); break
b=ev(gp, BODY_JS, "") or ""
low=b.lower()
if not b.strip(): continue
if "2-step" in low or "verify it" in low:
res['stage']='needs_2fa'; break
cr=None
try: cr=gp.evaluate(CONSENT_JS)
except Exception: pass
if cr and (clicked==0 or i%5==0):
clicked+=1
try:
gp.mouse.move(cr[0]-30, cr[1]-4); time.sleep(0.15)
gp.mouse.click(cr[0], cr[1])
except Exception: pass
L("g3", gp.url[:70])
else: res['stage']='pw_fill_fail'
elif res.get('stage') is None: res['stage']='no_pw_field'
# collect via refresh cookie (new-api access token)
tgt=None
for x in live(ctx):
try:
if "crowllm.com" in x.url: tgt=x; break
except Exception: pass
if tgt is None:
res['stage']=res.get('stage') or 'no_crowllm_page'
else:
time.sleep(5)
got=ev(tgt, """async () => {
const out={};
let rr=await fetch('/api/user/auth/refresh',{method:'POST',credentials:'include'});
out.refresh=rr.status;
let tok=null;
try { const j=await rr.json(); tok=(j.data&&(j.data.access_token||j.data.token))||j.access_token||null } catch(e){}
if(!tok){ try { rr=await fetch('/api/user/auth/refresh',{method:'POST',credentials:'include'}); const j=await rr.json(); tok=(j.data&&(j.data.access_token||j.data.token))||null } catch(e){} }
if(!tok) { out.err='no access token'; return out }
const h={'Content-Type':'application/json','Authorization':'Bearer '+tok};
const me=await (await fetch('/api/user/self',{credentials:'include',headers:h})).json();
const d=me.data||{};
out.uid=d.id; out.quota=d.quota; out.earned=d.earned_quota; out.used=d.used_quota; out.username=d.username; out.aff=d.aff_code;
await fetch('/api/token/',{method:'POST',credentials:'include',headers:h,body:JSON.stringify({name:'auto',remain_quota:0,expired_time:-1,unlimited_quota:true,model_limits_enabled:false,model_limits:'',allow_ips:'',group:''})});
const ls=await (await fetch('/api/token/?p=1&size=10',{credentials:'include',headers:h})).json();
const t=(ls.data&&ls.data.items&&ls.data.items[0])||null;
if(!t){ out.err='no token row'; out.raw=JSON.stringify(ls).slice(0,200); return out }
const kb=await (await fetch('/api/token/'+t.id+'/key',{method:'POST',credentials:'include',headers:h})).json();
out.tid=t.id; out.key=kb.data; out.toklen=tok.length;
return out;
}""", None, tries=2)
L("GOT", json.dumps(got, ensure_ascii=False)[:500] if got else "None")
if got and got.get('key'):
key=got['key']
if isinstance(key,dict): key=key.get('key')
key=str(key).strip("'\"")
open(OUT,"a",encoding="utf-8").write(json.dumps({'email':EMAIL,'password':PW,'uid':got.get('uid'),
'quota':got.get('quota'),'earned':got.get('earned'),'key':key,'profile':PROF,'time':int(time.time())},ensure_ascii=False)+"\n")
res['uid']=got.get('uid'); res['has_key']=True
L("SAVED keylen", len(key), "uid", got.get('uid'), "quota", got.get('quota'), "earned", got.get('earned'))
else:
res['stage']=res.get('stage') or 'no_key'
try: ctx.close()
except Exception: pass
if not res.get('has_key'):
open(FOUT,"a",encoding="utf-8").write(json.dumps(res,ensure_ascii=False)+"\n")
L("RESULT", json.dumps(res, ensure_ascii=False)[:250])
L("DONE")
+1
View File
@@ -0,0 +1 @@
playwright>=1.40