-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLockMonitor.py
More file actions
executable file
·32 lines (26 loc) · 845 Bytes
/
Copy pathLockMonitor.py
File metadata and controls
executable file
·32 lines (26 loc) · 845 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
import subprocess
import threading
import time
class ComputerMonitor:
def __init__(self, callback):
self.callback = callback
self.started = False
def monitor(self):
self.monit_windows_lock()
def monit_windows_lock(self):
while True:
process_name = 'LogonUI.exe'
callall = 'TASKLIST'
outputall = subprocess.check_output(callall, shell=True)
outputstringall = str(outputall)
if process_name in outputstringall:
print("Locked.")
if self.callback:
self.callback()
else:
pass
time.sleep(1)
def start(self):
monitor_threading = threading.Thread(target=self.monitor, args=())
monitor_threading.start()
self.started = True