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
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


