massacre0 has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to keylog using Perl in Windows?

I've been told its necessary to use 'windows hooks'. I've never used these and I would appreciate any help along these lines.

Thanks.
Ryan

Replies are listed 'Best First'.
Re: Keylogging
by Corion (Patriarch) on Aug 27, 2001 at 00:39 UTC

    Keylogging can be done at various levels under Win32, the easiest being messages sent to your window handle (so you have one), the common way is to install a Window Hook, something which is not easily done from Perl (or, to be more specific, it's easy to install such a hook, but nearly impossible to create code that can be called asynchronously from the Windows kernel whenever a key event occurs).

    If you are thinking about capturing keystrokes and then playing them back to automate an application (which in fact is the only legitimate reason you would want to do "keylogging" at all), Window Hooks are the way to go, but it's a stony road, even if you're armed with C or a comparable low level language.

    If you need to do keylogging to spy on somebody entering his super secret password (FBI style), the simplest methods are still social engineering, shoulder surfing and making the gift of a wireless keyboard, and having a second receiver nearby plugged into a PC with Notepad.exe logging all keystrokes.