This is a Windows-based keylogger developed in C++. It captures and logs keystrokes at the system level using Windows Hooks. The project demonstrates how low-level keyboard events can be monitored using the Windows API.
You can checkout https://medium.com/@atharvphadatare78/part-1-learn-building-a-windows-keylogger-with-c-7ad04c1da8c9 ,https://medium.com/@atharvphadatare78/part-2-the-real-spy-work-begins-829674711cdb ,To learn how to build your own keylogger. And I have explained concepts releted to the Keylogger in detail there.
⚠️ DISCLAIMER: This tool is built strictly for educational purposes. Unauthorized use of a keylogger is illegal and unethical. Use it only in lab environments or with explicit permission.
- ✅ Captures every key press using a low-level keyboard hook
- ✅ Supports alphanumeric and special characters
- ✅ Detects shift and caps lock to log proper case
- ✅ Writes logs to a hidden file silently
- ✅ Automatically captures locale keyboard layout
- Language: C++
- Platform: Windows OS
- API: Windows API (Win32)
- Tools: MinGW / Visual Studio Code
The program installs a low-level keyboard hook using SetWindowsHookEx() with the WH_KEYBOARD_LL flag.
Each keystroke triggers HookCallback(), which retrieves the key code using a KBDLLHOOKSTRUCT structure.
It converts virtual key codes into readable characters, accounting for SHIFT and CAPS LOCK to log the correct case.
Captured keystrokes are stored in a log file, which can be hidden for stealth operation.
- Windows OS
- MinGW compiler or Visual Studio Build Tools
Using g++ via MinGW:
g++ keylogger.cpp -o keylogger.exe -luser32
./keylogger.exe