-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprocess_control.py
More file actions
53 lines (52 loc) · 2.35 KB
/
process_control.py
File metadata and controls
53 lines (52 loc) · 2.35 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import psutil
import hashlib
import __main__
import hashdatabase
import threading
import filescan
import tkinter
check_proc = psutil.process_iter()
proc_list = ['consent.exe', ]
def mainn():
__main__.update_text('scanning running processes')
for proc in psutil.process_iter():
proc_list.append(proc.name())
__main__.root.update()
while 1:
try:
for proc in psutil.process_iter():
__main__.root.update()
if proc.name() not in proc_list:
__main__.root.update()
__main__.update_text('New Process %s found.' % proc.name())
opened_file = open(proc.exe(), 'rb')
readfile = hashlib.md5(opened_file.read())
hash = readfile.hexdigest()
__main__.root.update()
if hash not in filescan.return_download_hash_list():
threading.Thread(target=hashdatabase.find_hash, args=([hash]), daemon=True).start()
while __main__.q.empty() == True:
__main__.root.update()
else:
pass
if __main__.q.get() == hash:
print('match found')
__main__.detected_list.append(proc.exe())
__main__.update_detected_list_view()
__main__.root.update()
else:
if __main__.check_auto_vtotal_var.get() == tkinter.TRUE:
print('vtotal')
else:
pass
print('no match')
__main__.update_text("{} seems to be good!".format(proc.name()))
proc_list.append(proc.name())
filescan.add_clean_hash(hash)
__main__.root.update()
else:
proc_list.append(proc.name())
__main__.update_text("{} was already scanned & seems to be good!".format(proc.name()))
except:
pass
__main__.root.update()