4

I just bought a new keyboard, and I'm interested in tracking exactly how many keypresses/strokes I make during the entire life of the keyboard. (I would want to just record keyUp, as I don't care about repeats)

I've been googling around for the best way to do this, but I don't even know what approach to take, so I'm having trouble searching intelligently. Also, the only language I've really worked with is C#. Haven't done anything with C/C++ or WinAPI

Is it difficult to modify the Win 7 drivers directly? I do want to be able to record keystrokes from the moment the computer boots, but this may not be easily done. I would prefer to use an existing driver or hook, as I really don't care to get into learning device drivers right now.

I've looked briefly at Ctrl2Cap, but I don't know how to modify something like that to suit my case.

Other questions I looked at,

This one indicates writing a USB Filter driver may work, but I have no clue where to start on that. Disabling the keyboard in windows c++?

Community
  • 1
  • 1
Kal_Torak
  • 2,532
  • 1
  • 21
  • 40

3 Answers3

1

It is not necessary to go the driver route, which is not for the faint of heart. You can use use a low level keyboard hook which will work fine from .NET.

I did a quick bing and found the following on codeplex http://globalmousekeyhook.codeplex.com/

It should get you going

Chris Taylor
  • 52,623
  • 10
  • 78
  • 89
  • This is the best answer, but be aware that virtually all anti-virus software will identify any program with a keyboard hook as malware and quarantine it. You'll have to manually exclude it from being quarantined. – Carey Gregory Aug 12 '12 at 19:03
1

If you want to do that you need to use Kernel Level Keylogger. It's grabs the keystrokes before the operating system takes effects and this one 99% invisible for detection techniques. Then you can grab the Windows Log On screen typed things like password/username etc.

@ChrisTaylor's key logger not work for WinLog-on Screen I reckon. If you can install the keyboard driver filter before the system keyboard device driver take a action you can handle windows user login screen also. But In order to install this driver level key hook you need to have administrator privileges.

I found Unix and Windows Keyloggers from Github. Free to play with this https://www.adlice.com/kernelmode-rootkits-part-3-kernel-filters/ and have fun!

Elshan
  • 7,339
  • 4
  • 71
  • 106
-2

That, what you want is dangerous! With the same code everyone can create keylogger* But if you not a virus creator then I recommend you to search "hotkeying in C/C++" or something like that and hook keyboard with hotkeys! I have written HotKey Maker in VB6 which can make hotkey from every button of keyboard. But I really not interested in viruses :) Good Luck !

*Virus which hooks your keyboard and send all what you wrote in keyboard to Virus owner

Searush
  • 628
  • 1
  • 5
  • 18
  • 1
    Yes, it's one way to make a keylogger but there's nothing dangerous about it. – Carey Gregory Aug 12 '12 at 19:04
  • Is dangerous, because keyboard hook can easily be caught with many antiviruses. And then they can simply look where is going info from keylogger , and ... find you :) I think you willn't want to create virus after this ;) – Searush Aug 16 '12 at 07:20