autoreg-skills-max: initial public release (restored, redacted, hardened)

This commit is contained in:
baradok60915d52e8425
2026-10-20 02:16:32 +03:00
commit f58eafeb48
565 changed files with 60064 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
# -*- coding: utf-8 -*-
"""Local auth-free HTTP/CONNECT relay -> upstream proxy that requires credentials.
WHY: Chrome `--proxy-server=http://user:pass@host:port` fails with
ERR_NO_SUPPORTED_PROXIES (Chrome refuses credentials in the proxy URL). Point
Chrome/curl at this relay instead; it injects Proxy-Authorization upstream.
Also cleaner than CDP Fetch.enable(handleAuthRequests) with pattern '*' which
pauses every subresource and hangs the driver.
Usage:
python auth_proxy_relay.py <local_port> <up_host> <up_port> <user> <pass>
# then: chrome --proxy-server=http://127.0.0.1:<local_port>
# curl -x http://127.0.0.1:<local_port> https://target/...
Verify egress before relying on it:
curl -s -x http://127.0.0.1:<local_port> https://ipinfo.io/json
"""
import base64, select, socket, sys, threading
def handle(client, up_host, up_port, auth_header):
up = None
try:
data = b""
while b"\r\n\r\n" not in data:
chunk = client.recv(65536)
if not chunk:
return
data += chunk
head, rest = data.split(b"\r\n\r\n", 1)
lines = head.decode("latin1").split("\r\n")
method, target = lines[0].split()[0], lines[0].split()[1]
up = socket.create_connection((up_host, up_port), timeout=30)
if method == "CONNECT":
up.sendall(
f"CONNECT {target} HTTP/1.1\r\nHost: {target}\r\n"
f"Proxy-Authorization: {auth_header}\r\n\r\n".encode()
)
resp = b""
while b"\r\n\r\n" not in resp:
c = up.recv(4096)
if not c:
break
resp += c
first = resp.split(b"\r\n", 1)[0].decode("latin1")
# forward upstream status line verbatim to the client
client.sendall(b"HTTP/1.1 " + first.split(" ", 1)[1].encode() + b"\r\n\r\n")
tail = resp.split(b"\r\n\r\n", 1)
if len(tail) > 1 and tail[1]:
client.sendall(tail[1])
else:
new_lines = [lines[0]]
has_auth = False
for l in lines[1:]:
low = l.lower()
if low.startswith("proxy-authorization"):
has_auth = True
continue
if low.startswith("proxy-connection"):
continue
new_lines.append(l)
if not has_auth:
new_lines.append(f"Proxy-Authorization: {auth_header}")
up.sendall(("\r\n".join(new_lines) + "\r\n\r\n").encode() + rest)
# bidirectional tunnel
socks = [client, up]
while True:
r, _, x = select.select(socks, [], socks, 60)
if x or not r:
break
for s in r:
d = s.recv(65536)
if not d:
return
(up if s is client else client).sendall(d)
except Exception as e:
try:
client.sendall(b"HTTP/1.1 502 Bad Gateway\r\n\r\n" + str(e).encode()[:200])
except Exception:
pass
finally:
for s in (client, up):
try:
if s:
s.close()
except Exception:
pass
def main():
if len(sys.argv) != 6:
print(__doc__)
sys.exit(2)
port, up_host, up_port, user, pw = sys.argv[1], sys.argv[2], int(sys.argv[3]), sys.argv[4], sys.argv[5]
auth = b"Basic " + base64.b64encode(f"{user}:{pw}".encode())
srv = socket.socket()
srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
srv.bind(("127.0.0.1", int(port)))
srv.listen(128)
print(f"relay listening 127.0.0.1:{port} -> {up_host}:{up_port}", flush=True)
while True:
cl, _ = srv.accept()
threading.Thread(target=handle, args=(cl, up_host, up_port, auth.decode()), daemon=True).start()
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,209 @@
#!/usr/bin/env python3
"""
RSI AI Auto-Reg — mass account registration via Playwright + Outlook IMAP
Registers accounts, extracts API keys.
Requirements: pip install playwright httpx
Run: PYTHONPATH="" python rsiai_autoreg.py
"""
import asyncio
import random
import string
import time
import imaplib
import email
import re
import json
import httpx
from pathlib import Path
from playwright.async_api import async_playwright
# === CONFIG ===
SIGNUP_URL = "https://www.rsiai.net/sign-up"
DASHBOARD_URL = "https://www.rsiai.net/dashboard"
TOKEN_URL = "https://www.rsiai.net/token"
OUTPUT_FILE = Path.home() / "Desktop" / "_SCRIPTS" / "rsiai_keys.json"
# Outlook IMAP config
IMAP_SERVER = "outlook.office365.com"
IMAP_PORT = 993
IMAP_EMAIL = "your_email@outlook.com" # CHANGE THIS
IMAP_PASS = "your_app_password" # CHANGE THIS
def randid(k=10):
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=k))
def randid_email(base="gothbreach"):
"""Generate Outlook alias: base+rand@outlook.com"""
return f"{base}+{randid(8)}@outlook.com"
async def get_verification_code(email_addr, timeout=120):
"""Poll Outlook IMAP for verification code from RSI AI"""
deadline = time.time() + timeout
while time.time() < deadline:
try:
mail = imaplib.IMAP4_SSL(IMAP_SERVER, IMAP_PORT)
mail.login(IMAP_EMAIL, IMAP_PASS)
mail.select("inbox")
status, msgs = mail.search(None, '(FROM "rsiai" UNSEEN)')
if not status == "OK" or not msgs[0]:
status, msgs = mail.search(None, '(FROM "noreply" UNSEEN)')
if status != "OK" or not msgs[0]:
mail.logout()
await asyncio.sleep(5)
continue
msg_ids = msgs[0].split()
latest = msg_ids[-1]
status, data = mail.fetch(latest, "(RFC822)")
if status != "OK":
mail.logout()
continue
raw = data[0][1]
msg = email.message_from_bytes(raw)
subject = msg.get("Subject", "")
code_match = re.search(r'(\d{4,8})', subject)
if code_match:
mail.logout()
return code_match.group(1)
body = ""
if msg.is_multipart():
for part in msg.walk():
if part.get_content_type() == "text/plain":
body = part.get_payload(decode=True).decode(errors='ignore')
break
else:
body = msg.get_payload(decode=True).decode(errors='ignore')
code_match = re.search(r'(\d{4,8})', body)
if code_match:
mail.logout()
return code_match.group(1)
mail.logout()
except Exception as e:
print(f" IMAP error: {e}")
await asyncio.sleep(5)
return None
async def register_account(playwright, email_addr, username, password):
"""Register one account via Playwright"""
browser = await playwright.chromium.launch(headless=False)
context = await browser.new_context(
viewport={"width": 1280, "height": 800},
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
)
page = await context.new_page()
try:
await page.goto(SIGNUP_URL, wait_until="networkidle")
await asyncio.sleep(2)
await page.fill('input[name="username"]', username)
await page.fill('input[name="password"]', password)
await page.fill('input[name="password2"]', password)
await page.fill('input[name="email"]', email_addr)
await asyncio.sleep(0.5)
send_btn = page.locator('button:has-text("Send code")')
await send_btn.click()
await asyncio.sleep(0.5)
print(f" [+] Sent code to {email_addr}")
code = await get_verification_code(email_addr)
if not code:
print(f" [-] No code received for {email_addr}")
return None
print(f" [+] Code: {code}")
await page.fill('input[name="code"]', code)
agree = page.locator('input[type="checkbox"]').first
await agree.check()
create_btn = page.locator('button:has-text("Create account")')
await create_btn.click()
await asyncio.sleep(3)
if "dashboard" in page.url.lower() or "sign-up" not in page.url:
print(f" [+] Registered: {username}")
await page.goto(TOKEN_URL, wait_until="networkidle", timeout=15000)
await asyncio.sleep(2)
api_key = await page.evaluate("""() => {
const el = document.querySelector('input[value*="sk-"]');
if (el) return el.value;
const text = document.body.innerText;
const m = text.match(/sk-[a-zA-Z0-9]{20,}/);
return m ? m[0] : null;
}""")
if not api_key:
[REDACTED] = page.locator('button:has-text("Create"), button:has-text("New"), button:has-text("Generate")').first
try:
await create_key_btn.click(timeout=5000)
await asyncio.sleep(2)
api_key = await page.evaluate("""() => {
const el = document.querySelector('input[value*="sk-"]');
return el ? el.value : null;
}""")
except:
pass
result = {
"username": username,
"email": email_addr,
"password": password,
"api_key": api_key,
"created": time.strftime("%Y-%m-%d %H:%M:%S")
}
print(f" [+] API key: {api_key[:20] if api_key else 'N/A'}...")
return result
else:
print(f" [-] Registration failed for {username}")
return None
except Exception as e:
print(f" [!] Error: {e}")
return None
finally:
await browser.close()
async def main():
COUNT = int(input("How many accounts? ") or "3")
results = []
async with async_playwright() as p:
for i in range(COUNT):
email_addr = randid_email()
username = f"{randid(6)}{randid(4)}"
password = f"{randid(6)}{random.choice('!@#')}{randid(4)}"
print(f"\n[{i+1}/{COUNT}] Registering {username} ({email_addr})")
result = await register_account(p, email_addr, username, password)
if result:
results.append(result)
OUTPUT_FILE.parent.mkdir(parents=True, exist_ok=True)
with open(OUTPUT_FILE, 'w') as f:
json.dump(results, f, indent=2)
print(f" Saved to {OUTPUT_FILE}")
if i < COUNT - 1:
delay = random.uniform(15, 30)
print(f" Cooldown {delay:.0f}s...")
await asyncio.sleep(delay)
print(f"\nDone. {len(results)}/{COUNT} accounts registered.")
print(f"Keys saved to: {OUTPUT_FILE}")
for r in results:
key_preview = r['api_key'][:20] + '...' if r['api_key'] else 'NONE'
print(f" {r['username']} -> {key_preview}")
if __name__ == "__main__":
asyncio.run(main())

