├── requirements.txt ├── .gitignore ├── dishook.png ├── tea.yaml ├── LICENSE ├── setup.py ├── README.md └── dishook.py /requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | colorama 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | invalid_codes.txt 2 | valid_codes.txt -------------------------------------------------------------------------------- /dishook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/im-hanzou/DisHook/HEAD/dishook.png -------------------------------------------------------------------------------- /tea.yaml: -------------------------------------------------------------------------------- 1 | # https://tea.xyz/what-is-this-file 2 | --- 3 | version: 1.0.0 4 | codeOwners: 5 | - '0xB2EA5821F4624E483E284dA680493291c3DE9EF8' 6 | - '0x271B39d1155E6FB9D6dbEf74CdBF99aa1c5f0B29' 7 | quorum: 1 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Hanzou Urushihara 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | setup( 4 | name='xDisHook', 5 | version='1.0.1', 6 | author='Hanzou', 7 | author_email='hanzou@hanzou.sh', 8 | description='A tool for generating and checking Discord Nitro codes', 9 | long_description=open('README.md').read(), 10 | long_description_content_type='text/markdown', 11 | url='https://github.com/im-hanzou/DisHook', 12 | packages=find_packages(), 13 | classifiers=[ 14 | 'Development Status :: 5 - Production/Stable', 15 | 'Intended Audience :: Developers', 16 | 'Topic :: Software Development :: Libraries :: Python Modules', 17 | 'License :: OSI Approved :: MIT License', 18 | 'Programming Language :: Python :: 3', 19 | 'Programming Language :: Python :: 3.7', 20 | 'Programming Language :: Python :: 3.8', 21 | 'Programming Language :: Python :: 3.9', 22 | ], 23 | python_requires='>=3.7', 24 | install_requires=[ 25 | 'requests', 26 | 'colorama' 27 | ], 28 | entry_points={ 29 | 'console_scripts': [ 30 | 'xdishook=xDisHook.main:main_function', 31 | ], 32 | }, 33 | ) 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DisHook 2 | Python x ChatGPT script. Generates random Discord Nitro codes and test their validity by sending requests to the Discord server. If the generated code is valid, the script will send the code to the specified Discord webhook. 3 |

