/
discordgenerator.py
361 lines (270 loc) · 12 KB
/
discordgenerator.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
import undetected_chromedriver as uc
uc.install()
import os
import time
import requests
import random
import string
import sys
import threading
import datetime
import re
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from colorama import Fore, Style, init
from bs4 import BeautifulSoup as soup
from sys import stdout
from src import UI
from src import GmailnatorRead, GmailnatorGet, dfilter_email, pfilter_email, find_email_type
init(convert=True)
lock = threading.Lock()
def password_gen(length=8, chars= string.ascii_letters + string.digits + string.punctuation):
return ''.join(random.choice(chars) for _ in range(length))
# def minute_timer():
# while True:
# elapsed = time.strftime('%H:%M:%S', time.gmtime(time.time() - start))
# os.system(f'title Discord Generator ^| Rate Limit Timer ^| Time Elapsed {elapsed}')
# time.sleep(0.05)
# if elapsed == '00:01:00':
# print(f"{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} Timer finished.")
# break
def gather_proxy():
proxies = []
with open('proxies.txt', 'r', encoding='UTF-8') as file:
lines = file.readlines()
for line in lines:
proxies.append(line.replace('\n', ''))
return proxies
def free_print(arg):
lock.acquire()
stdout.flush()
print(arg)
lock.release()
class DiscordGen:
def __init__(self, email, username, password, proxy=None):
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-logging"])
if proxy:
options.add_argument('--proxy-server=%s' % proxy)
self.driver = webdriver.Chrome(options=options, executable_path=r"chromedriver.exe")
self.email= email
self.username = username
self.password = password
def register(self):
self.driver.get('https://discord.com/register')
free_print(f"{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} Webdriver wait")
WebDriverWait(self.driver, 1).until(EC.presence_of_element_located((By.XPATH, "//input[@type='email']")))
free_print(f"{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} " +self.email)
self.driver.find_element_by_xpath("//input[@type='email']").send_keys(self.email)
free_print(f"{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} " +self.username)
self.driver.find_element_by_xpath("//input[@type='text']").send_keys(self.username)
free_print(f"{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} " +self.password)
self.driver.find_element_by_xpath("//input[@type='password']").send_keys(self.password)
free_print(f"{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL}" +' Random Date')
dateWorking = False
#sometimes different discord languages have different xpath locations
try: #if date could not be found via divs
self.driver.find_element_by_xpath('//*[@id="app-mount"]/div[2]/div/div[2]/div/form/div/div[2]/div[4]/div[1]/div[1]/div/div/div/div/div[2]/div').click()
dateWorking = True
except:
free_print(f"{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} " + 'Error in typing date. Please type the date manually.')
input(f"{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} Submit your form manually. Have you solved captcha? [y/n] > ")
dateWorking = False
if dateWorking:
actions = ActionChains(self.driver)
actions.send_keys(str(random.randint(1,12)))# Month
actions.send_keys(Keys.ENTER)
actions.send_keys(str(random.randint(1,28))) #Day
actions.send_keys(Keys.ENTER)
random_year = [1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000]
actions.send_keys(str(random.choice(random_year))) #Year
actions.perform()
#Submit form
try:
self.driver.find_element_by_class_name('inputDefault-3JxKJ2').click() # Agree to terms and conditions
except:
free_print(f"{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} Could not find button. Ignoring..")
pass
#input(f'{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} Press ENTER to create account.')
self.driver.find_element_by_class_name('button-3k0cO7').click() # Submit button
free_print(f'{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} Submit form')
while True:
lock.acquire()
checker = input(f"{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} Have you solved the captcha and submit? [y/n] > ")
lock.release()
if checker == "y":
break
return True
elif checker =="n":
sys.exit()
return False
def verify_account(self,link):
self.driver.get(link)
free_print(f"{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} Task complete")
def close_driver(self):
self.driver.close()
def start_verify(email, email_type): #email, 'dot'/'plus'
free_print(f'{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} Checking email inbox.')
raw_email = email
if email_type == 'dot':
email = dfilter_email(raw_email)
if email_type == 'plus':
email = pfilter_email(raw_email)
g = GmailnatorRead(email, raw_email, email_type)
retry_count = 1
while retry_count <= 6:
gmailnator_inbox = g.get_inbox()
if gmailnator_inbox != '':
break
free_print(f'{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} Inbox empty. Retry count: {retry_count}')
free_print(f'{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} Sleeping for 15 seconds. Waiting for Discord email.')
time.sleep(15)
retry_count += 1
discord_keywords = re.findall('Discord', gmailnator_inbox)
if 'Discord' in discord_keywords:
#retrive messages from inbox
bs = soup(gmailnator_inbox, 'html.parser')
href_links = [a['href'] for a in bs.find_all('a')]
first_message = href_links[0] #get first message which is most likely from Discord verify.
remove = re.compile('(^.*?(?=[#])[#])') #only get id; remove unnecessary stuff
first_id = remove.sub('', first_message)
message_html = g.get_single_message(first_id)
content_html = soup(message_html, 'html.parser')
message_links = [a['href'] for a in content_html.find_all('a')]
try:
discord_verify = message_links[1]
free_print(f'{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} Extracted discord link.')
except IndexError:
free_print(f'{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} List index out of range.')
discord_verify = None
return discord_verify
else:
free_print(f'{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} Discord keyword not found. Unable to verify account via email.')
return False
def worker(proxy=None):
if proxy:
free_print(f"{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} Proxy used {proxy} ")
free_print(f"{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} Scraping email. ")
g = GmailnatorGet()
new_email = g.get_email()
free_print(f"{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} Scraped {new_email}")
email_type = find_email_type(new_email)
if email_type =='dot':
filtered_email = dfilter_email(new_email)
if email_type == 'plus':
filtered_email = pfilter_email(new_email)
discord_usernames = []
with open('config/discord_usernames.txt', 'r', encoding='UTF-8') as username_txt:
lines = username_txt.readlines()
for line in lines:
discord_usernames.append(line.replace('\n', ''))
username = random.choice(discord_usernames)
password = password_gen()
lock.acquire()
with open('output/login.txt', 'a', encoding='UTF-8') as login_file:
login_file.write(new_email + ':' + password +'\n')
lock.release()
if not proxy:
d = DiscordGen(new_email, username, password)
if proxy:
d = DiscordGen(new_email, username, password, proxy = proxy)
try:
d.register()
lock.acquire()
input(f"{Fore.LIGHTMAGENTA_EX}[*]{Style.RESET_ALL} Hit enter once your done getting your token.")
lock.release()
try:
verify_link = start_verify(new_email, email_type)
if verify_link:
d.verify_account(verify_link)
os.system('pause>nul')
d.close_driver()
else:
d.verify_account('https://www.gmailnator.com/inbox/#' + new_email)
os.system('pause>nul')
except Exception as e:
print('some error occured')
print(e)
d.verify_account('https://www.gmailnator.com/inbox/#' + new_email)
os.system('pause>nul')
d.close_driver()
except WebDriverException:
free_print(f"{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} Webdriver Error. Unable to continue.")
free_print(f"{Fore.LIGHTMAGENTA_EX}[!]{Style.RESET_ALL} Worker task ended.")
def menu():
proxies = gather_proxy()
os.system('cls')
if len(proxies) != 0:
os.system('title Discord Generator ^| coded by NightfallGT ^| PROXY LIST DETECTED')
else:
os.system('title Discord Generator ^| coded by NightfallGT ')
UI.banner()
UI.start_menu()
try:
user_input = int(input(f"\t\t{Fore.LIGHTMAGENTA_EX}[?]{Style.RESET_ALL} > "))
print('\n\n')
except ValueError:
user_input = 0
if user_input == 1:
os.system('cls')
UI.banner()
UI.menu2()
try:
user_input = int(input(f"\t\t{Fore.LIGHTMAGENTA_EX}[?]{Style.RESET_ALL} > "))
print('\n\n')
except ValueError:
user_input = 0
if user_input == 1:
return 2
elif user_input == 2:
return 1
else:
return None
def main():
continue_program = True
m = menu()
if m == 1:
user_thread= True
elif m == 2:
user_thread = False
else:
continue_program = False
if continue_program:
if user_thread:
print(f"{Fore.LIGHTMAGENTA_EX}[WARNING]{Style.RESET_ALL} Do not put a lot of threads or you will crash. 2 threads is decent. (chrome windows)")
num_thread = int(input(f"{Fore.LIGHTMAGENTA_EX}[>]{Style.RESET_ALL} Enter number of threads [eg. 3] > "))
proxies = gather_proxy()
os.system('cls')
UI.banner()
print('\n\n')
if user_thread:
threads = []
if len(proxies) != 0:
os.system('title Discord Generator ^| Proxy: True ^| Threading: True')
for i in range(num_thread):
t = threading.Thread(target=worker, args= (random.choice(proxies), ))
threads.append(t)
t.start()
else:
os.system('title Discord Generator ^| Proxy: False ^| Threading: True')
for i in range(num_thread):
t = threading.Thread(target=worker)
threads.append(t)
t.start()
else:
if len(proxies) != 0:
os.system('title Discord Generator ^| Proxy: True ^| Threading: False')
worker(random.choice(proxies))
else:
os.system('title Discord Generator ^| Proxy: False ^| Threading: False')
worker()
if __name__ == '__main__':
main()