119 lines
4.0 KiB
Python
119 lines
4.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Turnstile Auto-Reg Template (Anti-Captcha + Residential Proxy)
|
|
python turnstile_autoreg.py <count> <proxy_file>
|
|
"""
|
|
|
|
import requests, json, time, random, string, sys, os
|
|
from datetime import datetime
|
|
|
|
# ===== CONFIG =====
|
|
SITE_URL = "https://TARGET.com"
|
|
SITEKEY = "0x4AAAAA..."
|
|
REGISTER_URL = "https://TARGET.com/api/register"
|
|
CAPTCHA_KEY = "YOUR_ANTI_CAPTCHA_KEY"
|
|
ALLOWED_DOMAINS = ["@gmail.com", "@outlook.com"]
|
|
|
|
DIR = os.path.dirname(os.path.abspath(__file__))
|
|
OUTPUT_FILE = os.path.join(DIR, "accounts.txt")
|
|
|
|
def load_proxies(path):
|
|
proxies = []
|
|
with open(path) as f:
|
|
for line in f:
|
|
parts = line.strip().split(":")
|
|
if len(parts) == 4:
|
|
host, port, user, pwd = parts
|
|
proxies.append(f"http://{user}:{pwd}@{host}:{port}")
|
|
return proxies
|
|
|
|
def solve_captcha(proxy_host, proxy_port, proxy_user="", proxy_pwd=""):
|
|
task = {
|
|
"type": "TurnstileTask",
|
|
"websiteURL": SITE_URL + "/register",
|
|
"websiteKey": SITEKEY,
|
|
"proxyType": "http",
|
|
"proxyAddress": proxy_host,
|
|
"proxyPort": int(proxy_port),
|
|
}
|
|
if proxy_user:
|
|
task["proxyLogin"] = proxy_user
|
|
task["proxyPassword"] = proxy_pwd
|
|
|
|
r = requests.post("https://api.anti-captcha.com/createTask", json={
|
|
"clientKey": CAPTCHA_KEY, "task": task
|
|
}, timeout=15)
|
|
if r.json().get("errorId") != 0:
|
|
return None
|
|
tid = r.json()["taskId"]
|
|
|
|
for _ in range(30):
|
|
time.sleep(2)
|
|
r = requests.post("https://api.anti-captcha.com/getTaskResult", json={
|
|
"clientKey": CAPTCHA_KEY, "taskId": tid
|
|
}, timeout=15)
|
|
d = r.json()
|
|
if d.get("status") == "ready":
|
|
return d["solution"]["token"]
|
|
if d.get("errorId") != 0:
|
|
return None
|
|
return None
|
|
|
|
def register(email, password, token, proxy_url):
|
|
px = {"http": proxy_url, "https": proxy_url}
|
|
r = requests.post(REGISTER_URL, json={
|
|
"email": email, "password": password, "cf-turnstile-response": token, "agree": True
|
|
}, headers={
|
|
"Content-Type": "application/json", "Accept": "application/json",
|
|
"Origin": SITE_URL, "Referer": SITE_URL + "/register",
|
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
|
}, proxies=px, timeout=30)
|
|
return r.status_code in (200, 201), r.json()
|
|
|
|
def gen_email(i): return f"user{i}{random.randint(10000,99999)}{random.choice(ALLOWED_DOMAINS)}"
|
|
def gen_pwd(): return ''.join(random.choices(string.ascii_letters + string.digits + "!@#$%^&*", k=12))
|
|
def log(msg, lvl="INFO"): print(f"[{datetime.now():%H:%M:%S}] [{lvl}] {msg}", flush=True)
|
|
|
|
def main():
|
|
count = int(sys.argv[1]) if len(sys.argv) > 1 else 1
|
|
proxy_file = sys.argv[2] if len(sys.argv) > 2 else "proxies.txt"
|
|
|
|
proxies = load_proxies(proxy_file)
|
|
log(f"Loaded {len(proxies)} proxies, target: {count}")
|
|
|
|
stats = {"ok": 0, "fail": 0}
|
|
for i in range(1, count + 1):
|
|
log(f"[{i}/{count}]")
|
|
proxy_url = random.choice(proxies)
|
|
# Extract host:port from proxy URL
|
|
parts = proxy_url.replace("http://", "").split("@")
|
|
auth = parts[0] if len(parts) > 1 else ""
|
|
host_port = parts[-1]
|
|
host, port = host_port.split(":")
|
|
user, pwd = [REDACTED]":") + ["", ""])[:2] if auth else ("", "")
|
|
|
|
email = gen_email(i)
|
|
pwd_str = gen_pwd()
|
|
log(f" {email}")
|
|
|
|
token = [REDACTED], port, user, pwd)
|
|
if not token:
|
|
[REDACTED]"fail"] += 1
|
|
continue
|
|
|
|
ok, resp = register(email, pwd_str, token, proxy_url)
|
|
if ok:
|
|
log(f" + REGISTERED", "SUCCESS")
|
|
with open(OUTPUT_FILE, "a") as f:
|
|
f.write(f"{email}:{pwd_str}\n")
|
|
stats["ok"] += 1
|
|
else:
|
|
stats["fail"] += 1
|
|
|
|
if i < count:
|
|
time.sleep(random.uniform(1.5, 3.5))
|
|
|
|
log(f"=== DONE: {stats['ok']}/{count} ===")
|
|
|
|
if __name__ == "__main__":
|
|
main() |