2024-04-28 23:19:51 +03:00
|
|
|
|
import random
|
|
|
|
|
import hashlib
|
|
|
|
|
import json
|
|
|
|
|
import base64
|
2024-05-18 08:37:37 +03:00
|
|
|
|
from datetime import datetime, timezone
|
2024-04-28 23:19:51 +03:00
|
|
|
|
|
2024-11-18 04:53:50 +03:00
|
|
|
|
def generate_proof_token(required: bool, seed: str = "", difficulty: str = "", user_agent: str = None, proof_token: str = None):
|
2024-04-28 23:19:51 +03:00
|
|
|
|
if not required:
|
|
|
|
|
return
|
|
|
|
|
|
2024-11-18 04:53:50 +03:00
|
|
|
|
if proof_token is None:
|
2024-05-18 08:37:37 +03:00
|
|
|
|
screen = random.choice([3008, 4010, 6000]) * random.choice([1, 2, 4])
|
2024-05-18 16:37:46 +03:00
|
|
|
|
# Get current UTC time
|
|
|
|
|
now_utc = datetime.now(timezone.utc)
|
|
|
|
|
parse_time = now_utc.strftime('%a, %d %b %Y %H:%M:%S GMT')
|
2024-11-18 04:53:50 +03:00
|
|
|
|
proof_token = [
|
2024-05-18 08:37:37 +03:00
|
|
|
|
screen, parse_time,
|
|
|
|
|
None, 0, user_agent,
|
|
|
|
|
"https://tcr9i.chat.openai.com/v2/35536E1E-65B4-4D96-9D97-6ADB7EFF8147/api.js",
|
|
|
|
|
"dpl=1440a687921de39ff5ee56b92807faaadce73f13","en","en-US",
|
|
|
|
|
None,
|
|
|
|
|
"plugins−[object PluginArray]",
|
|
|
|
|
random.choice(["_reactListeningcfilawjnerp", "_reactListening9ne2dfo1i47", "_reactListening410nzwhan2a"]),
|
|
|
|
|
random.choice(["alert", "ontransitionend", "onprogress"])
|
|
|
|
|
]
|
|
|
|
|
|
2024-05-18 16:37:46 +03:00
|
|
|
|
diff_len = len(difficulty)
|
2024-04-28 23:19:51 +03:00
|
|
|
|
for i in range(100000):
|
2024-11-18 04:53:50 +03:00
|
|
|
|
proof_token[3] = i
|
|
|
|
|
json_data = json.dumps(proof_token)
|
2024-04-28 23:19:51 +03:00
|
|
|
|
base = base64.b64encode(json_data.encode()).decode()
|
2024-05-18 16:37:46 +03:00
|
|
|
|
hash_value = hashlib.sha3_512((seed + base).encode()).digest()
|
2024-04-28 23:19:51 +03:00
|
|
|
|
|
2024-05-18 16:37:46 +03:00
|
|
|
|
if hash_value.hex()[:diff_len] <= difficulty:
|
|
|
|
|
return "gAAAAAB" + base
|
2024-04-28 23:19:51 +03:00
|
|
|
|
|
|
|
|
|
fallback_base = base64.b64encode(f'"{seed}"'.encode()).decode()
|
|
|
|
|
return "gAAAAABwQ8Lk5FbGpA2NcR9dShT6gYjU7VxZ4D" + fallback_base
|