Login Register






Tutorial How to Connect with Sockets (Async Example) (Reverse Connection) filter_list
Author
Message
How to Connect with Sockets (Async Example) (Reverse Connection) #1
Hello everybody. I would like to say that this is my very first tutorial on Sinisterly. I am not very active, so that would explain the low post count on my profile.

This can be used in your custom RAT.

First, open up Visual Studio 2013. Create New Project and name it "Sockets Example"

Make another project in the solution. Rename the other project to Client and the second one to Stub.

Server Side:

Make sure to Implement this code:

Code:
Imports System.Net, System.Net.Sockets Public Class Form1 Dim server As Socket Dim Client As Socket Dim bytes As Byte() = New Byte(1023) {} Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load server = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Dim ipEndPoint As IPEndPoint = New IPEndPoint(IPAddress.Any, 92) server.Bind(ipEndPoint) server.Listen(100) server.BeginAccept(New AsyncCallback(AddressOf OnAccept), vbNull) End Sub Private Sub OnAccept(ByVal ar As IAsyncResult) Client = server.EndAccept(ar) Client.BeginReceive(bytes, 0, bytes.Length, SocketFlags.None, New AsyncCallback(AddressOf Onrecieve), Client) End Sub Private Sub Onrecieve(ByVal ar As IAsyncResult) Client = ar.AsyncState Client.EndReceive(ar) Client.BeginReceive(bytes, 0, bytes.Length, SocketFlags.None, New AsyncCallback(AddressOf Onrecieve), Client) Dim message As String = System.Text.ASCIIEncoding.ASCII.GetString(bytes) MessageBox.Show(message) End Sub End Class

On the Client side (Which is the stub), you will need to implement this code:

Code:
Imports System.Net, System.Net.Sockets, System.Text.ASCIIEncoding Public Class Form1 Dim client As Socket Dim host As String = "127.0.0.1" Dim port As Integer = "92" Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load client = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Dim IP As IPAddress = IPAddress.Parse(host) Dim xIPEndPoint As IPEndPoint = New IPEndPoint(IP, port) client.BeginConnect(xIPEndPoint, New AsyncCallback(AddressOf onconnect), Nothing) End Sub Private Sub OnConnect(ByVal ar As IAsyncResult) client.EndConnect(ar) End Sub Private Sub OnSend(ByVal ar As IAsyncResult) client.EndSend(ar) End Sub End Class

What this does:

This connects to the RAT (which I am all about Remote Administration Tools), but does not have a command to show your client on the ListView. It is up to you to do whatever with this knowledge.

Disclaimer:

I am not responsible for what you do with this code. These types of programs can be legit, yet also can be controlled by hackers.

Thank you for your time.

-Xenotek

This is a lite version of the code. A full version will be posted eventually, with the listview codes.
(This post was last modified: 09-05-2014, 11:58 PM by Sykadelik.)

Reply