-
-
Save den-run-ai/97be66684366b5526e1df38f46dbdfc0 to your computer and use it in GitHub Desktop.
Key/mouse logger demo with PyUserInput
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# The following is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
from pykeyboard import PyKeyboardEvent | |
from pymouse import PyMouseEvent | |
from threading import Thread | |
from time import sleep | |
class KeyListener(PyKeyboardEvent): | |
def __init__(self): | |
PyKeyboardEvent.__init__(self) | |
def handler(self, reply): | |
print("Handle keypress here...") | |
class MouseListener(PyMouseEvent): | |
def __init__(self): | |
PyMouseEvent.__init__(self) | |
def click(self, x, y, button, press): | |
print("Handle mousepress here...") | |
if __name__ == '__main__': | |
keylistener = KeyListener() | |
mouselistener = MouseListener() | |
kt = Thread(target=keylistener.run) | |
mt = Thread(target=mouselistener.run) | |
kt.start() | |
mt.start() | |
while True: | |
print("Running...") | |
sleep(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment