36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
# 2captcha Turnstile Quick Test
|
|
# Usage: python test_2captcha_turnstile.py <sitekey> <pageurl>
|
|
# Exit 0 = token obtained. Exit 1 = failed.
|
|
|
|
import sys, requests
|
|
|
|
CAPTCHA_KEY = '[REDACTED-KEY]'
|
|
|
|
def solve(sitekey, pageurl):
|
|
r = requests.post('https://2captcha.com/in.php', data={
|
|
'key': CAPTCHA_KEY, 'method': 'turnstile',
|
|
'sitekey': sitekey, 'pageurl': pageurl, 'json': 1,
|
|
}, timeout=30)
|
|
d = r.json()
|
|
if d.get('status') != 1:
|
|
print(f'FAIL: {d}')
|
|
return None
|
|
tid = d['request']
|
|
print(f'Captcha ID: {tid}')
|
|
for i in range(60):
|
|
r = requests.post('https://2captcha.com/res.php', data={
|
|
'key': CAPTCHA_KEY, 'action': 'get', 'id': tid, 'json': 1,
|
|
}, timeout=30)
|
|
d = r.json()
|
|
if d.get('status') == 1:
|
|
print(f'TOKEN: {d["request"][:40]}...')
|
|
return d['request']
|
|
print(f' [{i+1}s] waiting...')
|
|
print('TIMEOUT')
|
|
return None
|
|
|
|
if __name__ == '__main__':
|
|
sitekey = sys.argv[1] if len(sys.argv) > 1 else '0x4AAAAAADTYLwscqgqycexa'
|
|
pageurl = sys.argv[2] if len(sys.argv) > 2 else 'https://g0i.ai/register'
|
|
token = [REDACTED], pageurl)
|
|
sys.exit(0 if token else 1) |