1+ import os , requests , random , threading , json , time
2+ from colorama import Fore
3+
4+ # Credit to Pycenter by billythegoat356
5+ # Github: https://github.com/billythegoat356/pycenter/
6+ # License: https://github.com/billythegoat356/pycenter/blob/main/LICENSE
7+
8+ def center (var :str , space :int = None ): # From Pycenter
9+ if not space :
10+ space = (os .get_terminal_size ().columns - len (var .splitlines ()[int (len (var .splitlines ())/ 2 )])) / 2
11+
12+ return "\n " .join ((' ' * int (space )) + var for var in var .splitlines ())
13+
14+ class Console ():
15+ def ui (self ):
16+ os .system (f'cls && title [DNG] Discord Nitro Generator ^| For Help join discord.gg/kaneki' if os .name == "nt" else "clear" )
17+ print (center (f"""\n \n
18+ ██████╗ ███╗ ██╗ ██████╗
19+ ██╔══██╗████╗ ██║██╔════╝ ~ Discord Nitro Generator ~
20+ ██║ ██║██╔██╗ ██║██║ ███╗
21+ ██║ ██║██║╚██╗██║██║ ██║ github.com/kanekiWeb ~ discord.gg/kaneki
22+ ██████╔╝██║ ╚████║╚██████╔╝
23+ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ \n \n
24+ """ ).replace ('█' , Fore .CYAN + "█" + Fore .RESET ).replace ('~' , Fore .CYAN + "~" + Fore .RESET ).replace ('-' , Fore .CYAN + "-" + Fore .RESET ))
25+
26+ def printer (self , color , status , code ):
27+ threading .Lock ().acquire ()
28+ print (f"{ color } { status } > { Fore .RESET } discord.gift/{ code } " )
29+
30+ def proxies_count (self ):
31+ proxies_list = 0
32+ with open ('config/proxies.txt' , 'r' ) as file :
33+ proxies = [line .strip () for line in file ]
34+
35+ for _ in proxies :
36+ proxies_list += 1
37+
38+ return int (proxies_list )
39+
40+
41+ class Worker (threading .Thread ):
42+ def __init__ (self ):
43+ threading .Thread .__init__ (self )
44+
45+ def random_proxy (self ):
46+ with open ('config/proxies.txt' , 'r' ) as f :
47+ proxies = [line .strip () for line in f ]
48+
49+ return random .choice (proxies )
50+
51+ def config (self , args , args2 = False ):
52+ with open ('config/config.json' , 'r' ) as conf :
53+ data = json .load (conf )
54+
55+ if args2 :
56+ return data [args ][args2 ]
57+ else :
58+ return data [args ]
59+
60+ def run (self ):
61+ self .code = "" .join (random .choice ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" ) for _ in range (16 ))
62+ try :
63+ req = requests .get (f'https://discordapp.com/api/v6/entitlements/gift-codes/{ self .code } ?with_application=false&with_subscription_plan=true' , proxies = {'http' : self .config ("proxies" )+ '://' + self .random_proxy (),'https' : self .config ("proxies" )+ '://' + self .random_proxy ()}, timeout = 3 )
64+
65+ if req .status_code == 200 :
66+ Console ().printer (Fore .LIGHTGREEN_EX , " Valid " , self .code )
67+ open ('results/hit.txt' , 'a+' ).write (self .code + "\n " )
68+ try :
69+ requests .post (Worker ().config ("webhook" , "url" ), json = {"content" : f"||@here|| **__New Valid Nitro !!__**\n \n https://discord.gift/{ self .code } " , "username" : Worker ().config ("webhook" , "username" ), "avatar_url" : Worker ().config ("webhook" , "avatar" )})
70+ except :
71+ pass
72+ elif req .status_code == 404 :
73+ Console ().printer (Fore .LIGHTRED_EX , "Invalid" , self .code )
74+ elif req .status_code == 429 :
75+ # rate = (int(req.json()['retry_after']) / 1000) + 1
76+ Console ().printer (Fore .LIGHTBLUE_EX , "RTlimit" , self .code )
77+ # time.sleep(rate)
78+ else :
79+ Console ().printer (Fore .LIGHTYELLOW_EX , " Retry " , self .code )
80+
81+ except KeyboardInterrupt :
82+ Console ().ui ()
83+ threading .Lock ().acquire ()
84+ print (f"{ Fore .LIGHTRED_EX } Stopped > { Fore .RESET } Nitro Gen Stopped by Keyboard Interrupt." )
85+ os .system ('pause >nul' )
86+ exit ()
87+ except :
88+ Console ().printer (Fore .LIGHTYELLOW_EX , " Retry " , self .code )
89+
90+ if __name__ == "__main__" :
91+ Console ().ui ()
92+ print (" " + Fore .CYAN + str (Console ().proxies_count ()) + Fore .RESET + " Total proxies loaded...\n \n " )
93+
94+ while True :
95+ if threading .active_count () <= int (Worker ().config ("thread" )):
96+ DNG = Worker ()
97+ DNG .run ()
0 commit comments