A Python-based command-line tool for generating secure passwords. The tool allows users to customize their passwords by including or excluding numerals, capital letters, small letters, and symbols.
- Generate passwords of custom lengths.
- Option to include or exclude:
- Numerals
- Capital letters
- Small letters
- Symbols
- User-friendly prompts and error handling.
- Python 3 installed on your system.
-
Clone the repository:
git clone /~https://github.com/godwin-binoy/Password-Generator.git
-
Navigate to the project directory:
cd Password-Generator
-
Ensure Python is installed by running:
python --version
-
Run the script:
python3 password_generator.py
-
Follow the on-screen prompts:
- Input whether to include numerals (y/n).
- Input whether to include capital letters (y/n).
- Input whether to include small letters (y/n).
- Input whether to include symbols (y/n).
- Specify the desired password length (must be a numerical value).
-
The generated password will be displayed on the screen.
-
To generate another password, press Enter. To exit, type
exit
.
- Start the script:
Password Generator ------------------ Length: 12 'y' = yes 'n' = no --------- Include Numericals in password? Enter here: y Include Capital letters in password? Enter here: y Include Small letters in password? Enter here: y Include Symbols in password? Enter here: y Password: A1b@c2d#E3
random
: To randomly shuffle and sample characters for the password.
This function prompts the user to choose whether to include numerals, capital letters, small letters, and symbols in their password. Based on the user's input, it constructs a string of allowed characters.
The user specifies the password length. If the input is invalid (not a number), an error message is displayed, and the input is re-requested.
Using the random.sample()
method, the script generates a random password by selecting characters from the user-defined pool of allowed characters.
- If no character types are selected, the script prompts the user again.
- If the desired password length exceeds the number of available characters, an error message is displayed.
- To add or modify the character pool (e.g., include additional symbols), edit the variables in the script:
numbers = '1234567890' capital_letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' small_letters = 'abcdefghijklmnopqrstuvwxyz' symbols = '@#_&-+()/*:;!?.~`\''"|=\u00b0<>{}\%[]'
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to fork the repository and submit pull requests for improvements or additional features.
For questions or suggestions, please reach out to the repository owner through GitHub.
/~https://github.com/godwin-binoy