@@ -6,97 +6,24 @@ import std/envvars
66import std/ streams
77import puppy
88
9- from utils import cleanWorkingDir, printName
10-
9+ from utils import cleanWorkingDir, printName, runInVenv
1110from variables import variablesCreator
1211
1312const pipModules = [" pyinstaller" , " virtualenv" , " disnake" , " requests" , " pyarmor" , " mss" , " psutil" ]
1413
1514proc packageInstaller * () =
1615 printName ()
1716 var appDirectory = getAppDir ()
18- setCurrentDir (appDirectory)
17+ setCurrentDir (appDirectory / " NullRAT " )
1918
2019 stdout.styledWriteLine ({styleBright}, " >> Dependencies Installer <<" )
2120 echo " "
2221
23- # Check Python version, pyarmor no longer supports 3.11+
24- stdout.styledWriteLine ({styleBright}, " [1] Checking for Python..." )
25- var status = execProcess (" python --version" )
26- for i in [" 3.11" , " 3.12" , " 3.13" , " 3.14" ]:
27- if i in status:
28- echo " [INFO] Python " , i, " is not supported!\n - Pyarmor only supports max python version of 3.10\n - Uninstall Python and run this program again to auto-download the correct version!"
29- sleep (5000 )
30- quit (0 )
31-
32- const modules: string = pipModules.join (" " )
33-
34- var status2: int = execShellCmd (" python --version" )
35- var status3: int = execShellCmd (" py --version" )
36-
37- if status2 == 0 or status3 == 0 :
38- stdout.styledWriteLine (fgGreen, {styleBright}, " - Python installed!" )
39- echo " "
40-
41- # Otherwise, create a virtual env (and check if it exists)
42- if not dirExists (" NR_VENV" ):
43- discard execShellCmd (" python -m venv NR_VENV" )
44-
45- let
46- oldPath = getEnv (" PATH" )
47- envPath = absolutePath (" NR_VENV" )
48- scriptsPath = envPath / " Scripts"
49-
50- if oldPath != " " :
51- putEnv (" PATH" , scriptsPath / oldPath)
52- else :
53- putEnv (" PATH" , scriptsPath)
54- putEnv (" VIRTUAL_ENV" , envPath)
55-
56- discard execShellCmd (" pip freeze" ) # DEBUG
57-
58- stdout.styledWriteLine ({styleBright}, " [2] Checking if packages already installed..." )
59- var result = execCmdEx (" dism" )
60-
61- try :
62- result = execCmdEx (" pip freeze" )
63- except OSError :
64- result = execCmdEx (" py -m pip freeze" )
65-
66- var allInstalled: bool = true
67-
68- if result .exitCode != 0 :
69- echo " [FATAL] pip command failed to execute!!"
70- sleep (2000 )
71- else :
72- for module in pipModules:
73- if module notin result .output:
74- allInstalled = false
75-
76- if allInstalled:
77- stdout.styledWriteLine (fgGreen, {styleBright}, " [INFO] All packages installed and detected!\n\n Proceeding on with variables creation..." )
78- sleep (1000 )
79- variablesCreator (0 )
80- else :
81- echo " [INFO] Dependencies are not installed!\n "
82- stdout.styledWriteLine ({styleBright}, " [3] Installing/Updating dependencies..." )
83-
84- var result : int = 0
85-
86- result = execShellCmd (" pip install " & modules)
87- if result != 0 :
88- result = execShellCmd (" python -m pip install " & modules)
89- if result != 0 :
90- result = execShellCmd (" py -m pip install " & modules)
91-
92- if result == 0 :
93- echo " ========================"
94- stdout.styledWriteLine (fgGreen, {styleBright}, " All Installed!\n Moving to variables creation..." )
95- sleep (2000 )
96- variablesCreator (0 )
97- else :
98- echo " [FATAL] Unknown pip error, returning to main menu..."
99- sleep (3000 )
22+ # Check if Python even exists
23+ if execShellCmd (" python --version" ) == 0 :
24+ let python = " python"
25+ elif execShellCmd (" py --version" ) == 0 :
26+ let python = " py"
10027 else :
10128 stdout.styledWriteLine ({styleBright}, " - [FATAL] Python not installed!\n\n Would you like to download the recommended python installer? (Y/n): " )
10229 var input: char = getch ()
@@ -121,4 +48,55 @@ proc packageInstaller*() =
12148 echo " "
12249 stdout.styledWriteLine ({styleBright}, " Returning to menu after installer is closed..." )
12350 discard execCmdEx (" python-setup.exe" )
124- return
51+ return
52+
53+ stdout.styledWriteLine (fgGreen, {styleBright}, " - Python installed!" )
54+ echo " "
55+
56+ # Check Python version, pyarmor no longer supports 3.11+
57+ stdout.styledWriteLine ({styleBright}, " [1] Checking for Python..." )
58+ var status = execProcess (python & " --version" )
59+ for i in [" 3.11" , " 3.12" , " 3.13" , " 3.14" ]:
60+ if i in status:
61+ echo " [INFO] Python " , i, " is not supported!\n - Pyarmor only supports max python version of 3.10\n - Uninstall Python and run this program again to auto-download the correct version!"
62+ sleep (5000 )
63+ quit (0 )
64+
65+ const modules: string = pipModules.join (" " )
66+
67+ # Create a virtual env (and check if it exists)
68+ if not dirExists (" NR_VENV" ):
69+ discard execShellCmd (python & " -m pip install virtualenv" )
70+ discard execShellCmd (python & " -m venv NR_VENV" )
71+
72+ let venvPath: string = appDirectory / " NullRAT" / " NR_VENV"
73+ var allInstalled: bool = true
74+
75+ stdout.styledWriteLine ({styleBright}, " [2] Checking if packages already installed..." )
76+
77+ if runInVenv (venvPath, " pip freeze" ) != 0 :
78+ echo " [FATAL] pip command failed to execute!!"
79+ sleep (2000 )
80+ else :
81+ for module in pipModules:
82+ if module notin result .output:
83+ allInstalled = false
84+
85+ if allInstalled:
86+ stdout.styledWriteLine (fgGreen, {styleBright}, " [INFO] All packages installed and detected!\n\n Proceeding on with variables creation..." )
87+ sleep (1000 )
88+ variablesCreator (0 )
89+ else :
90+ echo " [INFO] Dependencies are not installed!\n "
91+ stdout.styledWriteLine ({styleBright}, " [3] Installing/Updating dependencies..." )
92+
93+ var result : int = runInVenv (venvPath, " pip install " & modules)
94+
95+ if result == 0 :
96+ echo " ========================"
97+ stdout.styledWriteLine (fgGreen, {styleBright}, " All Installed!\n Moving to variables creation..." )
98+ sleep (2000 )
99+ variablesCreator (0 )
100+ else :
101+ echo " [FATAL] Unknown pip error, returning to main menu..."
102+ sleep (3000 )
0 commit comments