![]() |
|
[C#] [C#] Basic RAT with source and explanation. - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] [C#] Basic RAT with source and explanation. (/showthread.php?tid=623061) |
[C#] Basic RAT with source and explanation. - PurpleHaze - Aug 19, 2010 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 * - Aeonhack Archivist - Aug 19, 2010 Thank you very much for this source. It is simple, clean, and very easy to understand. I will learn a lot from it. * - Charny - Aug 19, 2010 Nice share :P.. If it would have been in VB.net, you would have got something like 50 replies. <.< * - FluR0 - Aug 19, 2010 (Aug 19, 2010 10:39 PM)Charny Wrote: Nice share :P.. nou C# is FTW VB.NET is a horrible excuse for a language. * - Charny - Aug 19, 2010 (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). * - laptopguy - Aug 19, 2010 Nice contribution; I'm glad it's in C# and not that shit VB. * - Threadlocks - Aug 19, 2010 very good kepp it up mate :p * - Coder - Aug 19, 2010 Thanks for the tutorial. :) * - clydedoris - Aug 20, 2010 nice start i guess..short * - enacje - Aug 20, 2010 Good to see I'll take a look in it :) * - PurpleHaze - Aug 20, 2010 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#. * - Elios - Aug 20, 2010 (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! * - SLAPYA - Aug 20, 2010 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 * - Screwbacca - Aug 21, 2010 (Aug 19, 2010 11:38 PM)kRaeTwin 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. * - D3r1v4t1v3 - Aug 21, 2010 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. |