• Join CraxPro and earn real money through our Credit Rewards System. Participate and redeem credits for Bitcoin/USDT. Start earning today!
    Read the detailed thread here

Currently reading:
 [Open Source] Discord Token Checker (Python)

karatrf

Member
LV
1
Joined
Nov 7, 2024
Threads
36
Likes
37
Awards
4
Credits
2,974©
Cash
0$
It checks the Discord tokens you added to the "tokens.txt" file, separates them according to their features and status, and saves them according to their creation year.

Python:
import threading
import requests
from colorama import Fore, Style
import os
import time
from datetime import datetime

os.system("cls")
lc = f"{Fore.RESET}{Fore.LIGHTBLACK_EX}{Style.BRIGHT}[{Fore.LIGHTMAGENTA_EX}+{Style.BRIGHT}{Fore.LIGHTBLACK_EX}]{Fore.RESET}"
tokens = []
valid_tokens_count = 0
invalid_tokens_count = 0
nitro_count = 0
unclaimed_count = 0
mail_verified_count = 0
phone_verified_count = 0
full_verified_count = 0
mfa_enabled_count = 0

def snowflake_to_date(snowflake):
    timestamp = ((int(snowflake) >> 22) + 1420070400000) / 1000
    return datetime.utcfromtimestamp(timestamp)

def check_token_verification(token):
    global mail_verified_count, phone_verified_count, full_verified_count, unclaimed_count
    headers = {
        'Authorization': token
    }

    response = requests.get('https://discord.com/api/v10/users/@me', headers=headers)

    if response.status_code == 200:
        data = response.json()
        email_verification = data.get('verified', False)
        phone_verification = bool(data.get('phone'))

        if email_verification and phone_verification:
            full_verified_count += 1
            return "Full Verified"
        elif email_verification:
            mail_verified_count += 1
            return "Mail Verified"
        elif phone_verification:
            phone_verified_count += 1
            return "Phone Verified"
        else:
            unclaimed_count += 1
            return "Unclaimed"
    elif response.status_code == 401:
        return "invalid"
    else:
        return "error"

def check_boosts(token):
    headers = {
        'Authorization': token
    }

    response = requests.get('https://discord.com/api/v9/users/@me/guilds/premium/subscription-slots', headers=headers)
    if response.status_code == 200:
        data = response.json()
        if data:  # Check if data is not empty
            cooldown_count = sum(1 for entry in data if entry.get('cooldown_ends_at') is not None)
            boosts = 2 - int(cooldown_count)
            return boosts
        else:
            return 0
    else:
        return 0

def save_token_to_file(token, folder, year):
    os.makedirs(folder, exist_ok=True)
    filename = os.path.join(folder, f"{year}.txt")
    with open(filename, "a", encoding="utf-8") as file:
        file.write(f"{token}\n")

def check_token(token):
    global valid_tokens_count, invalid_tokens_count, nitro_count, mfa_enabled_count

    headers = {
        'Authorization': token
    }

    response = requests.get('https://discord.com/api/v9/users/@me', headers=headers)
    if response.status_code == 200:
        valid_tokens_count += 1
        user_data = response.json()
        premium_type = user_data.get('premium_type', 0)
        mfa_enabled = user_data.get('mfa_enabled', False)
        creation_date = user_data['id']
        account_creation_date = snowflake_to_date(creation_date)
        year = account_creation_date.year
        verification = check_token_verification(token)
        boosts = check_boosts(token)
        nitro = f"{Style.BRIGHT}{Fore.RED}NO_NITRO" if premium_type == 0 else f"{Style.BRIGHT}{Fore.GREEN}NITRO"
        if premium_type != 0:
            nitro_count += 1

        print(f'{lc} {Fore.LIGHTBLUE_EX}token={Fore.WHITE}{token[:20]}...{Fore.RESET} Flags: {Fore.RESET}{Fore.LIGHTBLACK_EX}{Style.BRIGHT}[{Fore.GREEN}VALID{Style.BRIGHT}{Fore.LIGHTBLACK_EX}]{Fore.RESET} {Fore.RESET}{Fore.LIGHTBLACK_EX}{Style.BRIGHT}[{Fore.BLUE}{boosts}_BOOSTS{Style.BRIGHT}{Fore.LIGHTBLACK_EX}]{Fore.RESET}, {Fore.RESET}{Fore.LIGHTBLACK_EX}{Style.BRIGHT}[{Fore.BLUE}{nitro}{Style.BRIGHT}{Fore.LIGHTBLACK_EX}]{Fore.RESET}, {Fore.RESET}{Fore.LIGHTBLACK_EX}{Style.BRIGHT}[{Fore.BLUE}{verification}{Style.BRIGHT}{Fore.LIGHTBLACK_EX}]{Fore.RESET}, {Fore.RESET}{Fore.LIGHTBLACK_EX}{Style.BRIGHT}[{Fore.BLUE}MFA_ENABLED={mfa_enabled}{Style.BRIGHT}{Fore.LIGHTBLACK_EX}]{Fore.RESET} ')
        time.sleep(1)  # wait a sec

        # save separated
        save_token_to_file(token, "Valid Tokens", year)
        if mfa_enabled:
            mfa_enabled_count += 1
            save_token_to_file(token, "MFA_ENABLED", year)
        elif premium_type != 0:
            save_token_to_file(token, "Nitro Tokens", year)
        elif "Full Verified" in verification:
            save_token_to_file(token, "Full Verified Tokens", year)
        elif "Mail Verified" in verification:
            save_token_to_file(token, "Mail Verified Tokens", year)
        elif "Phone Verified" in verification:
            save_token_to_file(token, "Phone Verified Tokens", year)
        elif "Unclaimed" in verification:
            save_token_to_file(token, "Unclaimed", year)

        return token, verification, boosts, nitro
    elif response.status_code == 401:
        invalid_tokens_count += 1
        print(f'{lc} {Fore.LIGHTBLUE_EX}token={Fore.WHITE}{token[:20]}...{Fore.RESET} Flags: {Fore.RESET}{Fore.LIGHTBLACK_EX}{Style.BRIGHT}[{Fore.RED}INVALID{Style.BRIGHT}{Fore.LIGHTBLACK_EX}]{Fore.RESET}')
        time.sleep(1)
    elif response.status_code == 429:  # Rate limited
        try:
            retry_after = response.json().get("retry_after", 0)
            print(f'{lc} {Fore.LIGHTBLUE_EX}Token={Fore.WHITE}{token[:20]}...{Fore.RESET} is rate limited. Retrying after {retry_after} seconds...')
            time.sleep(retry_after)
            return check_token(token)
        except requests.exceptions.JSONDecodeError:
            print(f'{lc} {Fore.LIGHTBLUE_EX}token={Fore.WHITE}{token[:20]}...{Fore.RESET} Flags: {Fore.RESET}{Fore.LIGHTBLACK_EX}{Style.BRIGHT}[{Fore.RED}ERROR DECODING JSON{Style.BRIGHT}{Fore.LIGHTBLACK_EX}]{Fore.RESET}')
            time.sleep(1)
    else:
        print(f'{lc} {Fore.LIGHTBLUE_EX}token={Fore.WHITE}{token[:20]}...{Fore.RESET} Flags: {Fore.RESET}{Fore.LIGHTBLACK_EX}{Style.BRIGHT}[{Fore.RED}ERROR{Style.BRIGHT}{Fore.LIGHTBLACK_EX}]{Fore.RESET}')
        time.sleep(1)
    return None