4 | This code is inspired from YouTube/NoTextToSpeech and featuring ChatGPT ( im-lazy )
5 | Thanks to rikurunico for helping fix the code! 6 | # Usage 7 | ### Installation and Running: 8 | - Download or git clone https://github.com/im-hanzou/DisHook.git from this repository. 9 | - Install modules by running the following command: pip install -r requirements.txt 10 | - Run the script using the following command: python dishook.py 11 | ### Discord webhook URL retrieval 12 | Retreiving discord webhook URL: Discord Webhook 13 | ## Disclaimer 14 | This script was created for educational purposes only. Misuse or inappropriate use of this script is the user's responsibility. The author is not responsible for any negative consequences resulting from inappropriate use of this script. Use it wisely. 15 | # Note 16 | Update: add mode generator only and checker only!
17 | Proxied version will be updated soon! <3 18 | # THIS CODE IS FREE! DON'T SELL THIS CODE! 19 | -------------------------------------------------------------------------------- /dishook.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import random 3 | import re 4 | import time 5 | import string 6 | from colorama import init, Fore 7 | 8 | 9 | init() 10 | 11 | VALID_CODES_FILE = "valid_codes.txt" 12 | VALID_CODES_BUT_ALREADY_USED = "valid_used.txt" 13 | INVALID_CODES_FILE = "invalid_codes.txt" 14 | 15 | 16 | def extract_code(url): 17 | """Extract the 24-character random code from the URL.""" 18 | match = re.search(r"[a-zA-Z0-9]{24}", url) 19 | if match: 20 | return match.group(0) 21 | else: 22 | return None 23 | 24 | 25 | def send_request_and_process_code(code, webhook_url): 26 | """Send a GET request and process the response code.""" 27 | url = f"https://discordapp.com/api/v9/entitlements/gift-codes/{code}?with_application=false&with_subscription_plan=true" 28 | response = requests.get(url) 29 | if response.status_code == 200: 30 | data = response.json() 31 | save_to_file(code, VALID_CODES_FILE) 32 | if data["uses"] == 0: 33 | print( 34 | f"Code {Fore.CYAN}{code}{Fore.RESET} > Status: {Fore.GREEN}VALID{Fore.RESET}" 35 | ) 36 | send_to_discord_webhook(code, webhook_url) 37 | save_to_file(code, VALID_CODES_FILE) 38 | else: 39 | print( 40 | f"Code {Fore.CYAN}{code}{Fore.RESET} > Status: {Fore.RED}INVALID (Already Used){Fore.RESET}" 41 | ) 42 | save_to_file(code, VALID_CODES_BUT_ALREADY_USED) 43 | elif response.status_code == 429: # Rate limit exceeded 44 | retry_after = response.json().get("retry_after") / 1000 # Convert to seconds 45 | print( 46 | f"{Fore.RED}Rate limited. Waiting for {retry_after} seconds before retrying...{Fore.RESET}" 47 | ) 48 | time.sleep(retry_after) 49 | send_request_and_process_code(code, webhook_url) # Retry the request 50 | else: 51 | print( 52 | f"Code {Fore.CYAN}{code}{Fore.RESET} > Status: {Fore.RED}INVALID{Fore.RESET}" 53 | ) 54 | if mode == "generate": 55 | save_to_file(code, INVALID_CODES_FILE) 56 | 57 | 58 | def send_to_discord_webhook(code, webhook_url): 59 | """Send the code to Discord webhook.""" 60 | data = {"username": "NitroBotz", "content": f"https://discord.gift/{code}"} 61 | response = requests.post(webhook_url, json=data) 62 | if response.status_code != 204: 63 | print( 64 | f"{Fore.RED}Failed to send message to Discord webhook: {response.status_code}{Fore.RESET}" 65 | ) 66 | 67 | 68 | def save_to_file(code, filename): 69 | """Save the code to a text file.""" 70 | with open(filename, "a") as f: 71 | f.write(f"https://discord.gift/{code}\n") 72 | 73 | 74 | def print_banner(): 75 | """Print a fancy ASCII art banner.""" 76 | banner = """ 77 | ,-. . . , 78 | | \ o | | | 79 | | | . ,-. |--| ,-. ,-. | , 80 | | / | `-. | | | | | | |< 81 | `-' ' `-' ' ' `-' `-' ' ` 82 | """ 83 | print(f"{Fore.CYAN}{banner}{Fore.RESET}") 84 | 85 | 86 | if __name__ == "__main__": 87 | print_banner() 88 | print(f"{Fore.MAGENTA}ChatGPT's Discord Nitro Tools \n{Fore.RESET}") 89 | mode = input(f"{Fore.YELLOW}Choose mode (generate/checker): {Fore.RESET}").lower() 90 | if mode not in ["generate", "checker"]: 91 | print(f"{Fore.RED}Invalid mode selected.{Fore.RESET}") 92 | exit(1) 93 | 94 | webhook_url = input(f"{Fore.YELLOW}Enter Discord webhook URL: {Fore.RESET}") 95 | 96 | if mode == "generate": 97 | print( 98 | f"Generating and checking codes... | Result will be saved to {Fore.GREEN}valid_codes.txt{Fore.RESET}" 99 | ) 100 | while True: 101 | random_code = "".join( 102 | random.choices(string.ascii_letters + string.digits, k=24) 103 | ) 104 | send_request_and_process_code(random_code, webhook_url) 105 | delay = random.uniform(10, 20) 106 | print( 107 | f"{Fore.YELLOW}Delay {delay} seconds as needed to avoid rate limiting{Fore.RESET}" 108 | ) 109 | time.sleep(delay) 110 | else: 111 | codes_file = input(f"{Fore.YELLOW}Enter codes filelist: {Fore.RESET}") 112 | print( 113 | f"Checking codes from {Fore.MAGENTA}{codes_file}{Fore.RESET}... | Result will be saved to {Fore.GREEN}valid_codes.txt{Fore.RESET}" 114 | ) 115 | with open(codes_file, "r") as f: 116 | urls = f.read().splitlines() 117 | for url in urls: 118 | code = extract_code(url) 119 | if code: 120 | send_request_and_process_code(code, webhook_url) 121 | delay = random.uniform(10, 20) 122 | print( 123 | f"{Fore.YELLOW}Delay {delay} seconds as needed to avoid rate limiting{Fore.RESET}" 124 | ) 125 | time.sleep(delay) 126 | else: 127 | print(f"{Fore.RED}No code found in URL: {url}{Fore.RESET}") 128 | 129 | # recoded by im-hanzou | rikurunico ( https://github.com/rikurunico ) 130 | --------------------------------------------------------------------------------