View File

@@ -0,0 +1,105 @@
# -*- coding: utf-8 -*-
"""TK ROAST: full verification of tooken.club stack (gateway+farm+sidecar+pool+OMP).
Usage: Python311 tk_roast.py [GW_PORT] (default 8311)
Exit code 0 = all PASS. Run after any stack change / before telling the user it works.
"""
import json, os, sys, time, urllib.request, urllib.error, subprocess
sys.stdout.reconfigure(encoding="utf-8")
GW_PORT = sys.argv[1] if len(sys.argv) > 1 else "8311"
GW = f"http://127.0.0.1:{GW_PORT}"
GW_KEY = ***"TK_GW_KEY", "tkfarm-local")
AUTH = {"Authorization": ("Bea" + "rer ") + GW_KEY} # concat: write_file masks the literal (pitfall 20d)
PY = r"C:/Users/User/AppData/Local/Programs/Python/Python311/python.exe"
OK = FAIL = 0
def chk(name, cond, info=""):
global OK, FAIL
tag = "PASS" if cond else "FAIL"
if cond: OK += 1
else: FAIL += 1
print(f"[{tag}] {name} {info}")
# 1. sidecar health
try:
r = urllib.request.urlopen("http://127.0.0.1:8877/health", timeout=10)
chk("sidecar :8877 health", r.status == 200, f"http {r.status}")
except Exception as e:
chk("sidecar :8877 health", False, repr(e)[:60])
# 2. gateway dashboard (HTTP 000/JSON error = process dead OR port owned by a foreign service -> netstat)
try:
d = json.loads(urllib.request.urlopen(GW + "/", timeout=10).read())
chk(f"gateway {GW} dashboard", d["keys_funded"] >= 30,
f"pool {d['keys_total']} funded {d['keys_funded']} dead {d['keys_dead']}")
except Exception as e:
chk(f"gateway {GW} dashboard", False, repr(e)[:80])
# 3. gateway chat completions x3 (ALL must pass)
for i in range(3):
body = json.dumps({"model": "claude-opus-5-5", "messages": [{"role": "user", "content": f"say ROAST{i}"}], "max_tokens": 10}).encode()
req = urllib.request.Request(GW + "/v1/chat/completions", data=body,
headers={**AUTH, "Content-Type": "application/json"})
try:
r = urllib.request.urlopen(req, timeout=150)
resp = json.loads(r.read())
c = resp["choices"][0]["message"]["content"][:20]
chk(f"gw chat #{i+1} claude-opus-5-5", r.status == 200, f"-> {c!r}")
except urllib.error.HTTPError as e:
chk(f"gw chat #{i+1} claude-opus-5-5", False, f"http {e.code} {e.read().decode()[:80]}")
except Exception as e:
chk(f"gw chat #{i+1} claude-opus-5-5", False, repr(e)[:80])
# 4. gateway rejects bad key
req = urllib.request.Request(GW + "/v1/models", headers={"Authorization": ("Bea" + "rer ") + "wrong"})
try:
urllib.request.urlopen(req, timeout=10)
chk("gw rejects bad key", False, "accepted wrong key!")
except urllib.error.HTTPError as e:
chk("gw rejects bad key", e.code == 401, f"http {e.code}")
except Exception as e:
chk("gw rejects bad key", False, repr(e)[:60])
# 5. funded key direct balance (bypass gw)
pool = json.load(open(os.path.expanduser("~/tmp/tk_pool_live.json"), encoding="utf-8"))
funded = [r for r in pool if r.get("balance", 0) > 1000000]
chk("live pool funded >= 50", len(funded) >= 50, f"{len(funded)} funded / {len(pool)} total")
if funded:
k = funded[0]
req = urllib.request.Request("https://tooken.club/v1/balance",
headers={"Authorization": ("Bea" + "rer ") + k["api_key"]})
try:
b = json.loads(urllib.request.urlopen(req, timeout=20).read())["balance"]
chk("direct /v1/balance funded key", b > 1000000, f"{b:,} tokens")
except Exception as e:
chk("direct /v1/balance funded key", False, repr(e)[:60])
# 6. farm alive (match cmdline, exclude bash wrappers and this script's own probe)
out = subprocess.run([PY, "-c",
"import psutil;n=sum(1 for p in psutil.process_iter(['cmdline']) if 'tk_farm.py' in ' '.join(p.info['cmdline'] or []) and 'bash' not in ' '.join(p.info['cmdline'] or []));print(n)"],
capture_output=True, text=True, timeout=30).stdout.strip()
chk("farm processes alive", out.isdigit() and int(out) >= 1, f"{out} procs")
# 7. farm log freshness (< 10 min)
log = os.path.expanduser("~/tmp/tk_farm_eni.log")
age = time.time() - os.path.getmtime(log)
chk("farm log fresh <10min", age < 600, f"{int(age)}s ago")
# 8. counts
acc = sum(1 for _ in open(os.path.expanduser("~/tmp/tk_accounts.jsonl"), encoding="utf-8"))
keys = sum(1 for _ in open(os.path.expanduser("~/tmp/tk_keys.jsonl"), encoding="utf-8"))
chk("accounts >= 300", acc >= 300, f"{acc}")
chk("keys >= 149", keys >= 149, f"{keys}")
# 9. OMP config points to THIS gateway port
t = open(os.path.expanduser("~/.omp/agent/providers.yml"), encoding="utf-8").read()
i = t.find("tooken:")
seg = t[i:i + 300]
chk(f"OMP tooken -> :{GW_PORT}", f"127.0.0.1:{GW_PORT}" in seg, "baseUrl ok" if GW_PORT in seg else "POINTS ELSEWHERE!")
chk("OMP apiKey = [REDACTED] key", GW_KEY in seg, "")
print(f"\nROAST RESULT: {OK} PASS / {FAIL} FAIL")
sys.exit(0 if FAIL == 0 else 1)