コード例 #1
0
ファイル: cho.py プロジェクト: Mxnuuel/gulag
        [user_info['id'], client_hashes[3]])
    # no uninstallid check as these are often false, may just make it a flag later on in iteki's life
    imatch = await glob.db.fetchall(
        'SELECT u.name, h.ip FROM client_hashes h INNER JOIN users u ON h.userid = u.id WHERE h.userid != %s AND h.ip = %s',
        [user_info['id'], ip])

    if mmatch:
        webhook_url = glob.config.webhooks['audit-log']
        webhook = Webhook(url=webhook_url)
        embed = Embed(title=f'')
        embed.set_author(
            url=f"https://{glob.config.domain}/u/{user_info['id']}",
            name=username,
            icon_url=f"https://a.{glob.config.domain}/{user_info['id']}")
        thumb_url = f'https://a.{glob.config.domain}/1'
        embed.set_thumbnail(url=thumb_url)
        for a in mmatch:
            unames = []
            unames.append(a['name'])
        embed.add_field(
            name='New banned user',
            value=
            f"{user_info['name']} has been banned for a MAC match ({mmatch['adapters']}) with user(s) {unames}",
            inline=True)
        webhook.add_embed(embed)
        await webhook.post()
        if not (t := await glob.players.get(name=username, sql=True)):
            return f'"{username}" not found.'
        reason = f'Matching MAC hash with user(s) {unames}'
        await t.ban(p, reason)
コード例 #2
0
            # at least one of the keys is under the
            # minimum, log this occurence to Discord.
            webhook_url = glob.config.webhooks['surveillance']
            webhook = Webhook(url=webhook_url)

            embed = Embed(
                title = f'[{score.mode!r}] Abnormally low presstimes detected'
            )

            embed.set_author(
                url = player.url,
                name = player.name,
                icon_url = player.avatar_url
            )

            embed.set_thumbnail(url=glob.config.webhooks['thumbnail'])

            for key, pt in press_times.items():
                embed.add_field(
                    name = f'Key: {key.name}',
                    value = f'{sum(pt) / len(pt):.2f}ms' if pt else 'N/A',
                    inline = True
                )

            webhook.add_embed(embed)
            await webhook.post(glob.http)

REPLAYS_PATH = Path.cwd() / '.data/osr'
async def replay_detections() -> None:
    """Actively run a background thread throughout gulag's
       lifespan; it will pull replays determined as sketch