Update app.py
Browse files
app.py
CHANGED
|
@@ -38,24 +38,41 @@ def solve_distance(bg_b64, target_b64):
|
|
| 38 |
async def bypass(app_id: str, public_key: str):
|
| 39 |
async with httpx.AsyncClient(timeout=30.0) as client:
|
| 40 |
try:
|
| 41 |
-
#
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
data = resp_get.json()
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
captcha_key = data['data']['captcha_key']
|
| 50 |
display_y = data['data']['display_y']
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
#
|
| 53 |
-
distance = solve_distance(
|
| 54 |
|
| 55 |
-
#
|
| 56 |
-
# Response format: "x,y"
|
| 57 |
response_val = f"{distance},{display_y}"
|
| 58 |
-
|
| 59 |
verify_payload = {
|
| 60 |
'app_id': app_id,
|
| 61 |
'public_key': public_key,
|
|
@@ -64,20 +81,14 @@ async def bypass(app_id: str, public_key: str):
|
|
| 64 |
'response': response_val
|
| 65 |
}
|
| 66 |
|
| 67 |
-
|
| 68 |
-
"Origin": "https://99faucet.com",
|
| 69 |
-
"Referer": "https://99faucet.com/"
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
resp_verify = await client.post(RS_VERIFY_URL, data=verify_payload, headers=headers)
|
| 73 |
v_data = resp_verify.json()
|
| 74 |
|
| 75 |
-
|
| 76 |
-
if v_data.get('data') == 'ok':
|
| 77 |
return {
|
| 78 |
"status": "success",
|
| 79 |
"rscaptcha_token": captcha_key,
|
| 80 |
-
"rscaptcha_response": v_data.get('result') or
|
| 81 |
}
|
| 82 |
else:
|
| 83 |
return {"status": "fail", "details": v_data}
|
|
|
|
| 38 |
async def bypass(app_id: str, public_key: str):
|
| 39 |
async with httpx.AsyncClient(timeout=30.0) as client:
|
| 40 |
try:
|
| 41 |
+
# 1. Ambil Gambar - Pastikan payload lengkap
|
| 42 |
+
# Kadang butuh rsc_v: 'v5' atau version: 'v5'
|
| 43 |
+
payload_get = {
|
| 44 |
+
'app_id': app_id,
|
| 45 |
+
'public_key': public_key,
|
| 46 |
+
'version': 'v5'
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
headers_rs = {
|
| 50 |
+
"Origin": "https://99faucet.com",
|
| 51 |
+
"Referer": "https://99faucet.com/",
|
| 52 |
+
"Content-Type": "application/x-www-form-urlencoded"
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
resp_get = await client.post(RS_GET_URL, data=payload_get, headers=headers_rs)
|
| 56 |
data = resp_get.json()
|
| 57 |
|
| 58 |
+
# DEBUG: Jika gagal, kita beri tahu apa isi respon dari RSCaptcha
|
| 59 |
+
if 'data' not in data or 'tile_image_base64' not in data['data']:
|
| 60 |
+
return {
|
| 61 |
+
"status": "error",
|
| 62 |
+
"message": "RSCaptcha tidak mengirim gambar",
|
| 63 |
+
"debug_response": data
|
| 64 |
+
}
|
| 65 |
|
| 66 |
captcha_key = data['data']['captcha_key']
|
| 67 |
display_y = data['data']['display_y']
|
| 68 |
+
bg_b64 = data['data']['master_image_base64']
|
| 69 |
+
target_b64 = data['data']['tile_image_base64']
|
| 70 |
|
| 71 |
+
# 2. Hitung Jarak
|
| 72 |
+
distance = solve_distance(bg_b64, target_b64)
|
| 73 |
|
| 74 |
+
# 3. Verifikasi
|
|
|
|
| 75 |
response_val = f"{distance},{display_y}"
|
|
|
|
| 76 |
verify_payload = {
|
| 77 |
'app_id': app_id,
|
| 78 |
'public_key': public_key,
|
|
|
|
| 81 |
'response': response_val
|
| 82 |
}
|
| 83 |
|
| 84 |
+
resp_verify = await client.post(RS_VERIFY_URL, data=verify_payload, headers=headers_rs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
v_data = resp_verify.json()
|
| 86 |
|
| 87 |
+
if v_data.get('data') == 'ok' or 'result' in v_data:
|
|
|
|
| 88 |
return {
|
| 89 |
"status": "success",
|
| 90 |
"rscaptcha_token": captcha_key,
|
| 91 |
+
"rscaptcha_response": v_data.get('result') or response_val
|
| 92 |
}
|
| 93 |
else:
|
| 94 |
return {"status": "fail", "details": v_data}
|