Created
January 23, 2014 18:51
-
-
Save iqbalhasnan/8584506 to your computer and use it in GitHub Desktop.
generate random password with diceware wordlist
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 | |
# | |
# Author: Iqbal Hasnan and Tony Xu at The Ohio State University | |
# Description: This script generates a secure, easy-to-remembers random passphrase | |
# based on diceware wordlist and random number from random.org | |
# | |
# run: ./passwordgenerator.sh | |
# check if the diceware wordlist exists in local machine | |
if [ ! -f diceware.txt ]; then | |
curl -L http://goo.gl/djmh54 > diceware.txt | |
fi | |
# get 5 5-digit random numbers generated from random.org with the digits between 1 to 6. Each 5-digit number | |
# is separated by a newline | |
function getRandomNumber(){ | |
curl -s "http://www.random.org/integers/?num=25&min=1&max=6&col=5&base=10&format=plain&rnd=new" | tr -d '\t' | |
} | |
# select five words from the diceware wordlist using the | |
# random numbers generated from getRandomNumber function | |
function getPassword(){ | |
for i in $(getRandomNumber); do | |
grep $i diceware.txt | cut -f2 | |
#echo ' ' | |
done | |
} | |
echo $(getPassword) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment