Keystroke logger for Windows

Michael Geary Mike at DeleteThis.Geary.com
Fri Aug 22 22:02:59 EDT 2003


> Does anyone know of a keystroke logger that has been written in Python
> for Windows machines? I'd like to see such a script and use it as a
> point of reference for a real-time backup project that I'm working on.
> Basically, I'd like to be able to capture all keystrokes from the
> keyboard buffer and write them to a text file so I could reporduce
> emails, documents, etc. in the event of file loss that occurs between
> nightly backups. For example, my boss comes to me, he has deleted an
> email that he was writing... he has been working on the email all day...
> and he expects me to wave a magic wand and bring it back.
>
> Thanks for any advice, code or pointers. Also, if Python isn't suited
> for this, let me know and I'll look at doing this in c

I don't think Python would be a good choice for the basic keystroke logging
utility. A program like this is implemented as a systemwide message hook,
which is a DLL that is loaded into the address space of *every* application.
This is a simple piece of code that should be written in C/C++ to keep it
small.

There are a number of commercial products that do keystroke logging, but the
ones I've seen are intended for spying on someone else's computer
activity--i.e. something your boss might want to put on your computer, not
something you would want to put on your boss's computer!

I find the spying orientation of those products rather distasteful, but
maybe one of them could be used in a more benign way. PC Magazine reviewed
several of them last year:

http://www.pcmag.com/article2/0,4149,111820,00.asp

Some time ago I wrote a similar program for my own use (spying on myself as
it were). Maybe it would be worth cleaning it up and releasing it as open
source. It's actually pretty handy. For example, if I see a file on my
system I don't recognize, I can look back at my log and see what I was
doing--what program I was running that created that file. But I'd be worried
about the privacy implications--I wouldn't want my program being used as
spyware.

-Mike






More information about the Python-list mailing list