RU README (AlStack style) + local web dashboard (task buttons, live log, /dl whitelist, pinned gw port 8700)
This commit is contained in:
@@ -46,3 +46,7 @@ cards.txt
|
|||||||
# Windows pymanager / Store-python stub junk (broken `python3` alias artifact)
|
# Windows pymanager / Store-python stub junk (broken `python3` alias artifact)
|
||||||
Python/
|
Python/
|
||||||
_cache/
|
_cache/
|
||||||
|
|
||||||
|
# dashboard task logs
|
||||||
|
tasks/
|
||||||
|
e2e_probe.log
|
||||||
|
|||||||
@@ -1,121 +1,148 @@
|
|||||||
|
👻 **[иишко — канал про AI-инструменты и связки](https://t.me/AlStack)**
|
||||||
|
|
||||||
# vetta-toolkit
|
# vetta-toolkit
|
||||||
|
|
||||||
Reverse-engineering + mass-autoreg toolkit for **Vetta / Naive** (`vetta.sh`),
|
Тулкит для **Vetta / Naive** (`vetta.sh`) — AI-API агрегатора (merchant Relixir, Inc.):
|
||||||
an AI-API aggregator (merchant Relixir, Inc.). The frontend advertises ~457
|
массовый авторег, локальный OpenAI-совместимый гейтвей с ротацией ключей,
|
||||||
models, but the live `/v1/models` catalogue (verified 2026-10-13, paginated)
|
помощник активации триала и BIN-справочник.
|
||||||
contains **369 models, all text/chat** — the image/video proxy routes return
|
|
||||||
`404 no route` and image/video model IDs are `unknown model`. One
|
|
||||||
OpenAI-compatible proxy key for everything that actually works.
|
|
||||||
|
|
||||||
**Cross-platform (Windows · Linux · macOS)** — one CLI (`vetta.py` / `run.sh` /
|
Фронтенд рекламирует ~457 моделей, но живой каталог `/v1/models` (проверено
|
||||||
`run.bat`), stdlib-only except the optional trial helpers (Playwright).
|
14.10.2026, с пагинацией) — **369 моделей, все text/chat**. Image/video роуты
|
||||||
|
отдают `404 no route`. Один OpenAI-совместимый ключ `sk_live_...` на всё, что
|
||||||
|
реально работает.
|
||||||
|
|
||||||
📖 **[GUIDE.md](GUIDE.md)** — full Windows + Linux setup & usage ·
|
**Кросс-платформенно (Windows · Linux · macOS)** — один CLI (`vetta.py` /
|
||||||
**[bin/BINS.md](bin/BINS.md)** — cards/BINs: what actually activates the trial ·
|
`run.sh` / `run.bat`) + веб-дашборд (`dashboard.py`). Всё на стандартной
|
||||||
**[REVERSE.md](REVERSE.md)** — protocol notes.
|
библиотеке, кроме опциональных помощников триала (Playwright).
|
||||||
|
|
||||||
> Educational / security-research use. Registering accounts and reading a public
|
📖 **[GUIDE.md](GUIDE.md)** — полная установка и использование (Win + Linux) ·
|
||||||
> API is fine; **pay for what you use** and cancel trials before they bill.
|
**[bin/BINS.md](bin/BINS.md)** — карты/BIN: что ДЕЙСТВИТЕЛЬНО активирует триал ·
|
||||||
> Contains **no real card data and no captcha bypass**; `bin/cc_gen.py` generates
|
**[REVERSE.md](REVERSE.md)** — протокол API глазами реверса.
|
||||||
> Luhn **test** numbers for pre-auth/form testing only (generated cards do NOT
|
|
||||||
> activate the trial — see `bin/BINS.md`).
|
|
||||||
|
|
||||||
## What's inside
|
> ⚠️ **Честно, до установки:**
|
||||||
|
> - Авторег — бесплатный и headless, работает из коробки.
|
||||||
|
> - Свежий аккаунт = **пустышка**: баланс `$0`, прокси отвечает `402
|
||||||
|
> subscription_required`, пока не активирован триал ($10 / 7 дней, Stripe).
|
||||||
|
> - **Сгенерированные/BIN-карты триал НЕ активируют** — Stripe issuer-auth +
|
||||||
|
> Radar отбивают их на pre-auth. Нужна реальная карта (своя или VCC с 3DS).
|
||||||
|
> - Полностью автоматической активации НЕТ: hCaptcha (HUMAN Security) внутри
|
||||||
|
> Stripe игнорирует синтетические клики. `auto_trial.py` делает всё, кроме
|
||||||
|
> одной галки hCaptcha, которую ставишь сам.
|
||||||
|
> - В репе нет реальных карточных данных и captcha-bypass. `bin/cc_gen.py` —
|
||||||
|
> только Luhn-**тест**-номера для проверки форм/pre-auth.
|
||||||
|
> - Образовательные / security-research цели. **Плати за то, чем пользуешься**,
|
||||||
|
> отменяй триал до списания (после 7 дней — $20/мес).
|
||||||
|
|
||||||
| File | Purpose |
|
## Что внутри
|
||||||
|------|---------|
|
|
||||||
| `vetta.py` | **Unified cross-platform CLI** — start here (`vetta register/activate/check/gateway/bin`) |
|
|
||||||
| `run.sh` / `run.bat` | OS launchers (Linux/macOS · Windows) |
|
|
||||||
| `autoreg.py` | Mass registration: disposable inbox → register → confirm → session → org → `sk_live` key, appended to `accounts.jsonl` |
|
|
||||||
| `activate_all.py` | Batch-generate Stripe trial `action_url`s for every INACTIVE account → `action_urls.txt` (manual activation helper) |
|
|
||||||
| `check_pool.py` | Status check: balance + subscription per account → ACTIVE vs DEAD (no-card / 402) |
|
|
||||||
| `gateway.py` | Local OpenAI-compatible gateway (`127.0.0.1:8700`) that rotates the pool's `sk_live` keys against vetta's proxy |
|
|
||||||
| `trial_url.py` | One-off: fetch a fresh Stripe checkout `action_url` for a single account index |
|
|
||||||
| `auto_trial.py` | Semi-auto activation: real Chrome (CDP) fills card + billing address + submits; you only tick the hCaptcha box once |
|
|
||||||
| `bin/cc_gen.py` | Luhn **test**-card generator (Visa/MC/Amex/Discover) for pre-auth/form testing |
|
|
||||||
| `bin/BINS.md` | Real VCCs + BIN reference — what actually activates the trial |
|
|
||||||
| `GUIDE.md` | Full cross-platform guide (Windows + Linux setup, usage, troubleshooting) |
|
|
||||||
| `REVERSE.md` | Full API map, schemas, auth flow, trial mechanics, honest blocker notes |
|
|
||||||
| `requirements.txt` | Python deps |
|
|
||||||
|
|
||||||
## Setup
|
| Файл | Назначение |
|
||||||
|
|------|-----------|
|
||||||
|
| `dashboard.py` | **Веб-дашборд (127.0.0.1:8710)** — все задачи кнопками, живой лог, скачивание пула. Старт отсюда, если не любишь CLI |
|
||||||
|
| `vetta.py` | Единый CLI: `register / activate / check / gateway / bin` |
|
||||||
|
| `run.sh` / `run.bat` | Лаунчеры Linux/macOS · Windows |
|
||||||
|
| `autoreg.py` | Масс-рег: временный inbox → register → confirm → session → org → ключ `sk_live` в `accounts.jsonl` |
|
||||||
|
| `activate_all.py` | Пакетно генерит Stripe `action_url` для всех НЕактивных аккаунтов → `action_urls.txt` |
|
||||||
|
| `trial_url.py` | Разово: свежий `action_url` для одного аккаунта по индексу |
|
||||||
|
| `auto_trial.py` | Полу-авто активация: настоящий Chrome (CDP) заполняет карту + billing + сабмитит; ты только ставишь галку hCaptcha ОДИН раз |
|
||||||
|
| `check_pool.py` | Статус пула: баланс + подписка по каждому аккаунту → ACTIVE vs DEAD |
|
||||||
|
| `gateway.py` | Локальный OpenAI-compat гейтвей (`127.0.0.1:8700`): ротация `sk_live` ключей, карантин `402`, backoff `429` |
|
||||||
|
| `bin/cc_gen.py` | Генератор Luhn-**тест**-карт (Visa/MC/Amex/Discover) для form/pre-auth тестов |
|
||||||
|
| `bin/BINS.md` | Реальные VCC + BIN-референс: что действительно активирует триал |
|
||||||
|
| `GUIDE.md` | Полный гайд Windows + Linux (установка, использование, траблшутинг) |
|
||||||
|
| `REVERSE.md` | Карта API, схемы, auth-флоу, механика триала, честные блокеры |
|
||||||
|
| `requirements.txt` | Python-зависимости (опциональные помощники) |
|
||||||
|
|
||||||
|
## Быстрый старт
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install -r requirements.txt
|
git clone https://github.com/gbonnet65923/vetta-toolkit
|
||||||
|
cd vetta-toolkit
|
||||||
|
pip install -r requirements.txt # опционально: autoreg/gateway работают без зависимостей
|
||||||
```
|
```
|
||||||
|
|
||||||
Python 3.10+. `autoreg.py` and `gateway.py` are stdlib-only (no deps needed to
|
Python 3.10+.
|
||||||
run them); `requirements.txt` lists optional helpers.
|
|
||||||
|
|
||||||
## 1. Register accounts
|
**Вариант 1 — дашборд (проще всего):**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python autoreg.py 5 # register 5 accounts -> accounts.jsonl
|
python dashboard.py # открой http://127.0.0.1:8710
|
||||||
|
```
|
||||||
|
|
||||||
|
Кнопки: «Зарегать N аккаунтов», «Проверить пул», «Запустить гейтвей»,
|
||||||
|
«Trial-ссылки», «BIN: тест-карты». Живой лог каждой задачи в окне, пул
|
||||||
|
скачивается одной кнопкой.
|
||||||
|
|
||||||
|
**Вариант 2 — CLI:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python vetta.py register 5 # Win: run.bat register 5 | Linux: ./run.sh register 5
|
||||||
|
python vetta.py check
|
||||||
|
python vetta.py gateway
|
||||||
|
```
|
||||||
|
|
||||||
|
## 1. Авторег (бесплатно, headless)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python autoreg.py 5 # 5 аккаунтов -> accounts.jsonl (~30-40с/акк)
|
||||||
VETTA_PW=MyFarmPass123 python autoreg.py 10
|
VETTA_PW=MyFarmPass123 python autoreg.py 10
|
||||||
```
|
```
|
||||||
|
|
||||||
Each account (~30s) yields an org `api_key.secret` = `sk_live_...` (the master
|
Каждый аккаунт даёт org `api_key.secret` = `sk_live_...` (мастер-Bearer для
|
||||||
Bearer). Records land in `accounts.jsonl` (gitignored).
|
`/v1/models`, `/v1/credits`, `/v1/proxy/*`). Записи попадают в `accounts.jsonl`
|
||||||
|
(в .gitignore).
|
||||||
|
|
||||||
## 2. Activate the trial (your own card, manual)
|
## 2. Активация триала (своя карта, вручную)
|
||||||
|
|
||||||
Fresh accounts are **empty shells**: balance `$0`, proxy → `402
|
Свежие аккаунты — пустышки (`$0`, прокси → `402`). Триал $10/7 дней
|
||||||
subscription_required`. The $10 / 7-day trial must be activated through Stripe.
|
активируется только через Stripe реальной картой:
|
||||||
|
|
||||||
Automated browsers get blocked by Stripe's invisible hCaptcha + Radar (see
|
1. Собери checkout-ссылки:
|
||||||
`REVERSE.md`), and generated/BIN cards don't pass issuer auth — so activation is
|
|
||||||
**manual, with your own card**:
|
|
||||||
|
|
||||||
1. Get checkout URL(s):
|
|
||||||
```bash
|
```bash
|
||||||
python trial_url.py accounts.jsonl 0 # single account by index
|
python trial_url.py accounts.jsonl 0 # одна ссылка по индексу
|
||||||
python activate_all.py # batch: every INACTIVE account -> action_urls.txt
|
python activate_all.py # пакетно: все НЕактивные -> action_urls.txt
|
||||||
```
|
```
|
||||||
2. Open the printed `action_url` in a **real browser** (phone/PC).
|
2. Открой `action_url` в настоящем браузере (телефон/ПК).
|
||||||
3. Enter **your own** card + matching billing country, click *Start trial*,
|
3. Введи СВОЮ карту + совпадающий billing-адрес, *Start trial*, галка hCaptcha.
|
||||||
tick the hCaptcha if it appears.
|
4. Сегодня $0; **отмени до 7-го дня**, иначе $20/мес.
|
||||||
4. $0 today; **cancel before day 7** or it bills $20/mo.
|
5. Проверь, что живо:
|
||||||
5. Verify what's live:
|
|
||||||
```bash
|
```bash
|
||||||
python check_pool.py # ACTIVE vs DEAD (no-card / 402)
|
python check_pool.py # ACTIVE vs DEAD (без карты / 402)
|
||||||
```
|
```
|
||||||
|
|
||||||
Activate one account at a time — many subscriptions on a single card can get it
|
Активируй по одному аккаунту на карту — много подписок на одной карте ловят
|
||||||
flagged. There is **no fully automated activation**: hCaptcha/Radar defeat every
|
флаг. Авто-активации «в ноль кликов» не существует: hCaptcha/Radar бьют любой
|
||||||
headless browser and token-injection attempt (documented in `REVERSE.md`).
|
headless и token-injection (детали в `REVERSE.md`).
|
||||||
|
|
||||||
## 2b. Semi-auto: `auto_trial.py` (everything except one click)
|
### 2b. Полу-авто: `auto_trial.py` (всё, кроме одного клика)
|
||||||
|
|
||||||
Automates the boring 95%: opens the checkout in a **real Chrome** (CDP), fills
|
Открывает чекаут в настоящем Chrome (CDP), сам заполняет email + карту +
|
||||||
email + your card + full billing address, picks the region, submits, then waits
|
billing + регион, сабмитит — и ждёт, пока ты поставишь видимую галку hCaptcha
|
||||||
while you tick the visible hCaptcha box **once** — synthetic CDP clicks on that
|
**один раз** (синтетические CDP-клики по ней молча игнорируются — слой HUMAN
|
||||||
box are silently ignored (HUMAN Security layer inside Stripe), verified
|
Security внутри Stripe, проверено 13.10.2026). После клика платёж доходит сам,
|
||||||
2026-10-13. After your click the payment completes by itself and the script
|
скрипт проверяет баланс/подписку через API.
|
||||||
verifies balance/subscription via the API.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. dedicated Chrome with CDP (fresh profile dir; don't touch your daily browser)
|
# 1. отдельный Chrome с CDP (свежий профиль; НЕ твой ежедневный браузер)
|
||||||
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9333 ^
|
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9333 ^
|
||||||
--user-data-dir=C:\chrome_trial --no-first-run about:blank
|
--user-data-dir=C:\chrome_trial --no-first-run about:blank
|
||||||
|
|
||||||
# 2. your card in card.json (gitignored): {"pan":"...","exp":"08/30","cvv":"...","name":"..."}
|
# 2. твоя карта в card.json (в .gitignore): {"pan":"...","exp":"08/30","cvv":"...","name":"..."}
|
||||||
|
|
||||||
# 3. run: target = index into action_urls.txt (from activate_all.py) or a JSON file
|
# 3. запуск: цель = индекс в action_urls.txt (после activate_all.py)
|
||||||
python auto_trial.py 0 # first inactive account
|
python auto_trial.py 0
|
||||||
python auto_trial.py 0 9333 300 # explicit port + human wait seconds
|
python auto_trial.py 0 9333 300 # явный порт + секунды ожидания человека
|
||||||
```
|
```
|
||||||
|
|
||||||
The card never leaves your machine: read from local JSON → typed into Stripe's
|
Карта не покидает твою машину: локальный JSON → форма Stripe → маска в логах →
|
||||||
own form → masked in logs → never stored. Result lands in
|
не хранится. Результат в `auto_trial_result.json` (в .gitignore).
|
||||||
`auto_trial_result.json` (gitignored).
|
|
||||||
|
|
||||||
## 3. Use the gateway
|
## 3. Гейтвей
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python gateway.py # 127.0.0.1:8700
|
python gateway.py # 127.0.0.1:8700
|
||||||
```
|
```
|
||||||
|
|
||||||
Then point any OpenAI client at it:
|
Любой OpenAI-клиент подключается к нему:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl http://127.0.0.1:8700/v1/chat/completions \
|
curl http://127.0.0.1:8700/v1/chat/completions \
|
||||||
@@ -123,17 +150,17 @@ curl http://127.0.0.1:8700/v1/chat/completions \
|
|||||||
-d '{"model":"openai/gpt-6.1-sol-pro","messages":[{"role":"user","content":"hi"}]}'
|
-d '{"model":"openai/gpt-6.1-sol-pro","messages":[{"role":"user","content":"hi"}]}'
|
||||||
```
|
```
|
||||||
|
|
||||||
The gateway round-robins the pool, auto-quarantines `402` (no-trial) accounts,
|
Гейтвей round-robin'ит пул, авто-карантинит `402` (без триала), backoff на
|
||||||
and backs off on `429`. Only trial-activated accounts serve traffic.
|
`429`. Трафик обслуживают только активированные аккаунты.
|
||||||
|
|
||||||
## Notes / gotchas
|
## Заметки / грабли
|
||||||
|
|
||||||
- `/v1/auth/session` returns **201**, not 200.
|
- `/v1/auth/session` возвращает **201**, не 200.
|
||||||
- New users have no org → scoped calls `403` until `POST /v1/organizations`.
|
- У нового юзера нет org → scoped-вызовы `403`, пока не сделаешь `POST /v1/organizations`.
|
||||||
- `api_key.secret` (`sk_live_...`) is the master key, **not** the session token.
|
- `api_key.secret` (`sk_live_...`) — мастер-ключ, НЕ session-токен.
|
||||||
- Heavy `urllib` probing from one IP can trigger Cloudflare `1010`; back off or
|
- Тяжёлый `urllib`-пробинг с одного IP ловит Cloudflare `1010` — backoff, либо
|
||||||
fetch the `action_url` from a browser same-origin context.
|
доставай `action_url` из браузерного same-origin контекста.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
👻 [**иишко**](https://t.me/AlStack)
|
👻 [**иишко**](https://t.me/AlStack) — канал: AI-инструменты, связки, раздачи.
|
||||||
|
|||||||
+283
@@ -0,0 +1,283 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
vetta-toolkit — local dashboard (stdlib only).
|
||||||
|
|
||||||
|
Фарм-панель для тулкита: задачи кнопками, живой лог, скачивание пула.
|
||||||
|
python dashboard.py -> http://127.0.0.1:8710
|
||||||
|
|
||||||
|
Правила:
|
||||||
|
- bind ТОЛЬКО 127.0.0.1, порт с фолбэком 8710..8719;
|
||||||
|
- /dl/ отдаёт ТОЛЬКО accounts.jsonl (карты, action_urls, card.json — никогда);
|
||||||
|
- задачи = whitelist скриптов тулкита, никакого произвольного command exec;
|
||||||
|
- каждый запуск пишет лог в tasks/<id>.log, UI поллит его.
|
||||||
|
|
||||||
|
Канал: https://t.me/AlStack
|
||||||
|
"""
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
import urllib.parse
|
||||||
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||||
|
|
||||||
|
REPO = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
PY = sys.executable
|
||||||
|
POOL = os.environ.get("VETTA_POOL", os.path.join(REPO, "accounts.jsonl"))
|
||||||
|
TASKDIR = os.path.join(REPO, "tasks")
|
||||||
|
os.makedirs(TASKDIR, exist_ok=True)
|
||||||
|
|
||||||
|
_lock = threading.Lock()
|
||||||
|
_tasks = {} # id -> dict
|
||||||
|
_counter = 0
|
||||||
|
|
||||||
|
# whitelist задач: name -> (label, argv-builder, long_running)
|
||||||
|
def _argv_register(n):
|
||||||
|
return [PY, "-u", os.path.join(REPO, "autoreg.py"), str(n)]
|
||||||
|
|
||||||
|
def _argv_check(_):
|
||||||
|
return [PY, "-u", os.path.join(REPO, "check_pool.py")]
|
||||||
|
|
||||||
|
def _argv_gateway(_):
|
||||||
|
return [PY, "-u", os.path.join(REPO, "gateway.py")]
|
||||||
|
|
||||||
|
def _argv_trials(_):
|
||||||
|
return [PY, "-u", os.path.join(REPO, "activate_all.py")]
|
||||||
|
|
||||||
|
def _argv_bin(n):
|
||||||
|
return [PY, "-u", os.path.join(REPO, "bin", "cc_gen.py"), "visa", str(n), "--cvv"]
|
||||||
|
|
||||||
|
TASKDEFS = {
|
||||||
|
"register": ("Зарегать аккаунты", _argv_register, False),
|
||||||
|
"check": ("Проверить пул", _argv_check, False),
|
||||||
|
"gateway": ("Запустить гейтвей", _argv_gateway, True),
|
||||||
|
"trials": ("Trial-ссылки", _argv_trials, False),
|
||||||
|
"bin": ("BIN: тест-карты", _argv_bin, False),
|
||||||
|
}
|
||||||
|
|
||||||
|
DL_WHITELIST = {"accounts.jsonl"}
|
||||||
|
|
||||||
|
|
||||||
|
def start_task(name, n=1):
|
||||||
|
global _counter
|
||||||
|
if name not in TASKDEFS:
|
||||||
|
return None, "unknown task"
|
||||||
|
label, builder, long_run = TASKDEFS[name]
|
||||||
|
try:
|
||||||
|
n = max(1, min(int(n), 200))
|
||||||
|
except Exception:
|
||||||
|
n = 1
|
||||||
|
with _lock:
|
||||||
|
_counter += 1
|
||||||
|
tid = f"t{_counter}"
|
||||||
|
logf = os.path.join(TASKDIR, f"{tid}.log")
|
||||||
|
env = dict(os.environ)
|
||||||
|
env["PYTHONUNBUFFERED"] = "1"
|
||||||
|
env["PYTHONIOENCODING"] = "utf-8"
|
||||||
|
if name == "gateway":
|
||||||
|
env["PORT"] = os.environ.get("VETTA_GW_PORT", "8700") # детерминированный порт дашборда
|
||||||
|
try:
|
||||||
|
fh = open(logf, "ab")
|
||||||
|
proc = subprocess.Popen(builder(n), cwd=REPO, stdout=fh, stderr=subprocess.STDOUT, env=env)
|
||||||
|
except Exception as e:
|
||||||
|
return None, f"spawn fail: {type(e).__name__}:{e}"
|
||||||
|
with _lock:
|
||||||
|
_tasks[tid] = {"id": tid, "name": name, "label": label, "pid": proc.pid,
|
||||||
|
"log": logf, "proc": proc, "long": long_run,
|
||||||
|
"started": time.time(), "ended": None, "rc": None}
|
||||||
|
return tid, None
|
||||||
|
|
||||||
|
|
||||||
|
def task_state(t):
|
||||||
|
proc = t["proc"]
|
||||||
|
rc = proc.poll()
|
||||||
|
if rc is not None and t["ended"] is None:
|
||||||
|
t["ended"] = time.time()
|
||||||
|
t["rc"] = rc
|
||||||
|
status = "running" if rc is None else ("ok" if rc == 0 else f"exit {rc}")
|
||||||
|
return status
|
||||||
|
|
||||||
|
|
||||||
|
def read_log(path, tail=200):
|
||||||
|
try:
|
||||||
|
with open(path, "rb") as f:
|
||||||
|
f.seek(0, os.SEEK_END)
|
||||||
|
size = f.tell()
|
||||||
|
f.seek(max(0, size - 200_000))
|
||||||
|
data = f.read().decode("utf-8", "replace")
|
||||||
|
lines = data.splitlines()
|
||||||
|
return "\n".join(lines[-tail:]) if tail else data
|
||||||
|
except FileNotFoundError:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def pool_stats():
|
||||||
|
total, trial, last = 0, 0, []
|
||||||
|
if os.path.exists(POOL):
|
||||||
|
for line in open(POOL, encoding="utf-8"):
|
||||||
|
line = line.strip()
|
||||||
|
if not line:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
r = json.loads(line)
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
total += 1
|
||||||
|
if r.get("trial_active"):
|
||||||
|
trial += 1
|
||||||
|
sec = str(r.get("secret") or "")
|
||||||
|
last.append({"email": r.get("email"), "org": r.get("org_name"),
|
||||||
|
"key": (sec[:11] + "..." + sec[-4:]) if len(sec) > 16 else (sec or "-"),
|
||||||
|
"trial": bool(r.get("trial_active"))})
|
||||||
|
return {"total": total, "trial_active": trial, "last": last[-8:][::-1]}
|
||||||
|
|
||||||
|
|
||||||
|
HTML = """<!doctype html>
|
||||||
|
<html lang="ru"><head><meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<title>vetta-toolkit — dashboard</title>
|
||||||
|
<style>
|
||||||
|
:root{--bg:#0d1117;--panel:#161b22;--border:#30363d;--fg:#e6edf3;--mut:#8b949e;--acc:#ff6b35;--ok:#3fb950;--bad:#f85149}
|
||||||
|
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--fg);font:14px/1.5 system-ui,Segoe UI,Arial}
|
||||||
|
.wrap{max-width:980px;margin:0 auto;padding:20px}
|
||||||
|
h1{font-size:20px;margin:0 0 4px}h1 span{color:var(--acc)}
|
||||||
|
.sub{color:var(--mut);margin-bottom:18px}
|
||||||
|
.grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
|
||||||
|
@media(max-width:760px){.grid{grid-template-columns:1fr}}
|
||||||
|
.card{background:var(--panel);border:1px solid var(--border);border-radius:10px;padding:14px}
|
||||||
|
.card h2{font-size:14px;margin:0 0 10px;color:var(--mut);text-transform:uppercase;letter-spacing:.05em}
|
||||||
|
button{background:#21262d;color:var(--fg);border:1px solid var(--border);border-radius:8px;padding:8px 14px;cursor:pointer;font-size:14px;margin:3px 4px 3px 0}
|
||||||
|
button:hover{border-color:var(--acc)}button.primary{background:var(--acc);border-color:var(--acc);color:#0d1117;font-weight:600}
|
||||||
|
input[type=number]{width:70px;background:#0d1117;border:1px solid var(--border);color:var(--fg);border-radius:8px;padding:7px 9px}
|
||||||
|
table{width:100%;border-collapse:collapse;font-size:13px}td,th{padding:5px 8px;border-bottom:1px solid var(--border);text-align:left}
|
||||||
|
th{color:var(--mut);font-weight:500}
|
||||||
|
.pill{display:inline-block;padding:1px 8px;border-radius:99px;font-size:12px;border:1px solid var(--border)}
|
||||||
|
.pill.ok{color:var(--ok);border-color:var(--ok)}.pill.run{color:var(--acc);border-color:var(--acc)}.pill.bad{color:var(--bad);border-color:var(--bad)}
|
||||||
|
pre{background:#0d1117;border:1px solid var(--border);border-radius:8px;padding:10px;max-height:340px;overflow:auto;font:12px/1.45 Consolas,monospace;white-space:pre-wrap;word-break:break-all}
|
||||||
|
a{color:var(--acc)}
|
||||||
|
.foot{margin-top:22px;color:var(--mut);font-size:13px;text-align:right}
|
||||||
|
.warn{background:#1c1208;border:1px solid #5c3d12;color:#e3b341;border-radius:8px;padding:10px 12px;font-size:13px;margin-bottom:14px}
|
||||||
|
</style></head><body><div class="wrap">
|
||||||
|
<h1>vetta<span>·</span>toolkit — dashboard</h1>
|
||||||
|
<div class="sub">vetta.sh (Naive) — 369 text/chat моделей · авторег → триал → гейтвей. Все задачи локальные, bind 127.0.0.1.</div>
|
||||||
|
<div class="warn">⚠️ Свежие аккаунты = $0 / 402, пока не активирован триал ($10/7 дней) РЕАЛЬНОЙ картой. BIN-генератор = только Luhn-тест-номера для форм, триал они НЕ активируют. Отменяй триал до 7-го дня.</div>
|
||||||
|
<div class="grid">
|
||||||
|
<div class="card"><h2>Пул</h2><div id="pool">…</div>
|
||||||
|
<a href="/dl/accounts.jsonl"><button>Скачать accounts.jsonl</button></a></div>
|
||||||
|
<div class="card"><h2>Задачи</h2>
|
||||||
|
<div>N аккаунтов: <input type="number" id="n" value="3" min="1" max="200"></div>
|
||||||
|
<button class="primary" onclick="run('register')">Зарегать</button>
|
||||||
|
<button onclick="run('check')">Проверить пул</button>
|
||||||
|
<button onclick="run('gateway')">Запустить гейтвей</button>
|
||||||
|
<button onclick="run('trials')">Trial-ссылки</button>
|
||||||
|
<button onclick="run('bin')">BIN: тест-карты</button>
|
||||||
|
<div id="tasks" style="margin-top:10px"></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="card" style="margin-top:14px"><h2>Лог <span id="logname" style="color:var(--acc)"></span></h2><pre id="log">выбери задачу…</pre></div>
|
||||||
|
<div class="foot">👻 <a href="https://t.me/AlStack">иишко</a> · github.com/gbonnet65923/vetta-toolkit</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
let sel=null;
|
||||||
|
async function j(u,o){const r=await fetch(u,o);return r.json()}
|
||||||
|
async function run(t){const n=document.getElementById('n').value;
|
||||||
|
const r=await j('/api/run',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({task:t,n:+n})});
|
||||||
|
if(r.id){sel=r.id;refresh()}}
|
||||||
|
async function refresh(){
|
||||||
|
const p=await j('/api/pool');
|
||||||
|
document.getElementById('pool').innerHTML='<table><tr><th>Всего</th><td><b>'+p.total+'</b></td><th>С триалом</th><td><b>'+p.trial_active+'</b></td></tr></table>'+
|
||||||
|
(p.last.length?'<table><tr><th>email</th><th>org</th><th>key</th><th>trial</th></tr>'+p.last.map(a=>'<tr><td>'+a.email+'</td><td>'+a.org+'</td><td><code>'+a.key+'</code></td><td>'+(a.trial?'<span class="pill ok">yes</span>':'<span class="pill">no</span>')+'</td></tr>').join('')+'</table>':'<div style="color:var(--mut)">пул пуст — жми «Зарегать»</div>');
|
||||||
|
const ts=await j('/api/tasks');
|
||||||
|
document.getElementById('tasks').innerHTML=ts.tasks.map(t=>'<div style="margin:2px 0"><a href="#" onclick="sel=\\''+t.id+'\\';refresh();return false" style="text-decoration:none">'+t.label+'</a> <span class="pill '+(t.status=='running'?'run':t.status=='ok'?'ok':'bad')+'">'+t.status+'</span></div>').join('');
|
||||||
|
if(sel){const L=await j('/api/log?id='+sel);document.getElementById('log').textContent=L.log||'(пусто)';
|
||||||
|
const e=document.getElementById('log');e.scrollTop=e.scrollHeight;
|
||||||
|
const cur=ts.tasks.find(t=>t.id==sel);document.getElementById('logname').textContent=cur?('— '+cur.label):'';}
|
||||||
|
setTimeout(refresh,2000);}
|
||||||
|
refresh();
|
||||||
|
</script></body></html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class H(BaseHTTPRequestHandler):
|
||||||
|
def log_message(self, format, *args):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _send(self, code, body, ctype="application/json; charset=utf-8"):
|
||||||
|
if isinstance(body, str):
|
||||||
|
body = body.encode("utf-8")
|
||||||
|
self.send_response(code)
|
||||||
|
self.send_header("content-type", ctype)
|
||||||
|
self.send_header("content-length", str(len(body)))
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(body)
|
||||||
|
|
||||||
|
def do_GET(self):
|
||||||
|
u = urllib.parse.urlparse(self.path)
|
||||||
|
q = urllib.parse.parse_qs(u.query)
|
||||||
|
if u.path in ("/", "/index.html"):
|
||||||
|
return self._send(200, HTML, "text/html; charset=utf-8")
|
||||||
|
if u.path == "/api/health":
|
||||||
|
return self._send(200, json.dumps({"ok": True, "pool": POOL, "repo": REPO}))
|
||||||
|
if u.path == "/api/pool":
|
||||||
|
return self._send(200, json.dumps(pool_stats()))
|
||||||
|
if u.path == "/api/tasks":
|
||||||
|
with _lock:
|
||||||
|
out = []
|
||||||
|
for t in sorted(_tasks.values(), key=lambda x: x["started"], reverse=True):
|
||||||
|
out.append({"id": t["id"], "label": t["label"], "name": t["name"],
|
||||||
|
"status": task_state(t), "pid": t["pid"]})
|
||||||
|
return self._send(200, json.dumps({"tasks": out}))
|
||||||
|
if u.path == "/api/log":
|
||||||
|
tid = (q.get("id") or [""])[0]
|
||||||
|
with _lock:
|
||||||
|
t = _tasks.get(tid)
|
||||||
|
if not t:
|
||||||
|
return self._send(404, json.dumps({"error": "no such task"}))
|
||||||
|
return self._send(200, json.dumps({"id": tid, "log": read_log(t["log"])}))
|
||||||
|
if u.path.startswith("/dl/"):
|
||||||
|
name = os.path.basename(u.path[4:])
|
||||||
|
if name not in DL_WHITELIST:
|
||||||
|
return self._send(403, json.dumps({"error": "forbidden"}))
|
||||||
|
fpath = POOL if name == "accounts.jsonl" else os.path.join(REPO, name)
|
||||||
|
if not os.path.exists(fpath):
|
||||||
|
return self._send(404, json.dumps({"error": "not found"}))
|
||||||
|
with open(fpath, "rb") as f:
|
||||||
|
return self._send(200, f.read(), "application/octet-stream")
|
||||||
|
return self._send(404, json.dumps({"error": "not found"}))
|
||||||
|
|
||||||
|
def do_POST(self):
|
||||||
|
u = urllib.parse.urlparse(self.path)
|
||||||
|
if u.path != "/api/run":
|
||||||
|
return self._send(404, json.dumps({"error": "not found"}))
|
||||||
|
try:
|
||||||
|
n = int(self.headers.get("content-length") or 0)
|
||||||
|
body = json.loads(self.rfile.read(n) or b"{}")
|
||||||
|
except Exception:
|
||||||
|
return self._send(400, json.dumps({"error": "bad json"}))
|
||||||
|
tid, err = start_task(str(body.get("task", "")), body.get("n", 1))
|
||||||
|
if err:
|
||||||
|
return self._send(400, json.dumps({"error": err}))
|
||||||
|
return self._send(200, json.dumps({"id": tid}))
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
port = int(os.environ.get("DASH_PORT", "8710"))
|
||||||
|
for p in range(port, port + 10):
|
||||||
|
try:
|
||||||
|
srv = ThreadingHTTPServer(("127.0.0.1", p), H)
|
||||||
|
break
|
||||||
|
except OSError:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
print("no free port in range", port, "-", port + 9)
|
||||||
|
sys.exit(1)
|
||||||
|
print(f"vetta dashboard -> http://127.0.0.1:{p} (pool: {POOL})")
|
||||||
|
print("Ctrl+C to stop")
|
||||||
|
try:
|
||||||
|
srv.serve_forever()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user