diff --git a/bashpass.sh b/bashpass.sh index cac3f95..4354bae 100755 --- a/bashpass.sh +++ b/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 | --char-size : specify password character size" + echo + echo + echo "-l | --lefthand : left handed password" + echo + echo "-lcs | --left-char-size : left hand password with char size" + echo + ;; +esac diff --git a/functions.sh b/functions.sh index 4a47dcb..538e520 100644 --- a/functions.sh +++ b/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 "**************************************************"