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