TGViewer
Python Скрипты Python Скрипты @pythonscriptss · 2.9K subscribers
Post #19 3.58K
📌 Менеджер паролей 👨‍💻

import csv
from cryptography.fernet import Fernet

passwords = []
key = Fernet.generate_key()
cipher_suite = Fernet(key)

def encrypt_password(password):
return cipher_suite.encrypt(password.encode())

def decrypt_password(encrypted_password):
return cipher_suite.decrypt(encrypted_password).decode()

def add_password():
website = input("Website: ")
username = input("Username: ")
password = input("Password: ")
encrypted_password = encrypt_password(password)
passwords.append({
"website": website,
"username": username,
"password": encrypted_password
})
with open('passwords.csv', mode='a', newline='') as file:
writer = csv.writer(file)
writer.writerow([website, username, encrypted_password])

def get_password(website):
for entry in passwords:
if entry["website"] == website:
username = entry["username"]
encrypted_password = entry["password"]
decrypted_password = decrypt_password(encrypted_password)
print(f"Website: {website}")
print(f"Username: {username}")
print(f"Password: {decrypted_password}")
return
print("Website not found")

with open('passwords.csv', mode='r') as file:
reader = csv.reader(file)
for row in reader:
passwords.append({
"website": row[0],
"username": row[1],
"password": row[2]
})

while True:
print("\n1. Add Password")
print("2. Get Password")
print("3. Exit")

choice = input("Enter your choice: ")

if choice == '1':
add_password()
elif choice == '2':
website = input("Enter website: ")
get_password(website)
elif choice == '3':
break
else:
print("Invalid choice")
   

#минипроект
  • 💩 6
  • 🔥 4
  • 🤡 4
  • 💊 3
More from @pythonscriptss
  1. Jun 10, 2026Python иногда может выглядеть как тёмная магия. Вот однострочный quicksort через lambda: q…
  2. May 27, 2026⚡️ Python в 2026 - это не теория, а навык, который можно сразу применять. Курс для тех, кт…
  3. May 26, 2026🐍 Python Roadmap 2026: наконец-то полноценная актуальная карта изучения Python, а не спис…
  4. May 16, 2026✔️ Machine Learning Roadmap: нормальная карта входа в ML без сказок про «выучить нейросети…
  5. Apr 26, 2026🚀 Browser Harness - это легкий инструмент, позволяющий LLM выполнять любые задачи в брауз…
  6. Apr 20, 2026Создание новой переменной в Python фактически означает создание нового имени для уже сущес…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →