app.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 |
import random import string import pandas as pd # Ask user for preferences num_passwords = int(input("How many passwords do you want to generate? ")) length = int(input("Length of each password: ")) include_uppercase = input("Include uppercase letters? (y/n): ").lower() == 'y' include_lowercase = input("Include lowercase letters? (y/n): ").lower() == 'y' include_digits = input("Include digits? (y/n): ").lower() == 'y' include_symbols = input("Include special symbols? (y/n): ").lower() == 'y' # Build character pool character_pool = '' if include_uppercase: character_pool += string.ascii_uppercase if include_lowercase: character_pool += string.ascii_lowercase if include_digits: character_pool += string.digits if include_symbols: character_pool += string.punctuation if not character_pool: print("You must select at least one type of character!") exit() # Generate passwords passwords = [] for _ in range(num_passwords): password = ''.join(random.choice(character_pool) for _ in range(length)) passwords.append(password) # Save to CSV df = pd.DataFrame(passwords, columns=["Generated Passwords"]) df.to_csv("generated_passwords.csv", index=False) print("\n✅ Passwords saved to 'generated_passwords.csv'") |