473,597 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Keystroke logger for Windows

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

Jul 18 '05 #1
7 6218
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("Key sym Logger")

def reportEvent(eve nt):
print 'keysym=%s, keysym_num=%s' % (event.keysym, event.keysym_nu m)

text = Tkinter.Text(ro ot, width=20, height=5, highlightthickn ess=2)

text.bind('<Key Press>', reportEvent)

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

root.mainloop()
"hokieghal9 9" <ho********@hot mail.com> wrote in message
news:bi******** **@solaris.cc.v t.edu...
| 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
|
Jul 18 '05 #2
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("Key sym Logger")

def reportEvent(eve nt):
print 'keysym=%s, keysym_num=%s' % (event.keysym, event.keysym_nu m)

text = Tkinter.Text(ro ot, width=20, height=5, highlightthickn ess=2)

text.bind('<Key Press>', reportEvent)

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

root.mainloop()
"hokieghal9 9" <ho********@hot mail.com> wrote in message
news:bi******** **@solaris.cc.v t.edu...
| 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
|
Jul 18 '05 #3
> 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
Jul 18 '05 #4
> 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
Jul 18 '05 #5
> 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
Jul 18 '05 #6
> 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
Jul 18 '05 #7
Change of plans. The hooks library is at
http://www.sourceforge.net/projects/uncassist. You can download and
run the pyHook windows installer, or check it out of CVS. There's an
example.py file in the CVS pyHook module that shows you how to use it
(requires wxPython for the GUI).

Pete

pa*****@cs.unc. edu (Peter Parente) wrote in message news:<85******* *************** ****@posting.go ogle.com>...
I have a Python library that can capture system wide keystrokes and
mouse events. Basically, the windows hooking code is in a C Python
extension that passes callback information back to Python when an
event occurs. I'll
post it to our Python tools sourceforge site in the near future. (I
need to clean it up a bit and provide an example before it will be the
least bit useful to you.)

When it's posted, it will appear at
http://sourceforge.net/projects/uncpythontools/ as the pyHook project.

Pete
hokieghal99 <ho********@hot mail.com> wrote in message news:<bi******* ***@solaris.cc. vt.edu>...
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

Jul 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2800
by: Nermin Brgulja | last post by:
Hi, I am using jdk1.4 Logger with a FileHandler for logging in a web application, and have two questions regarding logging: The first question is: I've created an Logger and mapped it to an FileHandler. When the application starts the logging, The logger is writing in the file as well as in to Syste.out. How can I turn off system out?
0
1953
by: Laszlo | last post by:
Hi I need a GL::Logger wich implements Class::Singleton to be a singleton and Log::Log4perl to can log amy message into a file. Here is the module source: ------------------------------------------------------------------------- package GL::Logger; use Class::Singleton; use vars qw( $ERROR );
2
2788
by: beaker | last post by:
Hello, I'm writing a program (which will be running in the background 99% of the time) and I want to be able to work out how long it has been since the user last used the mouse and/or keyboard. I plan on using a Timer to do the checking periodically, but I'm not sure how to get the time of the last mouse click or keystroke. Any suggestions? I've seen examples on keyboard loggers but they seem to focus on capturing all keystrokes,...
1
1575
by: rodsatt | last post by:
Hi, This is my first post, and I got questions about logging. When something happen within an object, and if I would like to log the event, what would be a good way to do it? 1. I make the logger object embedded in the class and use it (as the one below) 2. I have only one logger that other objects can call. Create Logger once, and let it stay there where other objects can call for services. The reason I asked this question about this...
5
2114
by: CedricCicada | last post by:
Greetings! I want to write messages into the Windows event log. I found sevicemanager, but the source is always "Python Service", and I'd like to be a bit more descriptive. Poking around on the Internet revealed the existence of the logging module. It seems to have easily understood methods with the power I need. So I tried it. Here's my attempt: logger = logging.getLogger("TahChung Part 1")
4
1705
by: garyjefferson123 | last post by:
Suppose I have some sort of context variable that I want to appear in log messages. E.g.: logger = logging.getLogger("somelogger") class SomeOp: def __init__(self, ctx): self.ctx = ctx def method1(self): logger.info("%s: here's a message", self.ctx)
1
1805
by: nagk9 | last post by:
Hi , I am using log4j in my application. I have the problem with log4j.properties file . It will automatically appends another logger file from the current logger which i am using for the current application and also it logs or merging other logger content of other applications in the current logger. I don't want to print other logger messages from the current logger. Is there any way to restrict the other logger messages of other...
1
2850
by: Matimus | last post by:
Yes but in the other hand :http://docs.python.org/library/logging.html#logger-objects That is part of the power of the logging module. If you ask for a logger of the same name in two different place you will get the same object. That way you don't have to pass the logger instances around, and it always has the same properties (same handlers attached, same level, etc.). If you want to add functionality you getLoggerClass, inherit from...
0
7979
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7894
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8262
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6706
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3893
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.