Simple password generator with easy extandable code.
Browser and operating systems often offer strong password generation when a new registration on an app
or website is made.
These passwords are extremely secure and I would definitely suggest to use them ahead over this script
also because it is a very fast way generate a new password and store it.
Nevertheless, what happened to me sometimes is that these passwords did not match the requirements
that are made by the app or website. In some cases the password should be of specific length or should just contain
numerical characters, etc.
As far as I know, most of the password providers have not fixed this problem yet, so this is were this project
comes in.
Simple password generator written in such a way that one can easily extend the source code.
The passwords are generated on the command line and specified with flags and respective arguments.
One can easily define default arguments if some specific password types are needed more often.
To get the source code from github:
git clone https://github.com/leonrenn/PasswordGenerator && echo "Copy the following path for your .rc-file:\n" && echo ${PWD}/PassordGenerator/
Now you can easily edit the code in your editor.
As this CLI tool should be callable from everywhere and anytime in your terminal, it should be packed in the
.*rc-file of your terminal. To do this go to your home directory and and open the file with your preferred editor (for me it is vim, but this should be adjusted by you):
cd ~ && vim .bashrc
Afterwards you can just easily put an alias that does the job (the path to the directory has to be modified for your system):
alias pwd_gen='python3 copied_path/src/main.py'
When reopening the terminal again, one can easily use the the command pwd_gen.
To see the different options that are supplied by default use the help flag:
pwd_gen -h
The result will give you a table with the following information:
Flag | Explanation |
---|---|
-h, --help | Show this help message and exit. |
-n NUMBER_OF_CHARACTERS, --number_of_characters NUMBER_OF_CHARACTERS | Number of characters. |
-a, --all | All characters (alphabetic)numeric, special. |
-abc, --alphabetic | Alphabetic characters. |
-num, --numeric | Numeric characters. |
-s, --special | Special characters. |
The default number of characters is 12 which the security standard for a password. This can be modified by setting the flag and supply a positive integer number greater than 0.
To include all kinds of characters just use the [-a]/[--all] flag which is equivalent to
[-abc -num -s]. You are free to combine any of the other flags in any order (order won't change the result).
Python version: 3+
If wanted you can go straight ahead and modify the code in your base environment.
Normally, it is good practice to use a virtual environment for development. It can be activated in the following way:
cd copied_path && conda env create -f environment.yml && conda activate PasswordGenerator