-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
176 lines (142 loc) · 5.44 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
import os
import time
import random
import sys
import string
import requests
import datetime
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def banner(colors) :
os.system("cls")
if colors == True :
print(bcolors.HEADER + "###################################" + bcolors.ENDC)
print(bcolors.HEADER + "# Random Discord Invite Generator #" + bcolors.ENDC)
print(bcolors.HEADER + "###################################" + bcolors.ENDC)
else :
print("###################################")
print("# Random Discord Invite Generator #")
print("###################################")
print(" ")
print(" ")
print(" ")
def write_good_file(dc_invite, today) :
with open(today+"/good.txt", "a") as c :
c.write(dc_invite)
c.write("\n")
c.close()
def write_bad_file(dc_invite, today) :
with open(today+"/bad.txt", "a") as c :
c.write(dc_invite)
c.write("\n")
c.close()
def check(invite_str, today, show_bad, write_bad, show_timeout, colors) :
apilink = "https://discordapp.com/api/v6/invite/" + invite_str
USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0"
headers = {"user-agent": USER_AGENT}
resp = requests.get(apilink, headers=headers)
resp = str(resp)
if "404" in resp :
dc_invite = "https://discord.gg/" + invite_str
if show_bad == True :
if colors == True :
print(bcolors.FAIL + "[-] Found an invalid invite..." + bcolors.ENDC)
else :
print("[-] Found an invalid invite...")
if write_bad == True :
write_bad_file(dc_invite, today)
generation(today, show_bad, write_bad, show_timeout, colors)
elif "200" in resp :
dc_invite = "https://discord.gg/" + invite_str
if colors == True :
print(bcolors.OKGREEN + "[+] Found a valid discord invite ! : " + dc_invite + bcolors.ENDC)
else :
print("[+] Found a valid discord invite ! : ")
write_good_file(dc_invite, today)
generation(today, show_bad, write_bad, show_timeout, colors)
elif "429" in resp :
if show_timeout == True :
if colors == True :
print(bcolors.WARNING + "[-] Requests limit reached, sleeping for 22.668 secondes..." + bcolors.ENDC)
else :
print("[-] Requests limit reached, sleeping for 22.668 secondes...")
time.sleep(22.668)
generation(today, show_bad, write_bad, show_timeout, colors)
else :
print(resp)
print(invite_str)
sys.exit()
def generation(today, show_bad, write_bad, show_timeout, colors) :
a = 0
invite = [" "," "," "," "," "," "," "]
while a != 7 :
choice = random.randint(0,1)
if choice == 0 :
invite[a] = random.randint(0,9)
elif choice == 1 :
invite[a] = random.choice(string.ascii_letters)
a = a + 1
invite_str = ''.join(str(e) for e in invite)
check(invite_str, today, show_bad, write_bad, show_timeout, colors)
def main() :
try :
os.system("cls")
os.system("title Random Discord Invite Generator")
colors = input("Do you want to have colored lines ? y/n ")
if colors == "y" :
colors = True
else :
colors = False
banner(colors)
if colors == True :
show_timeout = input(bcolors.WARNING + "Show a message when sleeping after the requests limit ? y/n ")
else :
show_timeout = input("Show a message when sleeping after the requests limit ? y/n ")
if show_timeout == "y" :
show_timeout = True
else :
show_timeout = False
show_bad = input("Show a message when an invalid discord invite is found ? y/n ")
if show_bad == "y" :
show_bad = True
else :
show_bad = False
write_bad = input("Write the bad invites into bad.txt ? y/n ")
if write_bad == "y" :
write_bad = True
else :
write_bad = False
if colors == True :
enter = input(bcolors.OKGREEN + "Press [ENTER] to start the generation...")
else :
enter = input("Press [ENTER] to start the generation...")
print("Starting in 5 sec...")
if colors == True :
print("Press CTRL+C to stop" + bcolors.ENDC)
else :
print("Press CTRL+C to stop")
time.sleep(5)
banner(colors)
today = datetime.datetime.now()
today = str(today)
today = today.replace(":", "-")
today = today.replace(" ", "_")
os.system("mkdir "+today)
generation(today, show_bad, write_bad, show_timeout, colors)
except KeyboardInterrupt :
print(" ")
if colors == True :
print(bcolors.WARNING + "Keyboard Interrupt detected !")
print("See you next time !" + bcolors.ENDC)
else :
print("Keyboard Interrupt detected !")
print("See you next time !")
os.system("pause")
main()