#!/usr/bin/env python3 """Runware autoreg: signup -> e-mail verify -> org -> $2 trial credit -> API key. Single-file, stdlib + requests. No browser: the only human gate is reCAPTCHA v2, which is solved through 2captcha and passed in the X-ReCaptcha-Token header. Config through env (nothing secret is hardcoded): RW_MAIL_POOL file with `address:password` lines (IMAP readable mailboxes) RW_IMAP_MAP json {domain: [host, port]} map for the same mailboxes RW_BANK output jsonl for accounts that actually received credit RW_LOG output jsonl for every attempt TWOCAPTCHA_KEY 2captcha client key RW_PROXIES comma separated http://user:pass@host:port list (optional) Usage: python rw_reg.py --domains a.com,b.com --mode probe # signup only, no IMAP wait python rw_reg.py --domains a.com --mode cycle # full path, saves key python rw_reg.py --batch 10 --mode cycle # first 10 untried domains """ import argparse import base64 import email import imaplib import json import os import random import re import string import sys import time import urllib.parse import requests RW = "https://my.runware.ai/v1" SITEKEY = "6LeflmosAAAAADd9OnG1BM7dRAvEEicuMqVIqMFk" PAGEURL = "https://my.runware.ai/signup" UA = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " "(KHTML, like Gecko) Chrome/140.0 Safari/537.36") HDR = {"Content-Type": "application/json", "Origin": "https://runware.ai", "Referer": "https://runware.ai/", "User-Agent": UA} POOL = os.environ.get("RW_MAIL_POOL", "") IMAPMAP_PATH = os.environ.get("RW_IMAP_MAP", "") BANK = os.environ.get("RW_BANK", "bank.jsonl") LOG = os.environ.get("RW_LOG", "attempts.jsonl") CAPKEY = os.environ.get("TWOCAPTCHA_KEY", "") PROXIES = [p.strip() for p in os.environ.get("RW_PROXIES", "").split(",") if p.strip()] # runware refusals that mean "this domain is finished, do not waste a captcha again" DEAD_MARKS = ("cannot create an account with this email", "already been claimed for this business domain") def log(*a): line = " ".join(str(x) for x in a) print(line.encode("ascii", "replace").decode(), flush=True) def append(path, rec): with open(path, "a", encoding="utf-8") as f: f.write(json.dumps(rec, ensure_ascii=False) + "\n") # ---------------------------------------------------------------- captcha def solve_recaptcha(tries=40): if not CAPKEY: return None, "no TWOCAPTCHA_KEY" r = requests.get("https://2captcha.com/in.php", timeout=40, params={ "key": CAPKEY, "method": "userrecaptcha", "googlekey": SITEKEY, "pageurl": PAGEURL, "json": 1}).json() if r.get("status") != 1: return None, "submit:" + str(r)[:120] cid = r["request"] for _ in range(tries): time.sleep(5) try: rr = requests.get("https://2captcha.com/res.php", timeout=40, params={ "key": CAPKEY, "action": "get", "id": cid, "json": 1}).json() except Exception: continue if rr.get("status") == 1: return rr["request"], None if rr.get("request") != "CAPCHA_NOT_READY": return None, "solve:" + str(rr)[:120] return None, "solve:timeout" # ---------------------------------------------------------------- signup def signup(addr, pw, captcha, proxy=None): s = requests.Session() if proxy: s.proxies.update({"http": proxy, "https": proxy}) body = {"email": addr, "acceptedTermsAndPrivacy": True, "authToken": {"type": "Password", "principle": addr, "secret": pw}} for attempt in range(3): try: r = s.post(RW + "/users", json=body, headers={**HDR, "X-ReCaptcha-Token": captcha}, timeout=60) except Exception as e: time.sleep(7) continue if r.status_code in (200, 201, 403, 422) or attempt == 2: try: j = r.json() msg = j.get("message") or (j.get("errors") or [{}])[0].get("message") or "" except Exception: msg = r.text[:160] return r.status_code, msg, r.text[:400] time.sleep(7) return 0, "no response", "" def verify_account(token_hash): r = requests.post(RW + "/users/verify", json={"hash": token_hash}, headers={"Content-Type": "application/json", "Origin": "https://runware.ai", "User-Agent": UA}, timeout=60) return r.status_code, r.text[:300] def auth(addr, pw): r = requests.post(RW + "/auth", json={"principle": addr, "secret": pw}, headers={"Content-Type": "application/json", "Origin": "https://runware.ai", "User-Agent": UA}, timeout=60) if r.status_code not in (200, 201): return None, "auth_%s %s" % (r.status_code, r.text[:150]) tok = (r.json() or {}).get("token") if not tok: return None, "auth_no_token " + r.text[:150] payload = tok.split(".")[1] payload += "=" * (-len(payload) % 4) uid = json.loads(base64.urlsafe_b64decode(payload)).get("userId") return {"token": tok, "uid": uid}, None def complete_registration(tok): slug = "".join(random.choice(string.ascii_lowercase) for _ in range(10)) body = {"firstName": "Team", "lastName": "Ops", "jobTitle": "Founder", "accountType": "Individual", "signUpSource": "Website", "subscribedEmails": False, "organisationName": "Studio " + slug, "airSource": slug, "teamSize": "1"} r = requests.post(RW + "/users/complete-registration", json=body, headers={**HDR, "Authorization": "Bearer " + tok}, timeout=60) return r.status_code, r.text[:300] def credit(tok, uid): """returns (best_info, all_org_ids). best_info picks the first org with credit>0.""" h = {"Authorization": "Bearer " + tok, "User-Agent": UA} r = requests.get("%s/users/%s/engagements" % (RW, uid), headers=h, timeout=60) if r.status_code != 200: return None, [], "eng_%s %s" % (r.status_code, r.text[:120]) orgs = [((e.get("organization") or {}).get("id")) for e in (r.json() or [])] orgs = [o for o in orgs if o] best = None for oid in orgs: rr = requests.get("%s/organizations/%s" % (RW, oid), headers=h, timeout=60) if rr.status_code != 200: continue j = rr.json() try: working = float(j.get("workingCreditAmount") or 0) except Exception: working = 0.0 info = {"org": oid, "credit": working, "raw": j.get("workingCreditAmount"), "free": j.get("freeCreditAmount"), "isTrial": j.get("isTrial")} if working > 0: return info, orgs, None best = best or info return best, orgs, None def make_key(tok, org): r = requests.post("%s/organizations/%s/api-keys" % (RW, org), json={"name": "k" + str(random.randint(100, 999)), "type": "Bearer"}, headers={**HDR, "Authorization": "Bearer " + tok}, timeout=60) try: return r.status_code, (r.json() or {}).get("key") except Exception: return r.status_code, None # ---------------------------------------------------------------- mail def imap_login(host, port, addr, pw, timeout=30): if int(port) == 993: m = imaplib.IMAP4_SSL(host, int(port), timeout=timeout) else: m = imaplib.IMAP4(host, int(port), timeout=timeout) m.starttls() m.login(addr, pw) return m def grab_token(m): for box in ("INBOX", "Junk", '"Junk Email"', "Spam"): try: typ, _ = m.select(box, readonly=True) except Exception: continue if typ != "OK": continue ids = [] for crit in (("FROM", "runware"), ("SUBJECT", "verify"), ("ALL", None)): try: typ, data = (m.search(None, *crit) if crit[1] else m.search(None, "ALL")) except Exception: continue if typ == "OK" and data and data[0]: ids = data[0].split() if ids: break for i in reversed(ids[-5:]): try: typ, msg = m.fetch(i, "(RFC822)") except Exception: continue if typ != "OK" or not msg or not msg[0]: continue mime = email.message_from_bytes(msg[0][1]) body = "" for part in mime.walk(): if part.get_content_type() in ("text/plain", "text/html"): try: body += part.get_payload(decode=True).decode( part.get_content_charset() or "utf-8", "replace") except Exception: pass if "runware" not in body.lower(): continue tok = extract_token(body) if tok: return tok return None def extract_token(body): b = (body or "").replace("&", "&").replace("=3D", "=") b = re.sub(r"<[^>]+>", " ", b) m = re.search(r"(?:verify-account|verify)[^\s\"'<>]*?token=([^&\"'<>\s]+)", b) if m: return urllib.parse.unquote(m.group(1)) for link in re.findall(r"https?://[^\s\"'<>]*(?:ls/click|click\?|track)[^\s\"'<>]*", b): try: r = requests.get(link.replace("&", "&"), allow_redirects=True, timeout=40, headers={"User-Agent": UA}) except Exception: continue for cand in (r.url, r.text or ""): mm = re.search(r"token=([^&\"'<>\s]+)", cand) if mm: return urllib.parse.unquote(mm.group(1)) m = re.search(r"token=([0-9a-fA-F]{16,}[^&\"'<>\s]*)", b) return urllib.parse.unquote(m.group(1)) if m else None def wait_token(addr, pw, wait=90): dom = addr.split("@")[-1].lower() hosts = [] if IMAPMAP_PATH and os.path.exists(IMAPMAP_PATH): amap = json.load(open(IMAPMAP_PATH, encoding="utf-8")) if dom in amap: val = amap[dom] hosts.append((val[0], int(val[1]))) for h in ("imap." + dom, "mail." + dom, dom): for p in (993, 143): if (h, p) not in hosts: hosts.append((h, p)) end = time.time() + wait connected = False while time.time() < end: for host, port in hosts[:6]: m = None try: m = imap_login(host, port, addr, pw) connected = True tok = grab_token(m) if tok: return tok, None break except Exception as e: last = "%s:%s %s %s" % (host, port, type(e).__name__, str(e)[:60]) finally: try: if m: m.logout() except Exception: pass if not connected: return None, "imap_unreachable " + str(last)[:100] time.sleep(8) return None, "no_mail_in_window" # ---------------------------------------------------------------- voidash inboxes VOID = "https://api.voidash.com/api/v1" def void_inbox(domain="voidash.cyou"): r = requests.post(VOID + "/inboxes", json={"domain": domain}, timeout=40) if r.status_code not in (200, 201): return None, "inbox_%s %s" % (r.status_code, r.text[:120]) j = r.json() return {"address": j["address"], "id": j["id"], "skey": j.get("session_key")}, None def void_messages(iid, skey): r = requests.get("%s/inboxes/%s/messages?limit=20" % (VOID, iid), headers={"Authorization": "Bearer " + skey}, timeout=40) if r.status_code != 200: return [] return r.json().get("messages", []) def void_body(mid, skey): r = requests.get("%s/messages/%s" % (VOID, mid), headers={"Authorization": "Bearer " + skey}, timeout=40) if r.status_code != 200: return "" j = r.json() return (j.get("text") or "") + "\n" + (j.get("html") or "") def void_token(iid, skey, wait=90): end = time.time() + wait while time.time() < end: for m in void_messages(iid, skey): body = void_body(m["id"], skey) if "runware" in body.lower() or "verify" in (m.get("subject") or "").lower(): tok = extract_token(body) if tok: return tok, None time.sleep(5) return None, "no_mail_in_window" def inspect_org(tok, org, uid): """dump the org object and try the obvious claim endpoints""" h = {"Authorization": "Bearer " + tok, "User-Agent": UA} out = {} r = requests.get("%s/organizations/%s" % (RW, org), headers=h, timeout=60) out["org_json"] = r.text[:900] for path in ("/organizations/%s/claim-credit" % org, "/organizations/%s/credit" % org, "/organizations/%s/trial" % org, "/users/%s/claim-credit" % uid): for verb in ("GET", "POST"): try: rr = requests.request(verb, RW + path, json={}, headers={**h, "Content-Type": "application/json"}, timeout=40) out["%s %s" % (verb, path)] = (rr.status_code, rr.text[:200]) except Exception as e: out["%s %s" % (verb, path)] = (0, str(e)[:80]) return out # ---------------------------------------------------------------- one account def gen_pw(): return "Rw4re!" + "".join(random.choice(string.ascii_letters + string.digits) for _ in range(10)) def run_one(addr, mail_pw, mode="cycle", idx=0, provider="imap", inbox=None, inspect=False): rec = {"ts": int(time.time()), "email": addr, "domain": addr.split("@")[-1].lower()} pw = gen_pw() rec["pw"] = pw cap, cerr = solve_recaptcha() if not cap: rec.update(stage="captcha_fail", msg=str(cerr)[:120]) return rec proxy = PROXIES[idx % len(PROXIES)] if PROXIES else None st, msg, body = signup(addr, pw, cap, proxy) rec.update(signup=st, msg=msg[:160]) if st != 201: rec["stage"] = "signup_%s" % st return rec if any(k in msg.lower() for k in DEAD_MARKS): rec["stage"] = "domain_dead" return rec if mode == "probe": rec["stage"] = "signup_ok" return rec if provider == "voidash" and inbox: rec["inbox"] = {"id": inbox["id"], "address": inbox["address"]} tok, err = void_token(inbox["id"], inbox["skey"], wait=200) else: tok, err = wait_token(addr, mail_pw) if not tok: rec.update(stage="mail_fail", msg=str(err)) return rec st, vb = verify_account(tok) rec["verify"] = st if st not in (200, 201): rec.update(stage="verify_fail", msg=vb[:150]) return rec a, err = auth(addr, pw) if not a: rec.update(stage="auth_fail", msg=str(err)[:150]) return rec st, cb = complete_registration(a["token"]) rec["complete"] = st time.sleep(2) info, orgs, err = credit(a["token"], a["uid"]) rec["credit_info"] = info if inspect and info and info.get("org"): rec["inspect"] = inspect_org(a["token"], info["org"], a["uid"]) if not info or (info.get("credit") or 0) <= 0: rec.update(stage="zero_credit", orgs=orgs) return rec st, key = make_key(a["token"], info["org"]) rec.update(stage="saved", org=info["org"], credit=info["credit"], key=key) append(BANK, {"email": addr, "pw": pw, "mail_pw": mail_pw, "domain": rec["domain"], "org": info["org"], "credit": info["credit"], "key": key, "ts": rec["ts"]}) return rec def load_pool(): by = {} for line in open(POOL, encoding="utf-8", errors="ignore"): line = line.strip() if ":" not in line or "@" not in line: continue addr, _, pw = line.rpartition(":") by.setdefault(addr.split("@")[-1].lower(), []).append((addr, pw)) return by def tried_domains(): seen = set() if os.path.exists(LOG): for line in open(LOG, encoding="utf-8", errors="replace"): try: seen.add(json.loads(line).get("domain")) except Exception: pass return seen def main(): ap = argparse.ArgumentParser() ap.add_argument("--domains", default="") ap.add_argument("--batch", type=int, default=0) ap.add_argument("--mode", choices=("probe", "cycle"), default="cycle") ap.add_argument("--sleep", type=float, default=3.0) ap.add_argument("--provider", choices=("imap", "voidash"), default="imap") ap.add_argument("--inspect", action="store_true") a = ap.parse_args() if a.provider == "imap" and not POOL: raise SystemExit("set RW_MAIL_POOL") if a.provider == "voidash": stats = {} for i in range(a.batch or 3): inbox, err = void_inbox() if not inbox: log("[%d] inbox fail %s" % (i, err)) break rec = run_one(inbox["address"], "-", "cycle", i, "voidash", inbox, a.inspect) log("[%d] %s -> %s %s" % (i, inbox["address"], rec.get("stage"), str(rec.get("credit_info"))[:90])) append(LOG, rec) stats[rec.get("stage")] = stats.get(rec.get("stage"), 0) + 1 time.sleep(a.sleep) log("== done " + json.dumps(stats)) return 0 pool = load_pool() if a.domains: doms = [d.strip().lower() for d in a.domains.split(",") if d.strip()] else: seen = tried_domains() doms = [d for d, v in sorted(pool.items(), key=lambda x: -len(x[1])) if d not in seen and len(v) >= 2][:a.batch or 10] log("== runware mode=%s domains=%d" % (a.mode, len(doms))) stats = {} for i, d in enumerate(doms): if d not in pool: log("[%d] %s not in pool" % (i, d)) continue addr, mail_pw = pool[d][0] try: rec = run_one(addr, mail_pw, a.mode, i) except Exception as e: rec = {"ts": int(time.time()), "email": addr, "domain": d, "stage": "exc", "msg": repr(e)[:160]} log("[%d] %s -> %s %s" % (i, d, rec.get("stage"), (rec.get("msg") or "")[:70])) append(LOG, rec) stats[rec.get("stage")] = stats.get(rec.get("stage"), 0) + 1 time.sleep(a.sleep) log("== done " + json.dumps(stats)) if __name__ == "__main__": sys.exit(main())