now able to specify password length, removed -o and -s options
This commit is contained in:
parent
ca1add249b
commit
4e6e141807
31
bashpass.sh
31
bashpass.sh
@ -3,23 +3,28 @@
|
||||
source functions.sh
|
||||
|
||||
|
||||
case "$1" in
|
||||
-s | --sha ) usingSHA
|
||||
case "$1" in
|
||||
-cs | --char-size ) shaWithNum $2
|
||||
;;
|
||||
|
||||
-o | --openssl ) usingOPENSSL
|
||||
-l | --left-hand ) leftHand
|
||||
;;
|
||||
|
||||
-l | --lefthand ) leftHAND
|
||||
-lcs | --left-char-size ) leftHandNum $2
|
||||
;;
|
||||
|
||||
*) echo
|
||||
echo "BASH PASS HELP"
|
||||
echo
|
||||
echo "-s | --sha SHA the date and print 32 character pass"
|
||||
echo
|
||||
echo "-o | --openssl 32 character password using openssl"
|
||||
echo
|
||||
echo "-l | --lefthand 8 character password for left hand"
|
||||
"") shaStatic
|
||||
;;
|
||||
esac
|
||||
|
||||
* | -h | --help ) echo
|
||||
echo "BASH PASS HELP"
|
||||
echo
|
||||
echo "-cs <integer> | --char-size <integer> : specify password character size"
|
||||
echo
|
||||
echo
|
||||
echo "-l <integer> | <integer> --lefthand : left handed password"
|
||||
echo
|
||||
echo "-lcs <integer> | --left-char-size <integer> : left hand password with char size"
|
||||
echo
|
||||
;;
|
||||
esac
|
||||
|
37
functions.sh
37
functions.sh
@ -1,28 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
usingSHA(){
|
||||
shaStatic(){
|
||||
#hashes date with SHA
|
||||
echo
|
||||
echo "32 character password generated using SHA256 with date"
|
||||
echo "***************************************************"
|
||||
date +%s | sha256sum | base64 | head -c 32 ; echo
|
||||
echo "***************************************************"
|
||||
local charSize=20
|
||||
echo
|
||||
echo "${charSize} character password generated using SHA256 with date"
|
||||
echo "***************************************************"
|
||||
date +%s | sha256sum | base64 | head -c ${charSize} ; echo
|
||||
echo "***************************************************"
|
||||
}
|
||||
|
||||
usingOPENSSL(){
|
||||
shaWithNum(){
|
||||
#hashes date with SHA
|
||||
echo
|
||||
echo "32 character password generated using openssl"
|
||||
echo "**************************************************"
|
||||
openssl rand -base64 32
|
||||
echo "**************************************************"
|
||||
echo "$1 character password generated using SHA256 with date"
|
||||
echo "***************************************************"
|
||||
date +%s | sha256sum | base64 | head -c $1 ; echo
|
||||
echo "***************************************************"
|
||||
}
|
||||
|
||||
leftHAND(){
|
||||
leftHand(){
|
||||
echo
|
||||
echo "8 character password generated using /dev/urandom"
|
||||
echo "Meant to type with left hand"
|
||||
echo "8 character password easy to type with left hand"
|
||||
echo "**************************************************"
|
||||
</dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8; echo ""
|
||||
echo "**************************************************"
|
||||
}
|
||||
|
||||
leftHandNum(){
|
||||
echo
|
||||
echo "$1 character password easy to type with left hand"
|
||||
echo "**************************************************"
|
||||
</dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c$1; echo ""
|
||||
echo "**************************************************"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user