There are many ways of making a Key Logger in Visual Basic .Net. Just like there are many legitimate reasons to making a key logger. However many of the hookless Key Logging methods I’ve tried in VB .Net have many limitations. Some wont log speacial characters like the Period or the @ and # characters. This causes problems with reliable key logging. The only and best way I have found to be able to log keystrokes in a way that it should log them is by hooking the Keyboard.

Related Articles

After spending some time on the Msdn site, studying keyboard mapping. As well as spending time on the Pinvoke site looking at examples of using the user32.dll file on Windows systems. I was able to come up with a nice little class that can be added to a VB .Net project to log keystrokes by using a low level Keyboard Hook to hook the keyboard.

This is done by Injecting our custom VB .Net code into the user32.dll, since the user32.dll is not a supported .Net Library it becomes a bit more difficult to import it into our project. Which is why injecting the DLL is necessary.

After writing the class and adding it the VB .Net project it becomes simple to apply the achieve the needed goals. Because this involves injecting code into DLLs and certain legal concerns, I wont be posting any code since it people can apply the methods used for injecting dlls for malicious purposes.

Resources

MSDN SetWindowsHooks Function

MSDN UnhookWindowsHookEx Function

Pinvoke Activate Keyboard Layout

Pinvoke User32

This post first appeared on
Tech Me Out, please read the originial post:
here