dotfiles/bin/pass
2016-11-23 10:57:56 +01:00

11 lines
344 B
Bash
Executable file

#!/bin/bash
if [ $# -eq 1 ]; then
LENGTH=$1
else
LENGTH=8
fi
cat /dev/urandom| tr -dc 'a-zA-Z0-9' | fold -w $LENGTH| head -n 1
cat /dev/urandom| tr -dc 'a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?='|fold -w $LENGTH| head -n 1| grep -i '[!@#$%^&*()_+{}|:<>?=]'
pw=$(pwgen -Bs $LENGTH)
echo $pw " " $(openssl passwd -1 -salt $(pwgen -s 8 -1) $pw)
pw=123456