wispbyte parser fleet: farm + deploy + dashboard + stdlib parsers
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
config.json
|
||||||
|
deploy_secrets.json
|
||||||
|
*.jsonl
|
||||||
|
*.session
|
||||||
|
__pycache__/
|
||||||
|
farm/wispbyte_accounts.jsonl
|
||||||
|
*.log
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# wispbyte-parser-fleet
|
||||||
|
|
||||||
|
Fleet tooling for [wispbyte.com](https://wispbyte.com) free Pterodactyl servers: mass registration (free-proxy rotation), parser deployment via pure HTTP client API, live dashboard. No browser needed — the whole lifecycle is HTTP + Cloudflare Turnstile tokens from any local solver.
|
||||||
|
|
||||||
|
## Free tier facts (measured)
|
||||||
|
|
||||||
|
- 1 free server per account: **512MB RAM / 1GB disk / 35% CPU**, 24/7, Python 3.11 / Node / Bun / Java / Rust / Lua
|
||||||
|
- Login to the client area every 14 days or the server is suspended
|
||||||
|
- Register rate-limit: ~5-8 attempts per **exit IP** per hour (429 + `retryAfterSeconds`); rotating ports of the same host does NOT help — use distinct exit IPs
|
||||||
|
- Email verification is mandatory (any temp-mail with API inbox access works)
|
||||||
|
- Server start is gated by Turnstile (`start-captcha/verify`, 5h session TTL after each solve)
|
||||||
|
|
||||||
|
## Layout
|
||||||
|
|
||||||
|
```
|
||||||
|
farm/wisp_farm2.py account+server farm: temp inbox -> turnstile -> register -> verify -> create (proxy rotation, dedup by exit IP)
|
||||||
|
farm/start_all.py boot every bank server: write entry file -> solve start-captcha -> start -> confirm running
|
||||||
|
deploy.py upload parsers/*.py + config.json to each server (write-file API) -> restart -> verify
|
||||||
|
dashboard.py stdlib HTML dashboard on :8700 (state/cpu/mem per server)
|
||||||
|
parsers/ the payload: main.py supervisor + forum_lite.py + proxy_collector.py (stdlib only)
|
||||||
|
config.example.json parser config template (TG bot token/chat, intervals)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Quick start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. farm accounts+servers (turnstile solver must listen on 127.0.0.1:8877, /solve endpoint,
|
||||||
|
# body: {"type":"turnstile","url":...,"sitekey":"0x4AAAAAABT6wll55Cy1WYrA","real_page":true})
|
||||||
|
python farm/wisp_farm2.py 10 python,nodejs
|
||||||
|
|
||||||
|
# 2. boot servers (writes entry file, solves start-captcha, starts)
|
||||||
|
python farm/start_all.py
|
||||||
|
|
||||||
|
# 3. deploy parsers (bot token via env or --token-file regex extraction; never committed)
|
||||||
|
export WISP_TG_TOKEN="***"
|
||||||
|
python deploy.py --bank farm/wispbyte_accounts.jsonl --only-python --chat -100xxxxxxxxxx
|
||||||
|
|
||||||
|
# 4. dashboard
|
||||||
|
python dashboard.py --bank farm/wispbyte_accounts.jsonl --port 8700
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parser payload
|
||||||
|
|
||||||
|
- `forum_lite.py` — polls nodeloc.com `latest.json` + v2ex hot API, keyword filter (freebies/AI/proxy), dedup state on disk, new items -> Telegram
|
||||||
|
- `proxy_collector.py` — harvests TheSpeedX + proxyscrape free lists, concurrent liveness check, digest -> Telegram, appends `proxies_live.txt` on the server
|
||||||
|
- `main.py` — supervisor: boot message, threads, crash-restart, 6h heartbeat
|
||||||
|
|
||||||
|
Everything is Python stdlib — no pip installs on the free tier.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- `serverId` in power/file APIs is the short **identifier** (e.g. `cc044323`), not the numeric id
|
||||||
|
- Bank file (`wispbyte_accounts.jsonl`) holds cookies = the only auth; keep it out of git (`.gitignore`d)
|
||||||
|
- Python egg entry is `main.py` (env `PY_FILE`); node/bun eggs need `index.js` + `package.json` instead
|
||||||
|
|
||||||
|
👻 [t.me/AlStack](https://t.me/AlStack)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"tg_bot_token": "PASTE_BOT_TOKEN",
|
||||||
|
"tg_chat_id": -1003927191915,
|
||||||
|
"tg_thread_id": null,
|
||||||
|
"server_label": "wisp-01",
|
||||||
|
"forum_interval_min": 20,
|
||||||
|
"proxy_interval_min": 180,
|
||||||
|
"proxy_sample": 150,
|
||||||
|
"heartbeat_hours": 6
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
"""dashboard.py — stdlib fleet dashboard for Wispbyte parser servers.
|
||||||
|
Reads bank jsonl, polls each account's /client/api/servers/status, serves HTML on :8700.
|
||||||
|
Usage: python dashboard.py [--bank wispbyte_accounts.jsonl] [--port 8700]
|
||||||
|
"""
|
||||||
|
import argparse, json, threading, time
|
||||||
|
import urllib.request, urllib.error
|
||||||
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||||
|
|
||||||
|
BASE = "https://wispbyte.com"
|
||||||
|
UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/131.0.0.0 Safari/537.36"
|
||||||
|
BANK = "wispbyte_accounts.jsonl"
|
||||||
|
CACHE = {"ts": 0, "rows": []}
|
||||||
|
|
||||||
|
|
||||||
|
def poll():
|
||||||
|
try:
|
||||||
|
bank = [json.loads(l) for l in open(BANK, encoding="utf-8") if l.strip()]
|
||||||
|
except Exception as e:
|
||||||
|
return [{"err": repr(e)}]
|
||||||
|
rows = []
|
||||||
|
for rec in bank:
|
||||||
|
srv = rec.get("server") or {}
|
||||||
|
row = {"email": rec.get("email", "?"), "ident": srv.get("identifier"),
|
||||||
|
"type": srv.get("type"), "node": srv.get("node"),
|
||||||
|
"proxy": (rec.get("proxy") or "home")[:24], "state": "?", "verified": rec.get("verified")}
|
||||||
|
if srv.get("identifier") and rec.get("cookies"):
|
||||||
|
try:
|
||||||
|
ck = "; ".join("%s=%s" % (k, v) for k, v in rec["cookies"].items())
|
||||||
|
req = urllib.request.Request(BASE + "/client/api/servers/status")
|
||||||
|
req.add_header("User-Agent", UA)
|
||||||
|
req.add_header("Cookie", ck)
|
||||||
|
with urllib.request.urlopen(req, timeout=25) as r:
|
||||||
|
data = json.loads(r.read().decode())
|
||||||
|
for sv in data.get("servers", []):
|
||||||
|
if sv.get("identifier") == row["ident"]:
|
||||||
|
row["state"] = sv.get("current_state")
|
||||||
|
row["cpu"] = sv.get("cpu_absolute")
|
||||||
|
row["mem_mb"] = round((sv.get("memory_bytes") or 0) / 1048576, 1)
|
||||||
|
except Exception as e:
|
||||||
|
row["state"] = "err:%s" % repr(e)[:40]
|
||||||
|
rows.append(row)
|
||||||
|
return rows
|
||||||
|
|
||||||
|
|
||||||
|
def refresh_loop():
|
||||||
|
while True:
|
||||||
|
CACHE["rows"] = poll()
|
||||||
|
CACHE["ts"] = time.time()
|
||||||
|
time.sleep(90)
|
||||||
|
|
||||||
|
|
||||||
|
def render():
|
||||||
|
rows = CACHE["rows"]
|
||||||
|
n_run = sum(1 for r in rows if r.get("state") == "running")
|
||||||
|
out = ["<html><head><meta charset='utf-8'><title>wispbyte fleet</title><style>",
|
||||||
|
"body{background:#0d1117;color:#c9d1d9;font-family:monospace;padding:20px}",
|
||||||
|
"table{border-collapse:collapse}td,th{border:1px solid #30363d;padding:6px 10px;text-align:left}",
|
||||||
|
".running{color:#3fb950}.offline{color:#f85149}.installing{color:#d29922}</style></head><body>",
|
||||||
|
"<h2>WISPBYTE PARSER FLEET</h2><p>servers: %d | running: <b class='running'>%d</b> | updated: %s</p>" % (
|
||||||
|
len(rows), n_run, time.strftime("%H:%M:%S", time.localtime(CACHE["ts"]))),
|
||||||
|
"<table><tr><th>ident</th><th>type</th><th>state</th><th>cpu%</th><th>mem MB</th><th>node</th><th>proxy</th><th>email</th></tr>"]
|
||||||
|
for r in rows:
|
||||||
|
st = r.get("state", "?")
|
||||||
|
out.append("<tr><td>%s</td><td>%s</td><td class='%s'>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>" % (
|
||||||
|
r.get("ident"), r.get("type"), st, st, r.get("cpu", ""), r.get("mem_mb", ""),
|
||||||
|
r.get("node"), r.get("proxy"), r.get("email", "")[:38]))
|
||||||
|
out.append("</table><p><a href='https://t.me/AlStack' style='color:#58a6ff'>t.me/AlStack</a></p></body></html>")
|
||||||
|
return "\n".join(out)
|
||||||
|
|
||||||
|
|
||||||
|
class H(BaseHTTPRequestHandler):
|
||||||
|
def do_GET(self):
|
||||||
|
body = render().encode()
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header("Content-Type", "text/html; charset=utf-8")
|
||||||
|
self.send_header("Content-Length", str(len(body)))
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(body)
|
||||||
|
|
||||||
|
def log_message(self, *a):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
global BANK
|
||||||
|
ap = argparse.ArgumentParser()
|
||||||
|
ap.add_argument("--bank", default=BANK)
|
||||||
|
ap.add_argument("--port", type=int, default=8700)
|
||||||
|
a = ap.parse_args()
|
||||||
|
BANK = a.bank
|
||||||
|
threading.Thread(target=refresh_loop, daemon=True).start()
|
||||||
|
time.sleep(3)
|
||||||
|
print("dashboard on http://127.0.0.1:%d (bank=%s)" % (a.port, BANK), flush=True)
|
||||||
|
ThreadingHTTPServer(("0.0.0.0", a.port), H).serve_forever()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
"""deploy.py — deploy parser fleet to Wispbyte free servers via client HTTP API.
|
||||||
|
|
||||||
|
Reads bank (accounts jsonl with cookies), uploads parsers/*.py + config.json to each
|
||||||
|
server via /client/api/server/write-file, restarts, verifies running.
|
||||||
|
|
||||||
|
Secrets NEVER live in this repo:
|
||||||
|
--token-file PATH file to regex-extract BOT_TOKEN from (e.g. your feed bot script)
|
||||||
|
or env WISP_TG_TOKEN
|
||||||
|
--chat CHAT_ID telegram chat for parser output (default -1003927191915)
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
python deploy.py --bank wispbyte_accounts.jsonl [--only-python] [--no-restart]
|
||||||
|
"""
|
||||||
|
import argparse, json, os, re, sys, time
|
||||||
|
import urllib.request, urllib.error
|
||||||
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
|
||||||
|
BASE = "https://wispbyte.com"
|
||||||
|
UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
|
||||||
|
PARSER_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "parsers")
|
||||||
|
|
||||||
|
|
||||||
|
class Api:
|
||||||
|
def __init__(self, cookies):
|
||||||
|
self.cookies = cookies
|
||||||
|
|
||||||
|
def _req(self, method, path, body=None, timeout=60):
|
||||||
|
url = BASE + path
|
||||||
|
data = json.dumps(body).encode() if body is not None else None
|
||||||
|
req = urllib.request.Request(url, data=data, method=method)
|
||||||
|
req.add_header("User-Agent", UA)
|
||||||
|
req.add_header("Accept", "*/*")
|
||||||
|
req.add_header("Origin", BASE)
|
||||||
|
req.add_header("Referer", BASE + "/client/servers")
|
||||||
|
if data:
|
||||||
|
req.add_header("Content-Type", "application/json")
|
||||||
|
ck = "; ".join("%s=%s" % (k, v) for k, v in self.cookies.items())
|
||||||
|
req.add_header("Cookie", ck)
|
||||||
|
try:
|
||||||
|
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||||
|
return r.status, r.read().decode("utf-8", "replace")
|
||||||
|
except urllib.error.HTTPError as e:
|
||||||
|
return e.code, e.read().decode("utf-8", "replace")[:300]
|
||||||
|
except Exception as e:
|
||||||
|
return -1, repr(e)[:200]
|
||||||
|
|
||||||
|
def write_file(self, ident, name, content):
|
||||||
|
return self._req("POST", "/client/api/server/write-file",
|
||||||
|
{"serverId": ident, "fileName": name, "content": content})
|
||||||
|
|
||||||
|
def power(self, action, ident):
|
||||||
|
return self._req("POST", "/client/api/server/%s" % action, {"serverId": ident})
|
||||||
|
|
||||||
|
def status(self):
|
||||||
|
return self._req("GET", "/client/api/servers/status")
|
||||||
|
|
||||||
|
|
||||||
|
def state_of(api, ident):
|
||||||
|
code, body = api.status()
|
||||||
|
if code != 200:
|
||||||
|
return "?"
|
||||||
|
try:
|
||||||
|
for sv in json.loads(body).get("servers", []):
|
||||||
|
if sv.get("identifier") == ident:
|
||||||
|
return sv.get("current_state")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return "?"
|
||||||
|
|
||||||
|
|
||||||
|
def deploy_one(rec, cfg, files, do_restart=True):
|
||||||
|
ident = (rec.get("server") or {}).get("identifier")
|
||||||
|
if not ident:
|
||||||
|
return ident, "no server"
|
||||||
|
api = Api(rec["cookies"])
|
||||||
|
c = dict(cfg)
|
||||||
|
c["server_label"] = "wisp-%s" % ident
|
||||||
|
uploads = list(files.items()) + [("config.json", json.dumps(c))]
|
||||||
|
for name, content in uploads:
|
||||||
|
code, body = api.write_file(ident, "/" + name, content)
|
||||||
|
if code != 200:
|
||||||
|
return ident, "write %s fail %s %s" % (name, code, body[:80])
|
||||||
|
if not do_restart:
|
||||||
|
return ident, "uploaded (no restart)"
|
||||||
|
st = state_of(api, ident)
|
||||||
|
if st == "running":
|
||||||
|
code, body = api.power("restart", ident)
|
||||||
|
if code != 200:
|
||||||
|
api.power("stop", ident); time.sleep(6)
|
||||||
|
code, body = api.power("start", ident)
|
||||||
|
if code != 200 and "CAPTCHA" in body.upper():
|
||||||
|
return ident, "uploaded, restart needs captcha"
|
||||||
|
else:
|
||||||
|
code, body = api.power("start", ident)
|
||||||
|
if code != 200 and "CAPTCHA" in body.upper():
|
||||||
|
return ident, "uploaded, start needs captcha"
|
||||||
|
for _ in range(8):
|
||||||
|
time.sleep(8)
|
||||||
|
if state_of(api, ident) == "running":
|
||||||
|
return ident, "DEPLOYED running"
|
||||||
|
return ident, "uploaded, state=%s" % state_of(api, ident)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
ap = argparse.ArgumentParser()
|
||||||
|
ap.add_argument("--bank", default="wispbyte_accounts.jsonl")
|
||||||
|
ap.add_argument("--token-file", default=os.environ.get("WISP_TOKEN_FILE", ""))
|
||||||
|
ap.add_argument("--chat", default=os.environ.get("WISP_TG_CHAT", "-1003927191915"))
|
||||||
|
ap.add_argument("--thread", default=os.environ.get("WISP_TG_THREAD", ""))
|
||||||
|
ap.add_argument("--only-python", action="store_true")
|
||||||
|
ap.add_argument("--no-restart", action="store_true")
|
||||||
|
ap.add_argument("--workers", type=int, default=3)
|
||||||
|
a = ap.parse_args()
|
||||||
|
|
||||||
|
token = os.environ.get("WISP_TG_TOKEN", "")
|
||||||
|
if not token and a.token_file:
|
||||||
|
m = re.search(r"BOT_TOKEN\s*=\s*['\"]([0-9]+:[A-Za-z0-9_\-]+)", open(a.token_file, encoding="utf-8", errors="ignore").read())
|
||||||
|
if m:
|
||||||
|
token = m.group(1)
|
||||||
|
if not token:
|
||||||
|
print("no TG token (env WISP_TG_TOKEN or --token-file)"); sys.exit(1)
|
||||||
|
|
||||||
|
cfg = {"tg_bot_token": token, "tg_chat_id": int(a.chat),
|
||||||
|
"tg_thread_id": int(a.thread) if a.thread else None}
|
||||||
|
|
||||||
|
files = {}
|
||||||
|
for fn in os.listdir(PARSER_DIR):
|
||||||
|
if fn.endswith(".py"):
|
||||||
|
files[fn] = open(os.path.join(PARSER_DIR, fn), encoding="utf-8").read()
|
||||||
|
print("parser files:", sorted(files))
|
||||||
|
|
||||||
|
bank = [json.loads(l) for l in open(a.bank, encoding="utf-8") if l.strip()]
|
||||||
|
if a.only_python:
|
||||||
|
bank = [r for r in bank if (r.get("server") or {}).get("type") == "python"]
|
||||||
|
print("targets:", len(bank))
|
||||||
|
|
||||||
|
results = []
|
||||||
|
with ThreadPoolExecutor(max_workers=a.workers) as ex:
|
||||||
|
futs = [ex.submit(deploy_one, r, cfg, files, not a.no_restart) for r in bank]
|
||||||
|
for f in futs:
|
||||||
|
ident, msg = f.result()
|
||||||
|
print(ident, "->", msg, flush=True)
|
||||||
|
results.append((ident, msg))
|
||||||
|
ok = sum(1 for _, m in results if "DEPLOYED" in m)
|
||||||
|
print("== deployed %d/%d ==" % (ok, len(results)))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
"""Start all bank servers: write main.py + solve start-captcha + start + status check."""
|
||||||
|
import requests, json, time, sys
|
||||||
|
|
||||||
|
SITEKEY = "0x4AAAAAABT6wll55Cy1WYrA"
|
||||||
|
SIDE = "http://127.0.0.1:8877/solve"
|
||||||
|
UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
|
||||||
|
MAIN_PY = "import time, socket, datetime\nprint('eni-worker up on', socket.gethostname(), flush=True)\nwhile True:\n print(datetime.datetime.utcnow().isoformat(), 'alive', flush=True)\n time.sleep(30)\n"
|
||||||
|
|
||||||
|
def log(*a):
|
||||||
|
print(time.strftime("%H:%M:%S"), *a, flush=True)
|
||||||
|
|
||||||
|
def session_for(acc):
|
||||||
|
s = requests.Session()
|
||||||
|
s.headers.update({"User-Agent": UA, "Accept": "*/*", "Accept-Language": "en-US,en;q=0.9",
|
||||||
|
"Origin": "https://wispbyte.com", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin"})
|
||||||
|
for k, v in acc["cookies"].items():
|
||||||
|
s.cookies.set(k, v)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def solve(url):
|
||||||
|
for att in range(3):
|
||||||
|
r = requests.post(SIDE, json={"type": "turnstile", "url": url, "sitekey": SITEKEY, "real_page": True}, timeout=300)
|
||||||
|
j = r.json()
|
||||||
|
tok = j.get("token") or j.get("solution") or (j.get("data") or {}).get("token")
|
||||||
|
if tok:
|
||||||
|
return tok
|
||||||
|
time.sleep(5)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def start_server(acc, ident):
|
||||||
|
s = session_for(acc)
|
||||||
|
ref = {"Referer": f"https://wispbyte.com/client/servers/{ident}/console"}
|
||||||
|
# write main.py (harmless if exists)
|
||||||
|
r = s.post("https://wispbyte.com/client/api/server/write-file", headers={"Content-Type": "application/json", **ref},
|
||||||
|
json={"serverId": ident, "fileName": "/main.py", "content": MAIN_PY}, timeout=60)
|
||||||
|
log(" write:", r.status_code, r.text[:80])
|
||||||
|
# captcha verify
|
||||||
|
st = s.get("https://wispbyte.com/client/api/server/start-captcha/status", params={"serverId": ident}, headers=ref, timeout=30)
|
||||||
|
need = st.json().get("required", True) if st.status_code == 200 else True
|
||||||
|
if need:
|
||||||
|
tok = solve(f"https://wispbyte.com/client/servers/{ident}/console")
|
||||||
|
if not tok:
|
||||||
|
log(" NO TOKEN")
|
||||||
|
return False
|
||||||
|
rv = s.post("https://wispbyte.com/client/api/server/start-captcha/verify", headers={"Content-Type": "application/json", **ref},
|
||||||
|
json={"cf_turnstile_response": tok, "fallback": False}, timeout=60)
|
||||||
|
log(" captcha verify:", rv.status_code, rv.text[:120])
|
||||||
|
r1 = s.post("https://wispbyte.com/client/api/server/start", headers={"Content-Type": "application/json", **ref},
|
||||||
|
json={"serverId": ident}, timeout=60)
|
||||||
|
log(" start:", r1.status_code, r1.text[:150])
|
||||||
|
if r1.status_code != 200:
|
||||||
|
return False
|
||||||
|
for i in range(6):
|
||||||
|
time.sleep(8)
|
||||||
|
try:
|
||||||
|
r2 = s.get("https://wispbyte.com/client/api/servers/status", headers=ref, timeout=60).json()
|
||||||
|
for sv in r2.get("servers", []):
|
||||||
|
if sv["identifier"] == ident:
|
||||||
|
log(" state:", sv["current_state"])
|
||||||
|
if sv["current_state"] == "running":
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
log(" status err", repr(e)[:100])
|
||||||
|
return False
|
||||||
|
|
||||||
|
def main():
|
||||||
|
bank = [json.loads(l) for l in open("wispbyte_accounts.jsonl", encoding="utf-8")]
|
||||||
|
results = []
|
||||||
|
for acc in bank:
|
||||||
|
srv = acc.get("server") or {}
|
||||||
|
ident = srv.get("identifier")
|
||||||
|
if not ident:
|
||||||
|
log(acc["email"], "no server")
|
||||||
|
continue
|
||||||
|
log("==", acc["email"], ident)
|
||||||
|
ok = start_server(acc, ident)
|
||||||
|
results.append((ident, ok))
|
||||||
|
time.sleep(10)
|
||||||
|
log("RESULTS:", results)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
"""Wispbyte farm v2 — proxy rotation. Pulls alive proxies from proxy_bot proxies.db,
|
||||||
|
tests against wispbyte.com, registers via proxy (turnstile solved locally on :8877).
|
||||||
|
Usage: python wisp_farm2.py N [types]
|
||||||
|
"""
|
||||||
|
import requests, json, secrets, time, sys, re, sqlite3, os
|
||||||
|
|
||||||
|
BASE = "https://wispbyte.com"
|
||||||
|
SITEKEY = "0x4AAAAAABT6wll55Cy1WYrA"
|
||||||
|
SIDE = "http://127.0.0.1:8877/solve"
|
||||||
|
UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
|
||||||
|
BANK = "wispbyte_accounts.jsonl"
|
||||||
|
VOIDASH_API = "https://api.voidash.com/api/v1"
|
||||||
|
AUTHK = "Bea" + "rer "
|
||||||
|
DB = "C:/Users/User/Desktop/proxy_bot/proxies.db"
|
||||||
|
|
||||||
|
N = int(sys.argv[1]) if len(sys.argv) > 1 else 5
|
||||||
|
TYPES = (sys.argv[2].split(",") if len(sys.argv) > 2 else ["python", "nodejs"])
|
||||||
|
pat_verify = re.compile(r'https://wispbyte\.com/client/api/verify-email\?token=[a-f0-9]+')
|
||||||
|
|
||||||
|
def log(*a):
|
||||||
|
print(time.strftime("%H:%M:%S"), *a, flush=True)
|
||||||
|
|
||||||
|
def hdr_browser():
|
||||||
|
return {
|
||||||
|
"User-Agent": UA,
|
||||||
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||||
|
"Accept-Language": "en-US,en;q=0.9", "Upgrade-Insecure-Requests": "1",
|
||||||
|
"Sec-Fetch-Dest": "document", "Sec-Fetch-Mode": "navigate", "Sec-Fetch-Site": "none", "Sec-Fetch-User": "?1",
|
||||||
|
"sec-ch-ua": '"Chromium";v="131", "Not_A Brand";v="24"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": '"Windows"',
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_proxies(limit=900):
|
||||||
|
# one proxy per DISTINCT exit_ip (rate-limit is per exit IP, rotating ports of same host don't help)
|
||||||
|
con = sqlite3.connect(DB)
|
||||||
|
rows = con.execute(
|
||||||
|
"""SELECT proxy, exit_ip FROM pool WHERE alive=1 AND protocol='http'
|
||||||
|
ORDER BY score DESC"""
|
||||||
|
).fetchall()
|
||||||
|
con.close()
|
||||||
|
seen = set()
|
||||||
|
out = []
|
||||||
|
for px, ip in rows:
|
||||||
|
key = ip or px.split("//")[-1].split(":")[0]
|
||||||
|
if key in seen:
|
||||||
|
continue
|
||||||
|
seen.add(key)
|
||||||
|
out.append(px)
|
||||||
|
if len(out) >= limit:
|
||||||
|
break
|
||||||
|
return out
|
||||||
|
|
||||||
|
def proxy_ok(px):
|
||||||
|
try:
|
||||||
|
r = requests.get(BASE + "/client/register", proxies={"http": px, "https": px},
|
||||||
|
headers=hdr_browser(), timeout=12)
|
||||||
|
return r.status_code == 200
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def make_inbox():
|
||||||
|
r = requests.post(VOIDASH_API + "/inboxes", json={"domain": "voidash.bond"}, timeout=30)
|
||||||
|
r.raise_for_status()
|
||||||
|
d = r.json()
|
||||||
|
return d["address"], d["session_key"]
|
||||||
|
|
||||||
|
def solve_turnstile(url):
|
||||||
|
r = requests.post(SIDE, json={"type": "turnstile", "url": url, "sitekey": SITEKEY, "real_page": True}, timeout=300)
|
||||||
|
j = r.json()
|
||||||
|
return j.get("token") or j.get("solution") or (j.get("data") or {}).get("token")
|
||||||
|
|
||||||
|
def register_one(idx, px_pool, used_px):
|
||||||
|
stype = TYPES[idx % len(TYPES)]
|
||||||
|
email = vkey = None
|
||||||
|
for px in px_pool:
|
||||||
|
if px in used_px:
|
||||||
|
continue
|
||||||
|
if not proxy_ok(px):
|
||||||
|
used_px.add(px)
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
email, vkey = make_inbox()
|
||||||
|
username = "w" + secrets.token_hex(5)
|
||||||
|
password = "Ws!" + secrets.token_hex(9) + "x7"
|
||||||
|
tok = solve_turnstile(BASE + "/client/register")
|
||||||
|
if not tok:
|
||||||
|
log(" no token, next proxy")
|
||||||
|
used_px.add(px)
|
||||||
|
continue
|
||||||
|
H = hdr_browser()
|
||||||
|
H.update({"Content-Type": "application/json", "Origin": BASE, "Referer": BASE + "/client/register",
|
||||||
|
"Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin"})
|
||||||
|
proxies = {"http": px, "https": px}
|
||||||
|
r = requests.post(BASE + "/client/api/register", headers=H, proxies=proxies,
|
||||||
|
json={"email": email, "password": password, "cf_turnstile_response": tok, "username": username},
|
||||||
|
timeout=60)
|
||||||
|
if r.status_code != 201:
|
||||||
|
log(f" reg via {px}: {r.status_code} {r.text[:120]}")
|
||||||
|
used_px.add(px)
|
||||||
|
continue
|
||||||
|
used_px.add(px)
|
||||||
|
log(f" reg OK via {px}")
|
||||||
|
cookies = dict(r.cookies)
|
||||||
|
# verify (direct, no proxy needed for voidash; wispbyte click via proxy)
|
||||||
|
HV = {"Authorization": AUTHK + vkey, "User-Agent": "Mozilla/5.0"}
|
||||||
|
s = requests.Session()
|
||||||
|
s.headers.update(hdr_browser())
|
||||||
|
s.proxies = proxies
|
||||||
|
for k, v in cookies.items():
|
||||||
|
s.cookies.set(k, v)
|
||||||
|
verified = False
|
||||||
|
for t in range(12):
|
||||||
|
rj = requests.get(VOIDASH_API + "/messages", headers=HV, timeout=30)
|
||||||
|
msgs = rj.json() if rj.status_code == 200 else []
|
||||||
|
if isinstance(msgs, dict):
|
||||||
|
msgs = msgs.get("messages", msgs.get("data", []))
|
||||||
|
for m in msgs:
|
||||||
|
rr = requests.get(f"{VOIDASH_API}/messages/{m.get('id')}", headers=HV, timeout=30)
|
||||||
|
if rr.status_code == 200:
|
||||||
|
c = pat_verify.findall(rr.text)
|
||||||
|
if c:
|
||||||
|
rv = s.get(c[0], timeout=40, allow_redirects=True)
|
||||||
|
verified = rv.status_code == 200
|
||||||
|
break
|
||||||
|
if verified:
|
||||||
|
break
|
||||||
|
time.sleep(10)
|
||||||
|
cookies = {k: v for k, v in s.cookies.items()}
|
||||||
|
# create server
|
||||||
|
r2 = s.post(BASE + "/client/api/servers/create", headers={"Content-Type": "application/json"},
|
||||||
|
json={"name": f"eni-worker-{secrets.token_hex(3)}", "description": "", "type": stype}, timeout=90)
|
||||||
|
srv = {"error": f"{r2.status_code}: {r2.text[:150]}"}
|
||||||
|
if r2.status_code == 200:
|
||||||
|
at = r2.json().get("attributes", {})
|
||||||
|
srv = {"server_id": at.get("id"), "identifier": at.get("identifier"), "uuid": at.get("uuid"),
|
||||||
|
"node": at.get("node"), "status": at.get("status"), "type": stype}
|
||||||
|
log(" server:", json.dumps(srv)[:180])
|
||||||
|
rec = {"ts": int(time.time()), "email": email, "password": password, "username": username,
|
||||||
|
"voidash_key": vkey, "cookies": cookies, "server": srv, "verified": verified, "proxy": px}
|
||||||
|
with open(BANK, "a", encoding="utf-8") as f:
|
||||||
|
f.write(json.dumps(rec) + "\n")
|
||||||
|
return "server_id" in srv
|
||||||
|
except Exception as e:
|
||||||
|
log(" EXC:", repr(e)[:200])
|
||||||
|
used_px.add(px)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def main():
|
||||||
|
px_pool = get_proxies(900)
|
||||||
|
log("proxy pool:", len(px_pool))
|
||||||
|
used = set()
|
||||||
|
ok = 0
|
||||||
|
for i in range(N):
|
||||||
|
log(f"[{i+1}/{N}]")
|
||||||
|
if register_one(i, px_pool, used):
|
||||||
|
ok += 1
|
||||||
|
time.sleep(20 + secrets.randbelow(20))
|
||||||
|
log(f"DONE ok={ok}/{N}")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
"""forum_lite.py — stdlib forum/JSON feed parser for Wispbyte free servers.
|
||||||
|
Sources: nodeloc.com latest.json, v2ex hot.json. Keyword filter (freebies/AI/abuse).
|
||||||
|
Dedup via state file, new items -> Telegram.
|
||||||
|
"""
|
||||||
|
import json, time, urllib.request, urllib.error, os, re
|
||||||
|
|
||||||
|
UA = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"}
|
||||||
|
STATE = "forum_state.json"
|
||||||
|
KEYWORDS = re.compile(r"免费|白嫖|福利|羊毛|AI|GPT|Claude|Gemini|proxy|VPN|VPS|api|key|注册|羊毛党|free|credit", re.I)
|
||||||
|
|
||||||
|
SOURCES = {
|
||||||
|
"nodeloc": "https://www.nodeloc.com/latest.json",
|
||||||
|
"v2ex": "https://www.v2ex.com/api/topics/hot.json",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def fetch(url, timeout=25):
|
||||||
|
req = urllib.request.Request(url, headers=UA)
|
||||||
|
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||||
|
return json.loads(r.read().decode("utf-8", "replace"))
|
||||||
|
|
||||||
|
|
||||||
|
def load_state():
|
||||||
|
try:
|
||||||
|
return json.load(open(STATE, encoding="utf-8"))
|
||||||
|
except Exception:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
def save_state(st):
|
||||||
|
tmp = STATE + ".tmp"
|
||||||
|
json.dump(st, open(tmp, "w", encoding="utf-8"))
|
||||||
|
os.replace(tmp, STATE)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_nodeloc(data):
|
||||||
|
out = []
|
||||||
|
for t in (data.get("topic_list") or {}).get("topics", [])[:40]:
|
||||||
|
out.append({
|
||||||
|
"id": "nl-%s" % t.get("id"),
|
||||||
|
"title": t.get("title", ""),
|
||||||
|
"url": "https://www.nodeloc.com/t/%s" % t.get("slug", t.get("id")),
|
||||||
|
"src": "nodeloc",
|
||||||
|
})
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def parse_v2ex(data):
|
||||||
|
out = []
|
||||||
|
if not isinstance(data, list):
|
||||||
|
return out
|
||||||
|
for t in data[:40]:
|
||||||
|
out.append({
|
||||||
|
"id": "vx-%s" % t.get("id"),
|
||||||
|
"title": t.get("title", ""),
|
||||||
|
"url": t.get("url", ""),
|
||||||
|
"src": "v2ex",
|
||||||
|
})
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
PARSERS = {"nodeloc": parse_nodeloc, "v2ex": parse_v2ex}
|
||||||
|
|
||||||
|
|
||||||
|
def collect():
|
||||||
|
st = load_state()
|
||||||
|
seen = set(st.get("seen", []))
|
||||||
|
fresh = []
|
||||||
|
for name, url in SOURCES.items():
|
||||||
|
try:
|
||||||
|
data = fetch(url)
|
||||||
|
for it in PARSERS[name](data):
|
||||||
|
if it["id"] in seen:
|
||||||
|
continue
|
||||||
|
seen.add(it["id"])
|
||||||
|
if KEYWORDS.search(it["title"]):
|
||||||
|
fresh.append(it)
|
||||||
|
except Exception as e:
|
||||||
|
print("forum src %s err: %r" % (name, e), flush=True)
|
||||||
|
st["seen"] = list(seen)[-4000:]
|
||||||
|
st["last_run"] = int(time.time())
|
||||||
|
save_state(st)
|
||||||
|
return fresh
|
||||||
|
|
||||||
|
|
||||||
|
def run(cfg, send_tg):
|
||||||
|
first = True
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
fresh = collect()
|
||||||
|
if fresh and not first:
|
||||||
|
lines = ["<b>FORUM LITE</b> (%s)" % cfg.get("server_label", "?")]
|
||||||
|
for it in fresh[:10]:
|
||||||
|
lines.append('- <a href="%s">%s</a> <i>%s</i>' % (it["url"], it["title"][:90].replace("<", "<"), it["src"]))
|
||||||
|
send_tg("\n".join(lines))
|
||||||
|
elif fresh and first:
|
||||||
|
print("first run: seeded %d items (silent)" % len(fresh), flush=True)
|
||||||
|
first = False
|
||||||
|
except Exception as e:
|
||||||
|
print("forum loop err: %r" % e, flush=True)
|
||||||
|
time.sleep(cfg.get("forum_interval_min", 20) * 60)
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
"""main.py — supervisor for Wispbyte parser fleet (stdlib only, Python 3.11 egg).
|
||||||
|
Uploads sit next to this file: forum_lite.py, proxy_collector.py, config.json.
|
||||||
|
Boot message -> Telegram; then parser loops in threads; auto-restart loops on crash.
|
||||||
|
"""
|
||||||
|
import json, threading, time, socket, sys, urllib.request, traceback
|
||||||
|
|
||||||
|
|
||||||
|
def load_cfg():
|
||||||
|
try:
|
||||||
|
return json.load(open("config.json", encoding="utf-8"))
|
||||||
|
except Exception:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
CFG = load_cfg()
|
||||||
|
|
||||||
|
|
||||||
|
def send_tg(text, tries=3):
|
||||||
|
tok = CFG.get("tg_bot_token", "")
|
||||||
|
chat = CFG.get("tg_chat_id")
|
||||||
|
if not tok or not chat:
|
||||||
|
print("[tg] not configured:", text[:120], flush=True)
|
||||||
|
return False
|
||||||
|
url = "https://api.telegram.org/bot%s/sendMessage" % tok
|
||||||
|
payload = {"chat_id": chat, "text": text[:4000], "parse_mode": "HTML",
|
||||||
|
"disable_web_page_preview": True}
|
||||||
|
th = CFG.get("tg_thread_id")
|
||||||
|
if th:
|
||||||
|
payload["message_thread_id"] = th
|
||||||
|
data = json.dumps(payload).encode()
|
||||||
|
for i in range(tries):
|
||||||
|
try:
|
||||||
|
req = urllib.request.Request(url, data=data, headers={"Content-Type": "application/json"})
|
||||||
|
with urllib.request.urlopen(req, timeout=20) as r:
|
||||||
|
return r.status == 200
|
||||||
|
except Exception as e:
|
||||||
|
print("[tg] err %r" % e, flush=True)
|
||||||
|
time.sleep(5 + i * 5)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def loop_guard(name, fn):
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
fn()
|
||||||
|
except Exception:
|
||||||
|
print("[supervisor] %s crashed, restart in 30s\n%s" % (name, traceback.format_exc()[-600:]), flush=True)
|
||||||
|
time.sleep(30)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
label = CFG.get("server_label", socket.gethostname())
|
||||||
|
send_tg("<b>[fleet]</b> %s UP py=%s host=%s" % (label, sys.version.split()[0], socket.gethostname()))
|
||||||
|
import forum_lite, proxy_collector
|
||||||
|
t1 = threading.Thread(target=loop_guard, args=("forum", lambda: forum_lite.run(CFG, send_tg)), daemon=True)
|
||||||
|
t2 = threading.Thread(target=loop_guard, args=("proxy", lambda: proxy_collector.run(CFG, send_tg)), daemon=True)
|
||||||
|
t1.start(); t2.start()
|
||||||
|
hb = 0
|
||||||
|
while True:
|
||||||
|
time.sleep(60)
|
||||||
|
hb += 1
|
||||||
|
if hb % (CFG.get("heartbeat_hours", 6) * 60) == 0:
|
||||||
|
send_tg("<b>[fleet]</b> %s heartbeat ok (forum=%s proxy=%s)" % (
|
||||||
|
label, t1.is_alive(), t2.is_alive()))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
"""proxy_collector.py — stdlib free-proxy harvester + liveness checker for Wispbyte servers.
|
||||||
|
Sources: TheSpeedX, proxyscrape. Checks sample concurrently, posts digest to Telegram,
|
||||||
|
keeps live list in proxies_live.txt on server disk.
|
||||||
|
"""
|
||||||
|
import json, time, urllib.request, re, os
|
||||||
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
|
|
||||||
|
UA = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/131.0.0.0 Safari/537.36"}
|
||||||
|
LIVE_FILE = "proxies_live.txt"
|
||||||
|
|
||||||
|
SOURCES = [
|
||||||
|
("thespeedx", "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt"),
|
||||||
|
("proxyscrape", "https://api.proxyscrape.com/v4/free-proxy/https-proxy/list?protocol=http&country=all&proxy_type=http&format=txt"),
|
||||||
|
]
|
||||||
|
IPPORT = re.compile(r"^\d{1,3}(?:\.\d{1,3}){3}:\d{2,5}$")
|
||||||
|
|
||||||
|
|
||||||
|
def fetch_text(url, timeout=25):
|
||||||
|
req = urllib.request.Request(url, headers=UA)
|
||||||
|
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||||
|
return r.read().decode("utf-8", "replace")
|
||||||
|
|
||||||
|
|
||||||
|
def candidates(limit_per_source=300):
|
||||||
|
out = []
|
||||||
|
for name, url in SOURCES:
|
||||||
|
try:
|
||||||
|
txt = fetch_text(url)
|
||||||
|
got = [l.strip() for l in txt.splitlines() if IPPORT.match(l.strip())][:limit_per_source]
|
||||||
|
out.extend(got)
|
||||||
|
print("proxy src %s: %d" % (name, len(got)), flush=True)
|
||||||
|
except Exception as e:
|
||||||
|
print("proxy src %s err: %r" % (name, e), flush=True)
|
||||||
|
return list(dict.fromkeys(out))
|
||||||
|
|
||||||
|
|
||||||
|
def check_one(px, timeout=7):
|
||||||
|
proxy_handler = urllib.request.ProxyHandler({"http": "http://" + px, "https": "http://" + px})
|
||||||
|
opener = urllib.request.build_opener(proxy_handler)
|
||||||
|
t0 = time.time()
|
||||||
|
try:
|
||||||
|
r = opener.open("http://api.ipify.org/", timeout=timeout)
|
||||||
|
body = r.read(64).decode().strip()
|
||||||
|
if IPPORT.match(body) or re.match(r"^\d+\.\d+", body):
|
||||||
|
return px, round(time.time() - t0, 2)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def run(cfg, send_tg):
|
||||||
|
sample_cap = cfg.get("proxy_sample", 150)
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
cands = candidates()
|
||||||
|
sample = cands[:sample_cap] if cands else []
|
||||||
|
live = []
|
||||||
|
if sample:
|
||||||
|
with ThreadPoolExecutor(max_workers=25) as ex:
|
||||||
|
futs = [ex.submit(check_one, p) for p in sample]
|
||||||
|
for f in as_completed(futs, timeout=180):
|
||||||
|
r = f.result()
|
||||||
|
if r:
|
||||||
|
live.append(r)
|
||||||
|
live.sort(key=lambda x: x[1])
|
||||||
|
if live:
|
||||||
|
with open(LIVE_FILE, "a", encoding="utf-8") as f:
|
||||||
|
for px, lat in live:
|
||||||
|
f.write("%s\n" % px)
|
||||||
|
top = "\n".join("%s (%.1fs)" % (px, lat) for px, lat in live[:30])
|
||||||
|
send_tg("<b>PROXY DIGEST</b> (%s)\nlive %d/%d checked\n<pre>%s</pre>" % (
|
||||||
|
cfg.get("server_label", "?"), len(live), len(sample), top))
|
||||||
|
else:
|
||||||
|
print("no live proxies this cycle (%d candidates)" % len(sample), flush=True)
|
||||||
|
except Exception as e:
|
||||||
|
print("proxy loop err: %r" % e, flush=True)
|
||||||
|
time.sleep(cfg.get("proxy_interval_min", 180) * 60)
|
||||||
Reference in New Issue
Block a user