whellofgold / app.py
vwxyzarii's picture
Update app.py
e055ac5 verified
import requests, hashlib
from fastapi import FastAPI
BASE = "https://wheelofgold.com/api/captcha/pow/"
app = FastAPI(title="WheelOfGold POW Solver Fix",version="2.0")
headers = {
"User-Agent":"Mozilla/5.0 (Linux; Android 10) Chrome/120 Mobile",
"Accept":"application/json, text/plain, */*",
"Origin":"https://wheelofgold.com",
"Referer":"https://wheelofgold.com/",
"Content-Type":"application/json"
}
session = requests.Session()
session.headers.update(headers)
# POW Solver
def solve_nonce(salt,target):
nonce = 0
tb = bytes.fromhex(target)
L = len(tb)
while True:
h = hashlib.sha256(f"{salt}{nonce}".encode()).digest()
if h[:L] == tb:
return nonce
nonce += 1
@app.post("/auto")
def auto():
C = session.post(BASE+"challenge").json()
token = C["token"]
challenges = C["challenge"] # semua salt-target
results = []
for salt,target in challenges:
nonce = solve_nonce(salt,target)
results.append(nonce)
R = session.post(BASE+"redeem",json={
"token":token,
"solutions":results
}).json()
return {
"raw_token":token,
"solutions":results,
"redeem_result":R
}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app,host="0.0.0.0",port=7860)