def check_tokens_file():
    token_file = "tokens.txt"
    if os.path.exists(token_file):
        with open(token_file, "r") as file:
            tokens = file.readlines()
        if not tokens:
            print(f"{lc} {Fore.RED}tokens.txt file is empty. Please add your token information.{Fore.RESET}")
    else:
        print(f"{lc} {Fore.RED}tokens.txt file not found. Creating a new file...{Fore.RESET}")
        open(token_file, "w").close()
        print(f"{lc} {Fore.GREEN}tokens.txt file created successfully.{Fore.RESET}")

    return tokens

def main():
    print(Fore.LIGHTMAGENTA_EX + '''
    KARAiceislove
    ''')

    # Get user input for thread count and delay
    while True:
        try:
            num_threads = int(input(f"{lc} Enter the number of threads to use (default is 2): ") or "2")
            if num_threads < 1:
                raise ValueError
            break
        except ValueError:
            print(f"{lc} {Fore.RED}Invalid input. Please enter a positive integer.{Fore.RESET}")

    while True:
        try:
            delay = float(input(f"{lc} Enter the delay between checks (in seconds, default is 1): ") or "1")
            if delay < 0:
                raise ValueError
            break
        except ValueError:
            print(f"{lc} {Fore.RED}Invalid input. Please enter a non-negative number.{Fore.RESET}")

    tokens = check_tokens_file()

    with open("tokens.txt", "r") as file:
        tokens = file.readlines()

    tokens = [token.strip() for token in tokens]
    total_tokens = len(tokens)
    tokens_per_thread = total_tokens // num_threads

    def check_tokens_worker(start, end):
        for i in range(start, end):
            token = tokens[i]
            check_token(token)
            time.sleep(delay)  # add delay between checks

    threads = []
    for i in range(num_threads):
        start = i * tokens_per_thread
        end = (i + 1) * tokens_per_thread if i < num_threads - 1 else total_tokens
        thread = threading.Thread(target=check_tokens_worker, args=(start, end))
        thread.start()
        threads.append(thread)

    for thread in threads:
        thread.join()

    print(f"{lc}{Fore.GREEN} {'Valid Tokens: ' + str(valid_tokens_count) + f' {Fore.RESET}|{Fore.GREEN} ' if valid_tokens_count > 0 else ''}{f'{Fore.RED}Invalid Tokens: ' + str(invalid_tokens_count) + f' {Fore.RESET}|{Fore.GREEN} ' if invalid_tokens_count > 0 else ''}{'Nitro: ' + str(nitro_count) + f' {Fore.RESET}|{Fore.GREEN} ' if nitro_count > 0 else ''}{'Unclaimed: ' + str(unclaimed_count) + f' {Fore.RESET}|{Fore.GREEN} ' if unclaimed_count > 0 else ''}{'Mail Verified: ' + str(mail_verified_count) + f' {Fore.RESET}|{Fore.GREEN} ' if mail_verified_count > 0 else ''}{'Phone Verified: ' + str(phone_verified_count) + f' {Fore.RESET}|{Fore.GREEN} ' if phone_verified_count > 0 else ''}{'Full Verified: ' + str(full_verified_count) + f' {Fore.RESET}|{Fore.GREEN} ' if full_verified_count > 0 else ''}{'MFA Enabled: ' + str(mfa_enabled_count) if mfa_enabled_count > 0 else ''}")

main()
input("")

Requirements ;
colorama==0.4.6
Requests==2.32.3
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Tips

Similar threads

Top Bottom