diff --git a/customscripts/passcheck b/customscripts/passcheck index 4598a9e..5f4ba98 100644 --- a/customscripts/passcheck +++ b/customscripts/passcheck @@ -1,4 +1,8 @@ #!/bin/bash +set -E p # FAIL ON ERROR USE TRAP +# error handling trap +trap 'echo "ERROR ON $LINENO! UNSETTING VARS FOR SECURITY"; unset $passphrase1; unset $passphrase2; unset $complexity_check; unset $sha1_digest; unset $first_five; unset $last_35; unset $curl_ret; echo "DONE"; exit 1' ERR + pass_min_length=40 hibp_api="https://api.pwnedpasswords.com/range/" @@ -52,4 +56,15 @@ if grep -q -i "${last_35}" <<< "${curl_ret}"; then else echo "PASS CHECKS OUT" exit 0 -fi \ No newline at end of file +fi + +# cleanup +echo -e "\nUNSETTING VARS FOR SECURITY\n"; +unset $passphrase1 +unset $passphrase2 +unset $complexity_check +unset $sha1_digest +unset $first_five +unset $last_35 +unset $curl_ret; +echo -e "\nDONE\n" \ No newline at end of file