Black Hat Python — Windows Key logger

Ismail Akkila
1 min readNov 9, 2017

This is a quick post that will show how to create a simple windows key logger using python 2.7. Not only, you can track the keys pressed but also the clipboard data used for copy-paste!

The script makes use of the pyHook module to capture keyboard events. The script tracks when LCTRL -V is pressed for the clipboard. To exit the script, you can use LCTRL-~:

Running the script, gave me the following as an example:

C:\Python27>python.exe ch8_windows_keylogger.pyUntitled - Notepad - 3196
[Return] [Capital] [H] [E] [L] [L] [O] [Space] [Capital] [W] [Capital] [O] [E] [Back] [R] [L] [D]
New Tab - Google Chrome - 6796
[W] [W] [W] [Capital] [Oem_Period] [G] [O] [O] [G] [L] [E] [Oem_Period] [C] [O] [M] [Return] [Lcontrol] [Lcontrol] [Lcontrol] [Lcontrol] [Lcontrol] [Lcontrol] [Lcontrol] [Lcontrol] [PASTE] - supersecretpassword [V]
Administrator: Command Prompt - python.exe test.py - 5412
[Lcontrol]
Exiting KeyLogger

Thanks for reading my post!

--

--

Ismail Akkila

I live and breathe technology. Curious about programming, bitcoin and cybersecurity.