-
Notifications
You must be signed in to change notification settings - Fork 16
/
solver.py
201 lines (158 loc) · 7.67 KB
/
solver.py
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#################################
############# Made By TheAxes #######
### Leave credits if u use any snippet ###
import requests
import httpx
import tls_client
import time
from captcha_solver import Hcaptcha_Solver, ImageToTextSolver
import json
from colorama import Fore
client = httpx.Client()
session = tls_client.Session(client_identifier="firefox_111", random_tls_extension_order=True)
# By Youtube.com/@theaxes
with open('config.json') as f:
config = json.load(f)
token = config['token']
hservice = config['captcha']['hcaptcha_service'].lower()
api_key = api_key = config['captcha']['hcaptcha_key']
def auth(token):
uri = "https://owobot.com/api/auth/discord"
r = client.get(uri)
oauth_reqstr = r.headers.get("location")
refer_oauth = client.get(oauth_reqstr).text.split("<a href=\"")[1].split("\">")[0]
payload = {
"permissions": "0",
"authorize": True
}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Content-Type': 'application/json',
'Authorization': token,
'X-Super-Properties': 'eyJvcyI6IldpbmRvd3MiLCJicm93c2VyIjoiRmlyZWZveCIsImRldmljZSI6IiIsInN5c3RlbV9sb2NhbGUiOiJlbi1VUyIsImJyb3dzZXJfdXNlcl9hZ2VudCI6Ik1vemlsbGEvNS4wIChXaW5kb3dzIE5UIDEwLjA7IFdpbjY0OyB4NjQ7IHJ2OjEwOS4wKSBHZWNrby8yMDEwMDEwMSBGaXJlZm94LzExMS4wIiwiYnJvd3Nlcl92ZXJzaW9uIjoiMTExLjAiLCJvc192ZXJzaW9uIjoiMTAiLCJyZWZlcnJlciI6IiIsInJlZmVycmluZ19kb21haW4iOiIiLCJyZWZlcnJlcl9jdXJyZW50IjoiIiwicmVmZXJyaW5nX2RvbWFpbl9jdXJyZW50IjoiIiwicmVsZWFzZV9jaGFubmVsIjoic3RhYmxlIiwiY2xpZW50X2J1aWxkX251bWJlciI6MTg3NTk5LCJjbGllbnRfZXZlbnRfc291cmNlIjpudWxsfQ==',
'X-Discord-Locale': 'en-US',
'X-Debug-Options': 'bugReporterEnabled',
'Origin': 'https://discord.com',
'Connection': 'keep-alive',
'Referer': refer_oauth,
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'TE': 'trailers',
}
response = session.post(oauth_reqstr, headers=headers, json=payload)
if response.status_code == 200:
if "location" in response.text:
locauri = response.json().get("location")
hosturi = locauri.replace("https://", "").replace("http://", "").split("/")[0]
headers = {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8","accept-encoding": "gzip, deflate, br","accept-language": "en-US,en;q=0.5","connection": "keep-alive",
"host": hosturi,
"referer": "https://discord.com/","sec-fetch-dest": "document","sec-fetch-mode": "navigate","sec-fetch-site": "cross-site","sec-fetch-user": "?1", "upgrade-insecure-requests": "1","user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0"
}
res2 = client.get(locauri, headers=headers)
if res2.status_code in (302, 307):
try:
cook = res2.headers['Set-Cookie'].split(";")[0]
except:
cook = None
cookie = f"_ga=GA1.2.509834688.1718790840; _gid=GA1.2.1642127289.1718790840;{cook};"
print("retrived cookie for solver")
return cookie
else:
print(f"(-) Failed to add token to oauth | {res2.text}, {res2.status_code}")
elif "You need to verify your account" in response.text:
print(f"(!) Invalid Token [{token[:25]}...]")
else:
print(f"(!) Submit Error | {response.text}")
def solve_owo_by_scrappey_api_method(cookie):
url = f'https://publisher.scrappey.com/api/v1?key={api_key}'
headers = {'Content-Type': 'application/json'}
data = {
'cmd': 'request.get',
'url': 'https://owo-captcha-solver.vercel.app/solve_hcaptcha',
'video': True,
"automaticallySolveCaptchas": True,
"alwaysLoad": [
""
],
"browserActions": [
{
"type": "wait",
"wait": 5
},
]
}
response = requests.post(url, headers=headers, json=data)
if response.json()['solution']['innerText']:
print(f"{Fore.LIGHTBLUE_EX}[{hservice}] Solved Hcaptcha, Submitting results to owobot...{Fore.RESET}")
res = requests.post("https://owobot.com/api/captcha/verify", json={"token": response.json()['solution']['innerText']}, headers={"Cookie": cookie})
if res.status_code == 200:
print(f"{Fore.GREEN}[Solver] HCaptcha Responsed Succuessfully{Fore.RESET}")
return "solved"
else:
print(f'{Fore.RED}[Solver] cannot submit response reason: {res.text}{Fore.RESET}')
return "cant"
else:
print(f"Hcaptcha Solve failed: {response.json()}")
return "cant"
def solve_owo_by_scrappey(cookie):
url = f'https://publisher.scrappey.com/api/v1?key={api_key}'
headers = {'Content-Type': 'application/json'}
data = {
'cmd': 'request.get',
'url': 'https://owobot.com/captcha',
'video': True,
"automaticallySolveCaptchas": True,
"alwaysLoad": [
""
],
"browserActions": [
{
"type": "discord_login",
"token": f"{token}",
"when": "beforeload"
},
{
"type": "click",
"cssSelector": "button[class='mb-3 v-btn v-btn--has-bg theme--dark v-size--default primary']",
},
{
"type": "click",
"cssSelector": "div.appMount_ea7e65:nth-child(1) div.appAsidePanelWrapper_bd26cc:nth-child(4) div.notAppAsidePanel_bd26cc div.app_bd26cc:nth-child(1) div.theme-dark.images-dark.wave_c2b22e.wrapper_bb3b80.scrollbarGhost_c858ce.scrollbar_c858ce div.leftSplit_bb3b80 div.oauth2Wrapper_c2b22e div.authorize_c5a065 div.fullWidth_c5a065 div.footer_c5a065 div.action_c5a065 button.button_dd4f85.lookFilled_dd4f85.colorBrand_dd4f85.sizeMedium_dd4f85.grow_dd4f85 > div.contents_dd4f85",
},
{
"type": "wait",
"wait": 18
},
]
}
response = requests.post(url, headers=headers, json=data)
try:
if response.json()["solution"]["innerText"]:
if "I have verified that you're a human!" in response.json()["solution"]["innerText"]:
print(f"{Fore.LIGHTBLUE_EX}[{hservice}] Solved Hcaptcha, results submitted to owobot...{Fore.RESET}")
return "solved"
else:
print(f'{Fore.RED}[Solver] cannot submit response reason: {response.text}{Fore.RESET}, Trying WIth Api Function')
time.sleep(3)
return solve_owo_by_scrappey_api_method(cookie)
except:
print(f'{Fore.RED}[Solver] cannot retrieve response reason: {response.text}{Fore.RESET}, Trying WIth Api Function')
return solve_owo_by_scrappey_api_method(cookie)
def solve_owo(cookie):
if hservice == "scrappey":
sol = solve_owo_by_scrappey_api_method(cookie)
return sol
else:
solution = Hcaptcha_Solver()
response = requests.post("https://owobot.com/api/captcha/verify", json={"token": solution}, headers={"Cookie": cookie})
if response.status_code == 200:
print(f"{Fore.GREEN}[Solver] HCaptcha Responsed Succuessfully{Fore.RESET}")
return "solved"
else:
print(f'{Fore.RED}[Solver] cannot submit response reason: {response.text}{Fore.RESET}')
return "cant"