-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
558 lines (424 loc) · 15 KB
/
main.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# .--.
# | :
# | | .-. .,-. .--. .-.
# | ;(.-' | )`--.( )
# '--' `--'|`-' `--' `-'
# |
# '
# Created by depso and by the help of the lord
from selenium import webdriver
from selenium.webdriver.edge.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException, WebDriverException
from selenium.webdriver.common.keys import Keys
from random import choice as randchoice, randint, randrange
from time import sleep
from colorama import Fore
from modules import Usernames
from modules import Webhooks
import requests
import os
import yaml
# Load configuation file
with open('config.yml', 'r') as f:
Config = yaml.safe_load(f)
# Unpack Config
Core = Config["Core"]
Browser = Config["Browser"]
Capture = Config["Capture"]
Accounts = Config["Accounts"]
Webhook = Config["Webhook"]
Webhooks.LoadConfig(Webhook)
# Website buttons
Accept_All = '//button[contains(@class, "btn-cta-lg") and contains(@class, "cookie-btn")]'
Cookie_Banner = '//*[@id="cookie-banner-wrapper"]'
Signup_Button = '//*[@id="signup-button"]'
General_Error = "//div[@id='GeneralErrorText']"
Username_Box = '//*[@id="signup-username"]'
Password_Box = '//*[@id="signup-password"]'
Details_Error = "//p[@id='signup-usernameInputValidation']"
Male_Gender = "//button[@id='MaleButton']"
Female_Gender = "//button[@id='FemaleButton']"
Month_Dropdown = '//*[@id="MonthDropdown"]'
Day_Dropdown = '//*[@id="DayDropdown"]'
Year_Dropdown = '//*[@id="YearDropdown"]'
Arkose_iFrame = "arkose-iframe"
Enforcement_Frame = '[data-e2e="enforcement-frame"]'
Game_Core_Frame = "game-core-frame"
Verify_Button = '//*[@data-theme="home.verifyButton"]'
Method_Title = '//*[contains(@class, "sc-1io4bok-0") and contains(@class, "text")]'
Profile_Options = "//button[@id='popover-link']"
Follow_User = "//a[contains(text(),'Follow') and @role='menuitem']"
BrowserClient = None
def MakePassword():
Random_Password = Accounts["Random_Password"]
Fixed_Password = Accounts["Fixed_Password"]
if Random_Password:
return Usernames.RandomString(10, 20)
else:
return Fixed_Password
def MakeUsername():
Use_Username_Base = Accounts["Use_Username_Base"]
Username_Base = Accounts["Username_Base"]
Username = None
while True:
# Generate username string
if Use_Username_Base:
Username = Usernames.MakeRandomUsername(Username_Base)
else:
Username = Usernames.MakeWordedUsername()
# Check if username is approved by Roblox
if Usernames.UsernameAllowed(Username):
break
return Username
def FlushConsole():
Is_Windows = os.name == 'nt'
os.system('cls' if Is_Windows else 'clear')
def ResetDriver(driver):
driver.delete_all_cookies()
#driver.quit()
def ClickButton(driver, Xpath, Move=False):
try:
Button = WebDriverWait(driver, 40).until(
EC.presence_of_element_located((By.XPATH, Xpath))
)
except:
Button = driver.find_element(By.XPATH, Xpath)
if Move:
Actions = ActionChains(driver)
Actions.move_to_element(Button)
Actions.click().perform()
Actions.reset_actions()
else:
Button.click()
return Button
def SelectDropdown(driver, Xpath, Min, Max):
Index = randint(Min, Max)
Ending = "/option[{0}]"
Option_Xpath = f"{Xpath}{Ending.format(Index)}"
ClickButton(driver, Xpath)
ClickButton(driver, Option_Xpath)
def SetBirthDay(driver):
SelectDropdown(driver, Month_Dropdown, 1, 12)
SelectDropdown(driver, Day_Dropdown, 1, 20)
SelectDropdown(driver, Year_Dropdown, 24, 37)
def CreateOptions():
Headless = Browser["Headless"]
Use_Proxy = Browser["Use_Proxy"]
Proxy_Address = Browser["Proxy"]
Language = Browser["Language"]
Use_Nopecha = Capture["Use_Nopecha"]
# Add browser options
options = Options()
if Headless:
options.add_argument("--headless")
if Use_Proxy:
options.add_argument(f"--proxy-server={Proxy_Address}")
# Install nopecha extention
Extention_Path = "extra/ext.crx"
if Use_Nopecha:
with open(Extention_Path, 'wb+') as f:
request = requests.get('https://nopecha.com/f/ext.crx')
f.write(request.content)
options.add_extension(Extention_Path)
# Addional options
options.add_experimental_option('excludeSwitches', ['enable-logging'])
options.add_argument(f"--lang={Language}")
options.add_argument("log-level=3")
options.add_argument('--incognito')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
return options
def CreateDriver():
Options = CreateOptions()
NOPECHA_KEY = Capture["NOPECHA_KEY"]
Use_Nopecha = Capture["Use_Nopecha"]
Parameters = {
"source": "Object.defineProperty(navigator, 'webdriver', { get: () => undefined })"
}
# Create driver instance
driver = webdriver.Edge(options = Options)
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", Parameters)
# Set Nopecha key
if Use_Nopecha:
SetNopechaKey(driver, NOPECHA_KEY)
return driver
def CheckDriver(driver):
if not driver:
driver = CreateDriver()
return driver
def SetNopechaKey(driver, Key):
driver.get(f"https://nopecha.com/setup#{Key}")
sleep(1)
driver.get(f"https://nopecha.com/setup#{Key}")
def ColoredPrint(Text="", Color=Fore.WHITE, End="\n"):
print(f"{Color}{Text}{Fore.RESET}", end=End)
def ColoredPrints(Seperator, Lines):
for Line in Lines:
ColoredPrint(*Line, End=Seperator)
print()
def Error(Text, End=None):
ColoredPrint(f"Error: {Fore.LIGHTCYAN_EX}{Text}", Fore.LIGHTRED_EX, End)
def Info(Text, End=None):
ColoredPrint(Text, Fore.LIGHTYELLOW_EX, End)
def Success(Text, End=None):
ColoredPrint(Text, Fore.GREEN, End)
def PrintUserAndPass(Username, Password, Gender):
ColoredPrints(" ", [
("Username:", Fore.WHITE),
(Username, Fore.GREEN),
("Password:", Fore.WHITE),
(Password, Fore.RED),
("Gender:", Fore.WHITE),
(Gender, Fore.MAGENTA)
])
def ConsoleExample():
for i in range(1, 50):
PrintUserAndPass(MakeUsername(), MakePassword(), "Male")
def Timeout(Seconds):
Remaining = Seconds
while Remaining > 0:
Mins, Secs = divmod(Remaining, 60)
Info(f"Time Remaining: {Mins:f}:{Secs:f}", end="\r")
Remaining -= 1
sleep(1)
def RequestLimitWait():
Wait_Minutes = Core["Request_Limit_Wait_Minutes"]
Seconds = Wait_Minutes / 60
Error("Rate Limit!")
Timeout(Seconds)
def LogDetails(Username, Password, Cookie):
Accounts_File = Accounts["Accounts_File"]
Cookies_File = Accounts["Cookies_File"]
Use_Webhooks = Webhooks["Use_Webhooks"]
# Send webhook request
if Use_Webhooks:
Webhooks.SendWebhook({
"Username": "Bozo",
"Password": "Bozo zozo"
})
# Write password and username for the generated account
with open(Accounts_File, "a+") as f:
f.write(f"{Username} : {Password}\n")
# Write cookie for the generated account
with open(Cookies_File, "a+") as f:
f.write(f"{Cookie}\n")
def SolveCapture(driver):
# Select correct iframe
Arkose = driver.find_element(By.ID, Arkose_iFrame)
driver.switch_to.frame(Arkose)
Enforcement = driver.find_element(By.CSS_SELECTOR, Enforcement_Frame)
driver.switch_to.frame(Enforcement)
Game_Core = driver.find_element(By.ID, Game_Core_Frame)
driver.switch_to.frame(Game_Core)
ClickButton(driver, Verify_Button)
sleep(1)
# Get capture method name
Method = driver.find_element(By.XPATH, Method_Title).text
Info(f"Capture method: {Method}")
# Solve methods
if "Pick any square" in Method:
#Square = driver.find_element(By.CSS_SELECTOR, f'[aria-label="Image {randint(1,6)} of 6."]')
#Square.click()
ClickButton(driver, f"//*[@aria-label='Image {randint(1,6)} of 6.']")
else:
Error("Unknown capture method!")
return True
#key-frame-image
driver.switch_to.default_content()
sleep(5)
#WebDriverWait(driver, 60).until_not(EC.presence_of_element_located((By.ID, Arkose_iFrame)))
return False
def CaptureCheck(driver):
Manual = Capture["Allow_Manual_Completion"]
Minutes = Capture["Capture_Timeout_Minutes"]
Seconds = 60 * Minutes
# Attempt automatic solve
try:
Failed = SolveCapture(driver)
if not Failed:
Info("Capture solved!")
return True
except Exception as e:
#Error(e)
pass
# Prompt user to solve capture if enabled
if Manual:
Info(f"Waiting for manual capture competion! ({Minutes}) minutes maxium!")
Completed = WaitForCreation(driver, Seconds)
if Completed:
return True
# Capture solve failed
Error("Program will now sleep")
Timeout(Seconds)
return False
def SelectGender(driver):
Gender = randint(1,3)
Gender_Name = "None"
if Gender == 1: # Male
ClickButton(driver, Male_Gender)
Gender_Name = "Male"
elif Gender == 2: # Female
ClickButton(driver, Female_Gender)
Gender_Name = "Female"
return Gender_Name
def EnterValue(driver, Xpath, Text, Clear=False):
TextBox = ClickButton(driver, Xpath)
if Clear:
ClearValue(TextBox)
TextBox.send_keys(Text)
def ClearValue(Element):
MacOS = Core["MacOS"]
Control = Keys.CONTROL
# COMMAND instead of CONTROL for Mac
if MacOS:
Control = Keys.COMMAND
Element.send_keys(Control + "a")
Element.send_keys(Keys.BACKSPACE)
def EnterUsername(driver):
Username = MakeUsername()
EnterValue(driver, Username_Box, Username, True)
return Username
def EnterPassword(driver):
Password = MakePassword()
EnterValue(driver, Password_Box, Password, True)
return Password
def Username_Birthday_Loop(driver):
while True:
Username = EnterUsername(driver)
sleep(2)
Error_Message = driver.find_element(By.XPATH, Details_Error).text
# Check birthday
if "birthday" in Error_Message.lower():
SetBirthDay(driver)
continue
# Error check
if len(Error_Message) < 3:
return Username
def WaitForUrl(driver, Timeout, Url):
try:
WebDriverWait(driver, Timeout).until(
EC.url_contains(Url)
)
return True
except TimeoutException:
return False
def CheckForError(driver):
try:
Message = driver.find_element(By.XPATH, General_Error)
if "An unknown error occurred" in Message.text:
return True
except:
pass
return False
def FollowUser(driver, UserId):
Profile_Url = f"https://www.roblox.com/users/{UserId}/profile"
driver.get(Profile_Url)
# Accept cookies prompt (Again??!)
if HasCookiePrompt(driver):
ClickButton(driver, Accept_All, True)
# Follow user
ClickButton(driver, Profile_Options)
sleep(1)
ClickButton(driver, Follow_User)
# Check for capture prompts
sleep(5)
CaptureCheck(driver)
def ProblemCheck(driver):
Use_Nopecha = Capture["Use_Nopecha"]
# Capture test
if not Use_Nopecha:
Capture_Success = CaptureCheck(driver)
if not Capture_Success:
return False
# Apon request limit
Has_Error = CheckForError(driver)
if Has_Error:
RequestLimitWait()
return False
return True
def WaitForCreation(driver, Timeout):
Success_Url = "www.roblox.com/home"
Created = WaitForUrl(driver, Timeout, Success_Url)
return Created
def HasCookiePrompt(driver):
Has_Cookies_Prompt = Core["Has_Cookies_Prompt"]
if Has_Cookies_Prompt:
return True
# Some people don't edit the configuation and complain it doesn't work
# This is needed to prevent my inbox spam of complaints sadly
try:
Banner = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, Cookie_Banner))
)
Child = Banner.find_element(By.XPATH, "./*")
if Child:
return True
except:
return False
def GenerateAccount():
# Initilase web driver
driver = BrowserClient
ResetDriver(driver)
# Goto signup page
driver.get("https://www.roblox.com")
# Accept all cookes (without your consent muhahaha... or not)
if HasCookiePrompt(driver):
ClickButton(driver, Accept_All, True)
# Set birthday
SetBirthDay(driver)
# Username and birthday entry
Username = Username_Birthday_Loop(driver)
# Password entry
Password = EnterPassword(driver)
# Select gender
Gender = SelectGender(driver)
# Request signup
ClickButton(driver, Signup_Button)
# Wait for successful creation
Created = WaitForCreation(driver, 5)
if not Created:
Info("Creation timeout.. Checking for problems")
Resolved = ProblemCheck(driver)
if not Resolved:
Error("Account creation failed! Capture/rate-limit error!")
ResetDriver(driver)
return
Created = WaitForCreation(driver, 60)
if not Created:
Error("Account creation failed! Exceeded timeout")
return
# Success!
PrintUserAndPass(Username, Password, Gender)
# Append account creation details to file
Cookie = driver.get_cookie(".ROBLOSECURITY")["value"]
LogDetails(Username, Password, Cookie)
#FollowUser(driver, 0)
return Username, Password, Cookie
def Banner():
FlushConsole()
Info("Depso's Roblox account generator")
def Generation():
global BrowserClient
Create_Count = Core["Accounts_To_Create"]
# Creation loop
for i in range(1, Create_Count):
try:
BrowserClient = CheckDriver(BrowserClient)
GenerateAccount()
except WebDriverException:
Info("Window closed! Now exiting...")
break
except Exception as e:
BrowserClient = None
Error(e)
Success("Job finished!")
if __name__ == "__main__":
Banner()
Generation()
print("Press enter to exit...")
input()
exit(1)