How to Create a Keylogger using Python

How to make a simple python keylogger


First of all a Keystroke logging , is the action of recording(logging) the keys struck on a keyboard, typically covertly, so that the person using the keyboard is unaware that their actions are being monitored. Various keylogging methods exist which can be used for numerous purposes like studying human-computer interaction. Various requirements must be met before we write the actual code. So, follow the process below  step by step:
1.  First, we are going to use python programming language as python’s philosophy lets you get most tasks done more easily and more quickly with less mental overhead. And we must have python installed in our desktop computer or laptop.
To install python click the Downloads > Windows link from the home page of the Python.org web site . The Windows version is provided as an MSI package. To install it manually, just double-click the file. 
2. Then, we need some of the python modules i.e. pywin32 and pyHook in our keylogger. Modules contains python codes and defined classes, functions and variables. So, to install them type the code: ‘pip install pyhook”   in your command prompt.

What are the uses of these modules?

Pywin32:

 A set of extension modules that provides access to many of the Windows API functions.

Pyhook:

The pyHook library wraps the low-level mouse and keyboard hooks in the Windows Hooking API for use in Python applications.Simply It helps to trigger some action when the user clicks the mouse or press some keys in the keyboard.
3. Use a code editor to edit our code. We can simply use notepad available in our system.
Download

4. Finally, to run the a python file just open your command prompt and type python followed by your filename and press enter. If your file name is myfile.py then type
python myfile.py

How to see the logged keys of keylogger?

To see the result of your keylogger that is the logged keys you just need to open the file ‘C:\\imp\\log.txt’

Leave a Reply

Your email address will not be published. Required fields are marked *