-
Notifications
You must be signed in to change notification settings - Fork 15
/
main.py
179 lines (157 loc) · 5.9 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
import os
libraries_to_import = [
"colorama",
"requests",
"tls_client",
"pystyle",
"datetime",
"httpx"
]
for lib in libraries_to_import:
try:
exec(f"import {lib}")
except ModuleNotFoundError:
os.system(f"pip install {lib}")
import json, time, httpx, sys, threading, ctypes, random, string, concurrent.futures, requests
from colorama import Fore, init, Style
from pystyle import Write, System, Colors, Colorate
from threading import Lock , Thread , Timer
from datetime import datetime
from os.path import isfile, join
from tls_client import Session
output_lock = threading.Lock()
red = Fore.RED
yellow = Fore.YELLOW
green = Fore.GREEN
blue = Fore.BLUE
orange = Fore.RED + Fore.YELLOW
pretty = Fore.LIGHTMAGENTA_EX + Fore.LIGHTCYAN_EX
magenta = Fore.MAGENTA
lightblue = Fore.LIGHTBLUE_EX
cyan = Fore.CYAN
gray = Fore.LIGHTBLACK_EX + Fore.WHITE
reset = Fore.RESET
pink = Fore.LIGHTGREEN_EX + Fore.LIGHTMAGENTA_EX
dark_green = Fore.GREEN + Style.BRIGHT
def get_time_rn():
date = datetime.now()
hour = date.hour
minute = date.minute
second = date.second
timee = "{:02d}:{:02d}:{:02d}".format(hour, minute, second)
return timee
total = 0
valid = 0
invalid = 0
redeemed = 0
ctypes.windll.kernel32.SetConsoleTitleW(f'[ Discord Promo Checker ] By H4cK3dR4Du#1337 ~ discord.gg/radutool')
def update_title():
global total, valid, invalid, redeemed
ctypes.windll.kernel32.SetConsoleTitleW(f'[ Discord Promo Checker ] | Valid : {valid} | Invalid : {invalid} | Redeemed : {redeemed} | Working Rate : {round(valid/total*100,2)}% | github.com/H4cK3dR4Du')
with open("proxies.txt", "a") as f:
f.write("")
def save_proxies(proxies):
with open("proxies.txt", "w") as file:
file.write("\n".join(proxies))
def get_proxies():
with open('proxies.txt', 'r', encoding='utf-8') as f:
proxies = f.read().splitlines()
if not proxies:
proxy_log = {}
else:
proxy = random.choice(proxies)
proxy_log = {
"http://": f"http://{proxy}", "https://": f"http://{proxy}"
}
try:
url = "https://api.proxyscrape.com/v2/?request=getproxies&protocol=http&timeout=10000&country=all"
response = httpx.get(url, proxies=proxy_log, timeout=60)
if response.status_code == 200:
proxies = response.text.splitlines()
save_proxies(proxies)
else:
time.sleep(1)
get_proxies()
except httpx.ProxyError:
get_proxies()
except httpx.ReadError:
get_proxies()
except httpx.ConnectTimeout:
get_proxies()
except httpx.ReadTimeout:
get_proxies()
except httpx.ConnectError:
get_proxies()
except httpx.ProtocolError:
get_proxies()
def check_proxies_file():
file_path = "proxies.txt"
if os.path.exists(file_path) and os.path.getsize(file_path) == 0:
get_proxies()
check_proxies_file()
def check_promo(promo):
global valid, invalid, total, redeemed
session = Session(
client_identifier="chrome_112",
random_tls_extension_order=True
)
proxy = random.choice(open("proxies.txt", "r").readlines()).strip() if len(open("proxies.txt", "r").readlines()) != 0 else None
if ":" in proxy and len(proxy.split(":")) == 4:
ip, port, user, pw = proxy.split(":")
proxy_string = f"http://{user}:{pw}@{ip}:{port}"
else:
ip, port = proxy.split(":")
proxy_string = f"http://{ip}:{port}"
session.proxies = {
"http": proxy_string,
"https": proxy_string
}
try:
r = session.get(f"https://discord.com/api/v9/entitlements/gift-codes/{promo}?country_code=ES&with_application=false&with_subscription_plan=true")
if "You are being rate limited." in r.text:
check_promo(promo)
elif r.status_code != 200 or "Unknown Gift Code" in r.text:
time_rn = get_time_rn()
print(f"{reset}[ {cyan}{time_rn}{reset} ] {gray}({red}-{gray}) {pretty}Invalid {gray}|{pink} https://promos.discord.gg/{reset}{promo}")
invalid += 1
total += 1
update_title()
else:
r_json = r.json()
check_redeemed = r_json['redeemed']
if check_redeemed == False:
max_uses, uses = r_json['max_uses'], r_json['uses']
if max_uses != uses:
promotion = r_json['promotion']['inbound_header_text'].split('T')[0]
expiry = str(promotion)
time_rn = get_time_rn()
print(f"{reset}[ {cyan}{time_rn}{reset} ] {gray}({green}+{gray}) {pretty}Valid {gray}|{pink} https://promos.discord.gg/{reset}{promo}")
valid += 1
total += 1
update_title()
with open("Results/valid_promo.txt", "a+", encoding='utf-8') as f:
f.write(f"Valid Promo ---> https://promos.discord.gg/{promo}")
else:
time_rn = get_time_rn()
print(f"{reset}[ {cyan}{time_rn}{reset} ] {gray}({yellow}/{gray}) {pretty}Redeemed {gray}|{pink} https://promos.discord.gg/{reset}{promo}")
redeemed += 1
total += 1
update_title()
except:
check_promo(promo)
try:
with open("promos.txt", "r") as f:
lines = f.readlines()
promos = []
for line in lines:
index = line.find(".gg/")
if index != -1:
promo = line[index + 4:].strip()
promos.append(promo)
with concurrent.futures.ThreadPoolExecutor() as executor:
executor.map(check_promo, promos)
except FileNotFoundError:
pass
except Exception as e:
raise
input()