Making RAT c#

[ FOR EDUCATIONAL PURPOSES ONLY ]

Hello, im a c# programmer, i would to ask, if someone can link me some sources to start programming RAT in c#, i don’t want RAT source code bcause are vry complex i want to start from the beginning and understand where i put my hands, without copying or editing CODE of other people.

Other questions:

  1. What i need to connect Server & Client?
  2. Tcp Connections are good?
  3. How the client exec actions?

Some nudge vry apprecied, ty, sorry if i posted in a wrong sections (idk) and sorry for my bad english.

1 Like

Your English is fine. I believe for network programming people use C++.

You don’t need to use C++ for networking. The .NET framework includes the TcpClient and TcpListener classes which will do everything you need. MS documentation here: TcpClient Class (System.Net.Sockets) | Microsoft Docs

I’m actually working on a similar tool right now using VB.NET (so identical underlying class libraries to C#.NET, just slightly different syntax) and the code will be on github when it is done soon. For now here’s some pics and video: https://twitter.com/VbScrub/status/1248647584123703299

But you said you don’t want to copy or edit other people’s stuff, so to answer your questions:

  1. You need to start a TcpListener in one program on one machine and call the AcceptTcpClient method, then have a TcpClient connect to it from your code that is running on the other machine (to avoid firewalls blocking the connections, you’re probably going to want your victim machine to do the outbound connection and your attacker machine be the one that is listening for incoming connections). There are loads of tutorials out there about how to use these two classes, so do some googling.

  2. Yes TCP will be what you want to use

  3. That’s up to you really. Once the TCP connection is established, you can send whatever you want between the 2 machines in byte format. Its up to you to decide how to encode messages to mean certain things so that the program receiving it knows to execute a certain action when it receives one message and another action when it receives a different message.

I’ll warn you now this can get quite complicated quite quickly and is not as straight forward as just reading files etc. I spent over 5 hours yesterday troubleshooting a bug in my program’s file transfer feature and it was all to do with how the messages get encoded and the fact that multiple messages can arrive at the same time even if they were sent separately by the remote machine.

VBscrab,
can we run that on kali?

@Rayz said:
VBscrab,
can we run that on kali?

I don’t think so. Even though some of the .net framework has been ported over to run on linux, the WPF part doesn’t seem to have been and that’s what this uses.

@VbScrub said:

@Rayz said:
VBscrab,
can we run that on kali?

I don’t think so. Even though some of the .net framework has been ported over to run on linux, the WPF part doesn’t seem to have been and that’s what this uses.

Last time I checked, not even Windows.Forms have been ported. Neither by Mono nor the “Linux .NET” :frowning:

Type your comment> @HomeSen said:

@VbScrub said:

@Rayz said:
VBscrab,
can we run that on kali?

I don’t think so. Even though some of the .net framework has been ported over to run on linux, the WPF part doesn’t seem to have been and that’s what this uses.

Last time I checked, not even Windows.Forms have been ported. Neither by Mono nor the “Linux .NET” :frowning:

Yeah its kind of weird cos MS are pushing .NET Core as a great cross platform framework. That’s one of their main selling points for it - that it also runs on Linux and Mac. But yet you can’t use WinForms or WPF on either of them, so its only useful if you want to write a command line program really (and even then, I feel like there must be some limitations)

You can find a lot of sources on github, just use google search reqeust: “rat inurl:github”

Here is an Udemy Course fitting your requirements, entitled: Fundamentals of Building a Remote Access Tool (RAT) in C#: https://www.udemy.com/course/build-remote-access-tool/?couponCode=RATNOV16