JAR is a Python-based Remote Access Trojan (RAT) that uses Discord as its Command and Control (C2) intermediary. This allows for potentially stealthier communication as traffic is directed to Discord's legitimate domains. The client can execute commands, provide shell access, and attempts persistence on Windows. Communication between the server and client payloads is encrypted.
- Discord C2: Uses Discord messages for sending commands and receiving output.
- Command Execution: Execute arbitrary shell commands on the client.
- Interactive Shell: "Lock" onto a specific client for an interactive shell-like session.
- Client Builder:
build.shscript to configure, obfuscate (with PyArmor), and bundle the client (with PyInstaller). - Server Control:
- Console-based interface on the server.
- Discord Slash Commands (
/jar ...) for interacting with implants.
This software is intended for educational and authorized security testing purposes ONLY. Using this tool (or any similar tool) on systems without explicit, informed consent from the owner is illegal and unethical. The author is not responsible for any misuse or damage caused by this program. Always respect privacy and legal boundaries.
For NixOS :
Just run nix-shell :3
For any linux distros :
General:
- Python 3.8+
pip(Python package installer)
For the Server (server.py):
- Python libraries:
discord.py,python-dotenv,colorama,cryptography.
For the Client Builder (build.sh):
patchelf(if you intend to use the NixOS patching feature).
-
Create a Discord Application and Bot:
- Go to the Discord Developer Portal.
- Click "New Application", give it a name (e.g., "JAR C2 Controller"), and click "Create".
- Navigate to the "Bot" tab on the left sidebar.
- Click "Add Bot" and confirm.
- Copy the Bot Token: Under the bot's username, find "TOKEN". Click "Reset Token" (if needed) then "Copy". Store this token securely; it's like a password.
- Enable Privileged Gateway Intents: Scroll down to "Privileged Gateway Intents" and enable "MESSAGE CONTENT INTENT". This is crucial for the bot to read commands/output. You might also need "SERVER MEMBERS INTENT" depending on future features.
-
Create a Discord Server (Guild):
- In your Discord client, create a new, private server. This will be your C2 control server.
-
Invite Your Bot to Your Server:
- In the Developer Portal, go to "OAuth2" -> "URL Generator".
- Under "SCOPES", select
botANDapplication.commands. - Under "BOT PERMISSIONS", select at least:
Send MessagesRead Message HistoryManage Webhooks
- Copy the "GENERATED URL" at the bottom. Paste it into your browser.
- Select the server you created in step 2 and click "Authorize".
-
Get Your C2 Channel ID:
- In your Discord server, create a new text channel (e.g.,
#jar). This channel will be used for commands and output. - Enable Developer Mode in Discord: User Settings -> App Settings -> Advanced -> Developer Mode (toggle ON).
- Right-click on your new C2 channel and select "Copy ID". This is your Channel ID.
- In your Discord server, create a new text channel (e.g.,
-
Create a Webhook for Client Output:
- In your C2 channel (#jar), click the gear icon (Edit Channel) -> Integrations -> Webhooks -> "New Webhook".
- Give it a name (e.g., "Implant Reports").
- Ensure it posts to your C2 channel.
- Click "Copy Webhook URL". This URL will be used by clients to send their output.
-
(Optional) Get Your Guild ID (for faster slash command updates):
- With Developer Mode still enabled, right-click on your server's icon in the server list and select "Copy ID". This is your Guild ID.
- Clone this repository
- Rename
.env.exampleto.envin the project's root directory. - Edit the
.envfile with your Discord details
-
Install Dependencies: It's recommended to use a virtual environment or to run
nix-shellon a NixOS device.python3 -m venv server_env source server_env/bin/activate # On Windows: server_env\Scripts\activate pip install discord.py python-dotenv colorama cryptography
(You can create a
requirements_server.txtwith these and usepip install -r requirements_server.txt) -
Ensure
.envis in the project root (whereserver.pyis). -
Run the Server:
python server.py
The server will start, connect to Discord, and print its status. Slash commands might take up to an hour to appear globally if you haven't specified
MY_DISCORD_GUILD_IDfor faster syncing.
This script compiles client.py into a standalone executable.
- Make
build.shexecutable:chmod +x build.sh
- Run the Builder:
./build.sh
- The script will first try to load Discord configuration values from your
.envfile as defaults. - It will then prompt you to confirm or enter:
- Discord Webhook URL (for client output)
- Discord C2 Channel ID (for client polling)
- Discord Bot Token (for client polling - with security warning)
- RAT Encryption Key
- It will also ask for the desired output executable name.
- The script will first try to load Discord configuration values from your
- Output:
- The final executable will be in the
dist/directory (e.g.,dist/client_discord_obf).
- The final executable will be in the
- NixOS Patching (Optional):
- The script will ask if you want to patch the executable for NixOS. This is only relevant if you are building on NixOS and intend to run the client on your NixOS system.
- Start the Server: Run
python server.pyor executedist/serveron your machine (to get an headless version). - Deploy and Run the Client: Transfer the client executable (e.g.,
dist/client_discord_obf) to the target machine and run it.- It will send an initial "CHECKIN" message to your Discord C2 channel via the configured webhook.
- Control via Server Console:
- The
server.pyconsole will show aJAR >prompt. - Type
list(orhelp,?) to see available implants and operations. - Select implants by number to send single commands or enter interactive mode (e.g.,
1for single command to implant 1,1ifor interactive). - Type
0to broadcast a command.
- The
- Control via Discord Slash Commands:
- In any channel your bot can see (ideally your private C2 server), type
/jar. - Available commands:
/jar list_implants: Shows active implants./jar cmd <target> <instruction>: Sends a command.targetcan be the implant's number (fromlist_implants) or its full UUID./jar broadcast <instruction>: Sends a command to all active implants.
- Output from commands sent via slash commands will be posted as a new message in the C2 channel.
- In any channel your bot can see (ideally your private C2 server), type
- Implement more robust key exchange or per-client encryption keys.
- Add more persistence methods for different OS.
- File upload/download capabilities.
- Screenshotting, keylogging.
- More sophisticated client check-in and tasking.
- Alternative C2 channels (e.g., server-side command relay instead of client polling Discord directly).