-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecrypt.py
45 lines (42 loc) · 1.21 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
41
42
43
44
45
from encrypt import get_encrypt
import os
def readit(ifile):
"""
Read the Password of a file
"""
crypter = get_encrypt()
direc = os.path.join("./purposes/Passwords",f"{ifile}.bin")
dir_files2 = os.listdir("./purposes/Mail")
dir_mail = os.path.join("./purposes/Mail",f"{ifile}.bin")
mail = False
if (f"{ifile}.bin" in dir_files2):
"""
Check if an email is included
"""
with open(dir_mail, "r") as f:
text_mail = f.readline()
with open(direc, "rb") as f:
text = f.readline()
mail = True
else:
"""
If not mail stays False
"""
with open(direc, "rb") as f:
text = f.readline()
mail = False
try:
"""
Output depending on the mail value
"""
decryptString = crypter.decrypt(text)
message = (str(decryptString, "utf8"))
if mail == True:
print(" - The Pa$$w0rd and Mail are:")
print(f"\t - Pa$$word: {message}\n"
f"\t - Mail: {text_mail}")
else:
print(" - The Pa$$w0rd is:")
print(f"\t - Pa$$w0rd: {message}")
except:
pass