diff --git a/Domains/cli/MiniProjects/RandomPasswordGenerator/README.md b/Domains/cli/MiniProjects/RandomPasswordGenerator/README.md new file mode 100644 index 00000000..f2712a4a --- /dev/null +++ b/Domains/cli/MiniProjects/RandomPasswordGenerator/README.md @@ -0,0 +1,15 @@ +# Random Password Generator + +A simple command-line tool to generate secure random passwords in Python. + +## Features +- Customizable password length +- Options to include uppercase, digits, and symbols +- Easy to use and extend + +## How to Run +1. Make sure you have Python installed. +2. Navigate to this folder in your terminal. +3. Run: + ```bash + python password_generator.py \ No newline at end of file diff --git a/Domains/cli/MiniProjects/RandomPasswordGenerator/password_generator.py b/Domains/cli/MiniProjects/RandomPasswordGenerator/password_generator.py new file mode 100644 index 00000000..eb1b5c14 --- /dev/null +++ b/Domains/cli/MiniProjects/RandomPasswordGenerator/password_generator.py @@ -0,0 +1,24 @@ +import random +import string + +def generate_password(length=12, include_uppercase=True, include_digits=True, include_symbols=True): + """Generate a random secure password.""" + characters = string.ascii_lowercase + if include_uppercase: + characters += string.ascii_uppercase + if include_digits: + characters += string.digits + if include_symbols: + characters += string.punctuation + + if not characters: + raise ValueError("At least one character type must be selected.") + + password = ''.join(random.choice(characters) for _ in range(length)) + return password + +if __name__ == "__main__": + print("Random Password Generator") + print("-" * 25) + pwd = generate_password() + print(f"Generated Password: {pwd}") \ No newline at end of file