Keystroke logger for Windows

H

hokieghal99

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
 
E

Elaine Jackson

I found this on the web someplace. It may be relevant.

# /usr/local/bin/Python
# Displays the keysym for each KeyPress event as you type
import Tkinter
root = Tkinter.Tk()

root.title("Keysym Logger")

def reportEvent(event):
print 'keysym=%s, keysym_num=%s' % (event.keysym, event.keysym_num)

text = Tkinter.Text(root, width=20, height=5, highlightthickness=2)

text.bind('<KeyPress>', reportEvent)

text.pack(expand=1, fill="both")
text.focus_set()

root.mainloop()


| 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
|
 
M

Michael Geary

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
 
M

Michael Geary

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.

Just adding one (fairly obvious) thought... Even though I wouldn't use
Python for the low-level systemwide message hook, it would be an excellent
choice for code that processes the resulting log.

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top