Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from time import localtime, strftime, sleep
- from colorama import Fore
- import requests
- import random
- import string
- import os
- from flask import Flask
- from threading import Thread
- app = Flask(__name__)
- @app.route('/')
- def index():
- return "Alive"
- def keep_alive():
- t = Thread(target=app.run, kwargs={'host': '0.0.0.0', 'port': 8080})
- t.start()
- class SapphireGen:
- def __init__(self, code_type: str, prox=None, codes=None):
- self.type = code_type
- self.codes = codes
- self.proxies = prox
- self.session = requests.Session()
- self.prox_api = "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt"
- def __proxies__(self):
- req = self.session.get(self.prox_api).text
- if req:
- with open("./data/proxies.txt", "w") as f:
- f.write(req)
- def webhook(self, message):
- url = "https://example.com/webhook" # Replace with your webhook URL
- data = {"content": message, "username": "N"}
- result = requests.post(url, json=data)
- try:
- result.raise_for_status()
- except requests.exceptions.HTTPError as err:
- print(err)
- else:
- print("Payload delivered successfully, code {}.".format(result.status_code))
- def generate(self, scrape=False):
- if scrape:
- self.__proxies__()
- else:
- pass
- os.system("clear")
- for _ in range(int(self.codes)):
- sleep(35)
- try:
- if self.proxies:
- with open("./data/proxies.txt", "r") as f:
- prox = {
- "http": random.choice(f.read().splitlines())
- }
- else:
- prox = None
- if self.type == "boost":
- code = "".join(
- random.choice(string.ascii_letters + string.digits)
- for i in range(24)
- )
- else:
- code = "".join(
- random.choice(string.ascii_letters + string.digits)
- for i in range(16)
- )
- req = self.session.get(
- f"https://discord.com/api/v9/entitlements/gift-codes/{code}",
- proxies=prox,
- timeout=10,
- ).status_code
- if req == 200:
- print(f"{Fore.GREEN}<{strftime('%H:%M', localtime())}> discord.gift/{code} | valid")
- self.webhook(code)
- if req == 404:
- print(f"{Fore.RED}<{strftime('%H:%M', localtime())}> discord.gift/{code} | invalid")
- if req == 429:
- print(f"{Fore.YELLOW}<{strftime('%H:%M', localtime())}> discord.gift/{code} | ratelimited")
- except Exception as e:
- print(f"{Fore.RED}<{strftime('%H:%M', localtime())}> {e}")
- print(f"{Fore.LIGHTMAGENTA_EX}<{strftime('%H:%M', localtime())}> Successfully checked {self.codes} codes.")
- sleep(10)
- os.system("clear")
- if __name__ == "__main__":
- code_type = 'classic'
- prox = False
- if prox:
- scrape_proxy = input(f"{Fore.LIGHTMAGENTA_EX}<{strftime('%H:%M', localtime())}> Scrape proxies (y/n): ").lower() == "y"
- else:
- scrape_proxy = False
- codes = 100000
- SapphireGen(code_type, prox, codes).generate(scrape=scrape_proxy)
- keep_alive()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement