Created
November 23, 2014 19:48
-
-
Save sahal/3c2a0831e76e2a85a434 to your computer and use it in GitHub Desktop.
Generate a list of passwords using /dev/urandom or /dev/random and bash
This file contains hidden or 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/sh -e | |
| # by Sahal Ansari - github@sahal.info | |
| # based on this blog post by Kevin Goodman | |
| # http://blog.colovirt.com/2009/01/07/linux-generating-strong-passwords-using-randomurandom/ | |
| # NOTE: install haveged for faster/'better' results! | |
| length=24 | |
| count=10 | |
| random_source="/dev/urandom" | |
| #random_source="/dev/random" | |
| #alpha-numeric-special chars | |
| chars="a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=" | |
| #alpha-numeric | |
| #chars="a-zA-Z0-9" | |
| cat "$random_source" | tr -dc "$chars" | fold -w "$length" | head -n "$count"| grep -i '[!"$chars"]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment