import sys, json, time, re, imaplib, email, html from email.header import decode_header from camoufox.sync_api import Camoufox TOKEN = sys.argv[3] user, pw = sys.argv[1], sys.argv[2] HOOK = """ Object.defineProperty(window, 'turnstile', { configurable: true, set(v) { this.__t = v; if (v && typeof v.render === 'function') { v.render = function(el, opts) { try { if (opts && opts.callback) opts.callback(window.__TSDONE || ''); } catch(e) {} return 'tsok'; }; } }, get() { return this.__t; } }); window.__TSDONE = %s; """ % json.dumps('') def rd(h): if not h: return '' o=[] for p,e in decode_header(h): o.append(p.decode(e or 'utf-8','replace') if isinstance(p,bytes) else p) return ''.join(o) def body(msg): t='' if msg.is_multipart(): for p in msg.walk(): if p.get_content_type()=='text/plain': try: t+=p.get_payload(decode=True).decode(p.get_content_charset() or 'utf-8','replace') except Exception: pass elif p.get_content_type()=='text/html' and not t: try: t+=html.unescape(re.sub(r'<[^>]+>',' ',p.get_payload(decode=True).decode(p.get_content_charset() or 'utf-8','replace'))) except Exception: pass else: try: t=msg.get_payload(decode=True).decode(msg.get_content_charset() or 'utf-8','replace') except Exception: t=str(msg.get_payload()) return t def wait_code(wait=150): end=time.time()+wait while True: try: M=imaplib.IMAP4_SSL('secureimap.t-online.de',993,timeout=25) M.login(user,pw); M.select('INBOX') _,d=M.search(None,'ALL'); ids=d[0].split()[-12:] for i in reversed(ids): _,x=M.fetch(i,'(RFC822)') if not x or not isinstance(x[0],tuple): continue m=email.message_from_bytes(x[0][1]); s=rd(m.get('Subject')); f=rd(m.get('From')) if 'eden' not in (f+' '+s).lower(): continue b=body(m); c=re.findall(r'\b(\d{6})\b',b) M.logout(); return (c[0] if c else None), s[:80] M.logout() except Exception: pass if time.time()>end: return None,'timeout' time.sleep(8) passw='Ed3n!'+str(int(time.time()))[-6:] res={'email':user,'pass':passw} with Camoufox(headless=True, geoip=False, humanize=True, os=['windows']) as br: pg=br.new_page() pg.add_init_script(HOOK.replace('window.__TSDONE = ""', 'window.__TSDONE = %s' % json.dumps(TOKEN))) pg.goto('https://app.edenai.run/signup', wait_until='domcontentloaded', timeout=70000) pg.wait_for_timeout(6000) pg.evaluate("() => {const b=[...document.querySelectorAll('button')].find(x=>/Accept all/i.test(x.innerText)); if(b) b.click()}") pg.wait_for_timeout(600) ins=[el for el in pg.query_selector_all('input') if el.get_attribute('type') not in ('checkbox','hidden')] for el,v in zip(ins,['Nikita','Kalb',user,passw]): try: el.fill(v) except Exception: pass pg.evaluate("() => {const l=[...document.querySelectorAll('label')].find(x=>/I agree/i.test(x.innerText)); if(l) l.click()}") pg.wait_for_timeout(500) pg.evaluate("() => {const b=[...document.querySelectorAll('button')].find(x=>x.offsetParent && /^(sign up|create account)$/i.test(x.innerText.trim())); if(b) b.click()}") pg.wait_for_timeout(12000) res['url1']=pg.url res['text1']=pg.evaluate("() => document.body.innerText")[-260:] if 'verify' in pg.url or 'confirm' in pg.url or 'signup' in pg.url: code,subj=wait_code(150) res['code']=code; res['subj']=subj if code: try: pg.fill("input[autocomplete=one-time-code], input[name*=code], input[inputmode=numeric]", code) except Exception: try: bx=pg.query_selector_all("input[maxlength='1']") for i,ch in enumerate(code): bx[i].fill(ch) except Exception as e: res['fill_err']=str(e)[:70] pg.keyboard.press('Enter'); pg.wait_for_timeout(10000) res['url2']=pg.url try: pg.goto('https://app.edenai.run/billing', wait_until='domcontentloaded', timeout=60000) pg.wait_for_timeout(7000) t=pg.evaluate("() => document.body.innerText") res['billing']=re.sub(r'\n{2,}','\n',t)[:500] except Exception as e: res['billing_err']=str(e)[:70] print(json.dumps(res, ensure_ascii=False)[:2200]); print('DONE')