Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[C#] Basic RAT with source and explanation.

I spent yesterday and today learning C# Sockets and I have a fairly strong grasp now.
Here is a basic RAT that I made.

[IMG]http://i53.[censored].com/29liikg.png[/IMG]

Download: http://www.mediafire.com/?1vwl33zzdllj63s

Classes and namespaces.

So to start I created a new TcpListener and told it to listen on any IPAddress and I binded it port 6666.

I then created two new threads. One thread will be to handle all new incoming connections so I called that "_ConnectionLoop" and it started the method "ConnectionLoop". The other thread will be to update the bot list to either remove bots or add new ones. The thread is called "_UpdateBotList" and the method is "UpdateBotList".

The thread _ConnectionLoop will take a new connection from the TcpListener and turn it into a Socket. It then saves that socket into the Dictionary, and assigns it an identification number in numerical order.

The thread _UpdateBotList has two parts. The first will check the Dictionary and the botlist to see if there are any matching pairs. If nothing is found it will add one. The second will check to see if the bot is still connected to the host and if not it will be removed from both the Dictionary and the botlist.

When a bot is select from the botlist it will open up the socket from the Dictionary and send it three messages over NetWorkstream + StreamWriter. The messages are "GetUsername", "GetOS", "GetMachineName". The server file is ran into a continuous loop reading all messages and evaluating what to do through a Switch statement. On the server file I have a Class named "Methods" where I have all the code I need for the server to be able to find the Username, OS, and MachineName. The server then returns that information and the client sets that information in the labels.

Of course you will need to view the full source to fully understand what is going on.
I only added error catching where it was necessary, so you might experience crashes.
I also have methods that were never used and you might see random comments. That is because I was using this to learn, and I have achieved that.

Download: http://www.mediafire.com/?1vwl33zzdllj63s
Thank you very much for this source. It is simple, clean, and very easy to understand. I will learn a lot from it.
Nice share :P..

If it would have been in VB.net, you would have got something like 50 replies. <.<
(Aug 19, 2010 10:39 PM)Charny Wrote:  Nice share :P..

If it would have been in VB.net, you would have got something like 50 replies. <.<

nou C# is FTW VB.NET is a horrible excuse for a language.
(Aug 19, 2010 11:00 PM)FluR0 Wrote:  nou C# is FTW VB.NET is a horrible excuse for a language.

I know.. But the section is filled with VB.net skids & leechers (NOT EVERYONE).
Nice contribution; I'm glad it's in C# and not that shit VB.
very good kepp it up mate :p
Thanks for the tutorial. :)
nice start i guess..short
Good to see I'll take a look in it :)
I know that more people use VB which is why I put this in C# because there is not enough information in here for C#.
(Aug 20, 2010 07:11 AM)PurpleHaze Wrote:  I know that more people use VB which is why I put this in C# because there is not enough information in here for C#.

Thank you mate. Really appreciated the c# version.
As you said "there is not enough information in here for C#".

Thanks!
yes...thanks so much bro. Im so glad its in C# b/c I love C# and im sick of just seeing vb.net everywhere on this site.

great job bro
(Aug 19, 2010 11:38 PM)laptopguy Wrote:  Nice contribution; I'm glad it's in C# and not that shit VB.

Could not have been said any better. VB is shit.
This is really good PH! This will help me in my learning of sockets for C#. I was planning on learning them for VB.NET first lol but never mind. Thank you. As Charny said if this was in VB.NET you'd have got like 50 replies.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by ZhiYar-SlemanYMay 13, 2015 10:41 PM 56 4,335 May 13, 2015 10:41 PM
Last Post: ▓▒░ Realist ░▒▓
[.NET] by Mon£yApr 20, 2015 05:56 AM 73 2,146 Apr 20, 2015 05:56 AM
Last Post: Mon£y
[.NET] by spartanier7777Jan 24, 2013 03:23 PM 64 9,723 Jan 24, 2013 03:23 PM
Last Post: wοrlockt