-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDecryptThread.py
37 lines (33 loc) · 1.03 KB
/
DecryptThread.py
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
import sys
import threading
from pathlib import Path
from Helper import Helper
from FileCrypter import FileCrypter
import Config
class DecryptThread (threading.Thread):
def __init__(self, priv_key, eel_obj):
threading.Thread.__init__(self)
self.privkey = priv_key
self.eel = eel_obj
def run(self):
h = Helper()
h.info('DecryptThread started')
self.decrypt()
def decrypt(self):
h = Helper()
not_encrypted = []
p = './test_files'
if Config.DEBUG_MODE is False:
p = str(Path.home())
pathlist = Path(p).glob('**/*.supergirl')
for path in pathlist:
path_in_str = str(path)
fc = FileCrypter()
try:
fc.decrypt_file(path_in_str, self.privkey)
h.info("Decrypted " + path_in_str)
except IOError:
not_encrypted.append(path_in_str)
h.error("Could not decrypt " + path_in_str)
#h.safe_exit()
self.eel.decrypt_success()