Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit c1bf386

Browse files
committed
Add UPX logic and pyinstaller checking
1 parent 98c0f4e commit c1bf386

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

compiler.nim

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,18 @@ proc compiler(): int =
9797
else: icon = false
9898

9999
printName()
100-
echo ""
101100
echo "All options selected: "
102101
echo "---------------------"
103102
if obfuscate: echo "Executable will be obfuscated (w/ pyarmor)"
104-
if compress: echo "Executable will be compressed (w/ upx)"
103+
if compress:
104+
var path = getEnv("path")
105+
if path[^1] == ';':
106+
putEnv("path", fmt"{path}{dirr}\NullRAT\upx;")
107+
else:
108+
putEnv("path", fmt"{path};{dirr}\NullRAT\upx;")
109+
echo "Executable will be compressed (w/ upx)"
105110
if icon:
106-
echo "Executable will have custom icon (",iconPath,")"
111+
echo "Executable will have custom icon"
107112
echo "Path: ", iconPath
108113
echo ""
109114
stdout.styledWriteLine({styleBright}, "Would you like to compile now? (Y/n)")
@@ -116,8 +121,19 @@ proc compiler(): int =
116121
else:
117122
stdout.styledWriteLine(fgCyan, "- Compiling using selected settings...")
118123
stdout.styledWriteLine(fgCyan, "- Checking pyinstaller")
119-
var wherePy = execCmdEx("where pyinstaller").output
120-
echo wherePy
124+
# Find working pyinstaller executable
125+
var wherePy = splitLines(execCmdEx("where pyinstaller").output)
126+
var pyinstWorking: string;
127+
for pyinstaller in wherePy:
128+
if pyinstaller == "": continue
129+
var code = $execCmdEx(pyinstaller).exitCode
130+
if code == 2:
131+
pyinstWorking = pyinstaller
132+
break
133+
echo "Found! ", pyinstWorking
134+
stdout.styledWriteLine(fgCyan, "- Checking pyarmor")
135+
# Find working pyarmor executable
136+
121137
discard getch()
122138

123139
proc variablesCreator(x: int) =

0 commit comments

Comments
 (0)