theos farm: 5 grants per egress IP (1834 theos/6 IP), rotate_farm, farm_grant, bd_probe, checkin/ip probes, tool-use+roundtrip proof
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Собирает egress-пул для фарма Theos из локальных источников и проверяет IP.
|
||||
|
||||
Пишет proxies_all.txt (только рабочие), печатает маску + egress-IP (без кредов).
|
||||
python build_proxies.py
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
OUT = "proxies_all.txt"
|
||||
CAND = []
|
||||
|
||||
|
||||
def add(url):
|
||||
if url and url not in CAND:
|
||||
CAND.append(url)
|
||||
|
||||
|
||||
# 1. VDSok DE (жёсткие порты)
|
||||
for hp in ("31.77.251.116:8894", "31.77.251.116:8895", "31.77.251.116:8896",
|
||||
"31.77.251.116:8897", "31.77.251.110:8897", "31.77.251.110:8898"):
|
||||
add("http://nst:Nst6Rot9x@%s" % hp)
|
||||
|
||||
# 2. Decodo (free DC)
|
||||
dp = "C:/Users/User/tmp/decodo_autoreg/data/accounts.jsonl"
|
||||
if os.path.exists(dp):
|
||||
for line in open(dp, encoding="utf-8"):
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
r = json.loads(line)
|
||||
if r.get("status") != "active":
|
||||
continue
|
||||
h, p = r.get("proxy_host"), r.get("proxy_port")
|
||||
u, pw = r.get("proxy_username"), r.get("proxy_password")
|
||||
if h and p and u and pw:
|
||||
add("http://%s:%s@%s:%s" % (u, pw, h, p))
|
||||
|
||||
# 3. Webshare (пул живых host:port)
|
||||
for path in ("C:/Users/User/tmp/ws/proxies.json", "C:/Users/User/tmp/ws/ws505.json",
|
||||
"C:/Users/User/tmp/ws/ws506.json"):
|
||||
if not os.path.exists(path):
|
||||
continue
|
||||
try:
|
||||
data = json.load(open(path, encoding="utf-8"))
|
||||
except Exception:
|
||||
continue
|
||||
rows = data if isinstance(data, list) else data.get("proxies") or data.get("results") or []
|
||||
for r in rows:
|
||||
if isinstance(r, dict) and r.get("url"):
|
||||
add(r["url"])
|
||||
|
||||
|
||||
def ip_of(url):
|
||||
try:
|
||||
r = subprocess.run(["curl", "-s", "-m", "8", "-x", url, "https://api.ipify.org"],
|
||||
capture_output=True, text=True, timeout=15)
|
||||
ip = (r.stdout or "").strip()
|
||||
return ip if ip.count(".") == 3 else ""
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
|
||||
def main():
|
||||
good, seen = [], {}
|
||||
for url in CAND:
|
||||
ip = ip_of(url)
|
||||
mask = url.split("@")[-1] if "@" in url else url
|
||||
if not ip:
|
||||
print("%-42s DEAD" % mask, flush=True)
|
||||
continue
|
||||
if ip in seen:
|
||||
print("%-42s %-16s dup с %s" % (mask, ip, seen[ip]), flush=True)
|
||||
continue
|
||||
seen[ip] = mask
|
||||
good.append(url)
|
||||
print("%-42s %-16s NEW" % (mask, ip), flush=True)
|
||||
open(OUT, "w", encoding="utf-8").write("\n".join(good) + "\n")
|
||||
print("\nunique_egress=%d -> %s" % (len(good), OUT))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user