Last active
October 3, 2016 18:16
-
-
Save msawangwan/6b06595cd52b7830c07b49c9bfe67ff3 to your computer and use it in GitHub Desktop.
[bash][shell] password generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#+ Password Generator | |
#+ Author: [email protected] | |
#+ Utilizes the entropy pool to generate a password. If no length | |
#+ is specified, a default length of 20 is used. | |
#+ Execute with './' prefix or add to PATH (recommended). | |
#+ Usage: | |
#+ genpasswd [pw_length_int_value] OR genpasswd | |
#+ Example: | |
#+ ~$ genpasswd 32 | |
#+ More Info: /dev/urandom or /dev/random | |
len=$1 | |
[ "$1" == "" ] && len=20 | |
RESULT=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${len}; echo) | |
echo "" | |
echo "[ +] Password: $RESULT" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment