recovered snapshot from suspended aaronjaworski710 (history unavailable)
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Extract Supabase auth tokens from vani_accounts.jsonl -> vani_pool.json
|
||||
Pool entry: {email, access_token, refresh_token?, expires_at, ok}
|
||||
sb-<ref>-auth-token = access JWT (или base64 "token,refresh" split)
|
||||
"""
|
||||
import json, base64, time, sys, os
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
SRC = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'vani_accounts.jsonl')
|
||||
OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'vani_pool.json')
|
||||
|
||||
def b64d(s):
|
||||
s = s.replace('base64-', '')
|
||||
pad = '=' * (-len(s) % 4)
|
||||
try:
|
||||
return base64.urlsafe_b64decode(s + pad).decode('utf-8', 'replace')
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
pool = []
|
||||
for line in open(SRC, encoding='utf-8'):
|
||||
rec = json.loads(line)
|
||||
if not rec.get('ok'):
|
||||
continue
|
||||
email = rec['email']
|
||||
cks = rec.get('cookies') or []
|
||||
if isinstance(cks, str):
|
||||
continue
|
||||
tok = None
|
||||
for c in cks:
|
||||
if c['name'].startswith('sb-') and c['name'].endswith('-auth-token'):
|
||||
tok = c['value']
|
||||
break
|
||||
if not tok:
|
||||
continue
|
||||
raw = b64d(tok) if tok.startswith('base64-') else tok
|
||||
if raw is None:
|
||||
continue
|
||||
# формат: "<jwt>,<refresh>" или чистый jwt
|
||||
parts = raw.split(',')
|
||||
jwt = parts[0]
|
||||
refresh = parts[1] if len(parts) > 1 else None
|
||||
exp = None
|
||||
sub = None
|
||||
try:
|
||||
payload = jwt.split('.')[1]
|
||||
d = json.loads(b64d(payload) or '{}')
|
||||
exp = d.get('exp')
|
||||
sub = d.get('sub')
|
||||
except Exception:
|
||||
pass
|
||||
pool.append({
|
||||
'email': email,
|
||||
'access_token': jwt,
|
||||
'refresh_token': refresh,
|
||||
'sub': sub,
|
||||
'expires_at': exp,
|
||||
'expires_in_h': round((exp - time.time()) / 3600, 1) if exp else None,
|
||||
'ts': rec['ts'],
|
||||
})
|
||||
|
||||
json.dump(pool, open(OUT, 'w', encoding='utf-8'), indent=1)
|
||||
print(f'pool: {len(pool)} entries -> {OUT}')
|
||||
for p in pool:
|
||||
print(f" {p['email']:38} exp_in={p['expires_in_h']}h refresh={'Y' if p['refresh_token'] else 'N'}")
|
||||
Reference in New Issue
Block a user