-
Notifications
You must be signed in to change notification settings - Fork 0
/
decrypt.py
40 lines (34 loc) · 1.1 KB
/
decrypt.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
38
39
40
import os
import scandir
from cryptography.fernet import Fernet
folder = os.path.expandvars("%userprofile%")+"/Pictures/Camera Roll" #can be changed to fit your needs
file_list = []
wrong_file= []
i=0
o=0
for paths, dirs, files in scandir.walk(folder):
for file in files:
if file.endswith("encrypt.py" or "decrypt.py" or "thekey.key"):
continue
else:
file_list.append(os.path.join(paths, file))
#win11 ghostfilefilter
while i <= len(file_list)-1:
file_path = file_list[i]
if file_path.endswith("ini"):
wrong_file.append(i)
i=i+1
wrong_file.sort(reverse=True)
while o <= len(wrong_file)-1:
file_path= int(wrong_file[o])
file_list.remove(file_list[file_path])
o= o+1
#end of ghostfilefilter
with open("thekey.key", "rb") as thekey:
secretkey = thekey.read()
for file in file_list:
with open(file, "rb") as thefile:
contents = thefile.read()
contents_decrypted = Fernet(secretkey).decrypt(contents)
with open(file, "wb") as thefile:
thefile.write(contents_decrypted)