withruntime autoreg: email+code and Google OAuth channels, key issuance, pool API wrapper
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""wr_net.py <name> — headless: создать ключ через UI и записать все XHR (endpoint discovery)."""
|
||||
import json, re, sys, time
|
||||
|
||||
ST = r"C:\Users\User\tmp\wr_state.json"
|
||||
name = sys.argv[1] if len(sys.argv) > 1 else "farm"
|
||||
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
calls = []
|
||||
|
||||
with sync_playwright() as p:
|
||||
b = p.chromium.launch(headless=True, channel="chrome")
|
||||
ctx = b.new_context(storage_state=ST, viewport={"width": 1400, "height": 900})
|
||||
pg = ctx.new_page()
|
||||
|
||||
def on_resp(r):
|
||||
if "/api/" in r.url or "withruntime" in r.url and r.request.resource_type in ("xhr", "fetch"):
|
||||
try:
|
||||
body = r.text()[:600]
|
||||
except Exception:
|
||||
body = "<no body>"
|
||||
calls.append({"m": r.request.method, "url": r.url, "s": r.status,
|
||||
"post": (r.request.post_data or "")[:300], "resp": body})
|
||||
|
||||
pg.on("response", on_resp)
|
||||
pg.goto("https://withruntime.com/account/keys", wait_until="domcontentloaded")
|
||||
time.sleep(4)
|
||||
print("URL", pg.url)
|
||||
txt = pg.inner_text("body")
|
||||
print("SIGNED:", "No keys yet" in txt or "Agents & API keys" in txt, "|", re.sub(r"\s+", " ", txt)[:200])
|
||||
try:
|
||||
pg.get_by_role("button", name="New key").first.click()
|
||||
time.sleep(2)
|
||||
pg.locator("input#key-name").click()
|
||||
pg.locator("input#key-name").type(name, delay=40)
|
||||
time.sleep(0.5)
|
||||
for lbl in ("Create key", "Create", "Add key"):
|
||||
btn = pg.get_by_role("button", name=re.compile(lbl, re.I))
|
||||
if btn.count():
|
||||
btn.first.click()
|
||||
print("clicked", lbl)
|
||||
break
|
||||
time.sleep(5)
|
||||
t2 = pg.inner_text("body")
|
||||
print("AFTER:", re.sub(r"\s+", " ", t2)[:900])
|
||||
print("KEYS FOUND:", re.findall(r"\b(rk_[A-Za-z0-9_\-]{8,}|rt_[A-Za-z0-9_\-]{8,}|sk-[A-Za-z0-9_\-]{8,}|wr_[A-Za-z0-9_\-]{8,})\b", t2))
|
||||
ctx.storage_state(path=ST)
|
||||
except Exception as e:
|
||||
print("ACT ERR", str(e)[:200])
|
||||
print("=== CALLS ===")
|
||||
for c in calls:
|
||||
print(c["m"], c["s"], c["url"][:120], "|", c["post"][:120], "|", c["resp"][:200].replace("\n", " "))
|
||||
b.close()
|
||||
Reference in New Issue
Block a user