-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample.Geetest_v3.py
More file actions
65 lines (50 loc) · 2.09 KB
/
example.Geetest_v3.py
File metadata and controls
65 lines (50 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# geetest v3
import os
import sys
import deathbycaptcha
import json
# Put your DBC account username and password here.
username = "username"
password = "password"
# you can use authtoken instead of user/password combination
# activate and get the authtoken from DBC users panel
authtoken = "authtoken"
# to use socket client
client = deathbycaptcha.SocketClient(username, password)
# to use authtoken
# client = deathbycaptcha.SocketClient(username, password, authtoken)
# client = deathbycaptcha.HttpClient(username, password)
# IMPORTANT: challenge parameter changes everytime
# target site realoads the page
# in this case we can see parameters here
# https://www.geetest.com/demo/gt/register-enFullpage-official?t=1664547919370
# just in this case, every site is different
# we must examine the api calls to geetest to get the challenge
# Put the proxy and Geetest token data
Captcha_dict = {
'proxy': 'http://user:password@127.0.0.1:1234',
'proxytype': 'HTTP',
'gt': '022397c99c9f646f6477822485f30404',
'challenge': '536b43c61236cf1964dc93bfde421126',
'pageurl': 'https://www.geetest.com/en/demo'}
# Create a json string
json_Captcha = json.dumps(Captcha_dict)
try:
balance = client.get_balance()
print(balance)
# Put your CAPTCHA type and Json payload here:
captcha = client.decode(type=8, geetest_params=json_Captcha)
if captcha:
# The CAPTCHA was solved; captcha["captcha"] item holds its
# numeric ID, and captcha["text"] item its response.
print ("CAPTCHA %s solved: %s" % (captcha["captcha"], captcha["text"]))
# # To access the response by item
# print ("challenge:", captcha["text"]["challenge"])
# print ("validate:", captcha["text"]["validate"])
# print ("seccode:", captcha["text"]["seccode"])
if '': # check if the CAPTCHA was incorrectly solved
client.report(captcha["captcha"])
except deathbycaptcha.AccessDeniedException:
# Access to DBC API denied, check your credentials and/or balance
print ("error: Access to DBC API denied," +
"check your credentials and/or balance")