[Tutor] Fwd: Re: Hii
Alan Gauld
alan.gauld at yahoo.co.uk
Fri Jun 21 18:06:47 EDT 2019
On 21/06/2019 14:59, Antonio Arizpe wrote:
> i just need help with a script thats registers keystrikes and adds up all
> the times you've struck a key and gives a number of the total amount of
> times the keyboard was struck. nothing specific about characters. just how
> many times it was struck in a real number.
If you only wanted to do this for your own application it would be
relatively simple but since it seems you want to do it for the
computer as a whole that raises a whole extra level of complexity.
Some issues to consider:
1) If this is not just installed on your own personal computer it could
be illegal - breach of personal privacy legislation in many countries
prohibits key logging.
2) Do you care about users logging in remotely? Do you need to just log
the current user logged in for the current GUI session or do you also
want to record activity by other remote hosts logging in?
3) What about virtual machines running on the computer? Do you want to
capture keystrokes within those VMs? That might be tricky as it may not
show up in the native OS. It may even depend on the VM the user is running.
4) Do you care about which user is logged in or do you want to record
keystrokes for every user of the computer?
5) Is it only counting for a single session or for multiple sessions?
This is more of an application design question that keylogging per se...
Leaving those issues aside and looking only at the keylogging aspects.
Your best bet is to find a third party module that does it for you.
Failing that you will need to use the OS facilities which is never a
trivial exercise. It is also the kind of low level feature that can
change between OS versions (especially between 32bit and 64bit versions)
If you plan to use it on multiple OS then the technique will likely
differ between OS - MacOS and Linux may be similar but windows will
be different.
Let's assume the simplest case where you only want this for personal use
on a computer where you are the only user and don't run any other OS
either dual boot or in a VM. in that case you could write a Python
application that does keylogging and put it in your startup group.
How you notify it to stop recording before the computer shuts down is
another issue and how it records/displays its results needs thought too.
On Windows you might need to use ctypes to access the raw Win32 API or
the PyWwin32 Python package may include functions that will do the job
for you.
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list