forked from Grow-with-Open-Source/Python-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_passwords_cli.py
More file actions
48 lines (36 loc) · 1.6 KB
/
Copy pathview_passwords_cli.py
File metadata and controls
48 lines (36 loc) · 1.6 KB
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
46
47
48
import base64
def view_passwords(filename="saved_passwords.txt"):
try:
with open(filename, "r") as file:
lines = file.readlines()
# Temperory variable to store each password block info
timestamp = label = encoded_password = ""
included_options = ""
print("\n🔐 Saved Passwords:\n")
for line in lines:
line = line.strip()
if line.startswith("["): # Timestamp line
timestamp = line.strip("[]")
elif line.startswith("Label:"):
label = line.split("Label:")[1].strip()
elif line.startswith("Encoded Password:"):
encoded_password = line.split("Encoded Password:")[1].strip()
try:
decoded_password = base64.b64decode(encoded_password.encode()).decode()
except Exception as e:
decoded_password = f"[Error decoding password: {e}]"
elif line.startswith("Included"):
included_options = line.split("Included -")[1].strip()
elif line.startswith("-" * 10): # Block ends here
print(f"📅 Date/Time: {timestamp}")
print(f"🏷️ Label: {label}")
print(f"🔓 Decoded Password: {decoded_password}")
print(f"🔧 Options Included: {included_options}")
print("-" * 40)
except FileNotFoundError:
print("❌ saved_passwords.txt not found.")
except Exception as e:
print(f"❌ An error occured: {e}")
# Run the function
if __name__ == '__main__':
view_passwords()