Spaces:
Paused
Paused
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests, hashlib, time
|
| 2 |
+
from fastapi import FastAPI
|
| 3 |
+
from pydantic import BaseModel
|
| 4 |
+
|
| 5 |
+
# Target CAPTCHA server
|
| 6 |
+
TARGET = "https://wheelofgold.com/"
|
| 7 |
+
|
| 8 |
+
app = FastAPI(
|
| 9 |
+
title="WheelOfGold PoW Solver API",
|
| 10 |
+
version="1.0",
|
| 11 |
+
description="Auto Challenge → Solve → Redeem Proof-Of-Work Captcha"
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
# Model input redeem (opsional manual)
|
| 15 |
+
class RedeemReq(BaseModel):
|
| 16 |
+
token: str
|
| 17 |
+
nonce: int
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# --------------------------------------------
|
| 21 |
+
# FUNCTION SOLVER (Proof-Of-Work MINING)
|
| 22 |
+
# --------------------------------------------
|
| 23 |
+
def solve_pow(salt: str, target: str):
|
| 24 |
+
nonce = 0
|
| 25 |
+
target_bytes = bytes.fromhex(target)
|
| 26 |
+
L = len(target_bytes)
|
| 27 |
+
|
| 28 |
+
while True:
|
| 29 |
+
h = hashlib.sha256(f"{salt}{nonce}".encode()).digest()
|
| 30 |
+
if h[:L] == target_bytes:
|
| 31 |
+
return nonce
|
| 32 |
+
nonce += 1
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
# --------------------------------------------
|
| 36 |
+
# ENDPOINT MANUAL
|
| 37 |
+
# --------------------------------------------
|
| 38 |
+
|
| 39 |
+
@app.post("/challenge")
|
| 40 |
+
def challenge():
|
| 41 |
+
return requests.post(TARGET+"challenge").json()
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
@app.post("/solve")
|
| 45 |
+
def solve(data: dict):
|
| 46 |
+
return {"nonce": solve_pow(data["salt"], data["target"])}
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
@app.post("/redeem")
|
| 50 |
+
def redeem(data: RedeemReq):
|
| 51 |
+
return requests.post(TARGET+"redeem",
|
| 52 |
+
json={"token": data.token, "solutions": [data.nonce]}
|
| 53 |
+
).json()
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
# --------------------------------------------
|
| 57 |
+
# 🔥 1 CLICK AUTO SOLVE POW + RETURN TOKEN VALID
|
| 58 |
+
# --------------------------------------------
|
| 59 |
+
|
| 60 |
+
@app.post("/auto")
|
| 61 |
+
def auto():
|
| 62 |
+
|
| 63 |
+
# Step 1: ambil challenge dari server
|
| 64 |
+
C = requests.post(TARGET+"challenge").json()
|
| 65 |
+
|
| 66 |
+
if "challenge" not in C:
|
| 67 |
+
return {"success": False, "error": "Challenge gagal", "dump": C}
|
| 68 |
+
|
| 69 |
+
token = C["token"]
|
| 70 |
+
salt, target = C["challenge"][0] # pakai challenge pertama saja
|
| 71 |
+
|
| 72 |
+
# Step 2: solve POW mining nonce
|
| 73 |
+
nonce = solve_pow(salt, target)
|
| 74 |
+
|
| 75 |
+
# Step 3: redeem untuk dapat token valid
|
| 76 |
+
R = requests.post(TARGET+"redeem",
|
| 77 |
+
json={"token": token, "solutions": [nonce]}
|
| 78 |
+
).json()
|
| 79 |
+
|
| 80 |
+
return {
|
| 81 |
+
"success": R.get("success", False),
|
| 82 |
+
"token_human": R.get("token", None),
|
| 83 |
+
"nonce": nonce,
|
| 84 |
+
"salt": salt,
|
| 85 |
+
"target": target,
|
| 86 |
+
"expires": R.get("expires", None),
|
| 87 |
+
"debug_used_token": token
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
# --------------------------------------------
|
| 92 |
+
# LOCAL DEV ONLY
|
| 93 |
+
# --------------------------------------------
|
| 94 |
+
if __name__ == "__main__":
|
| 95 |
+
import uvicorn
|
| 96 |
+
uvicorn.run(app, port=7860, host="0.0.0.0")
|