pyxhook – a Linux based Keylogger

Assuming we have successfully cloned the GitHub repository of pyxhook, let's run a cd command in the directory of the downloaded repository and create a file called key_logg.py with the following contents:

# cd pyxhook# gedit key_logg.py

The keylogger makes use of the downloaded pyxhook repository module. As can be seen in line 2, we are importing the pyxhook module. The following code creates a custom class file called Mylogger. It defines a method, startlogin(), in which the central logic triggers:

Now, within our my_event custom method, we get the key pressed by invoking the current keyboard event. In ...

Get Hands-On Penetration Testing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.