this is my life now. infinite frustration cast upon me by an evil curse \
This commit is contained in:
@@ -104,17 +104,17 @@ audit_passphrase() {
|
|||||||
|
|
||||||
if [[ -z "$raw_password" ]]; then
|
if [[ -z "$raw_password" ]]; then
|
||||||
echo "[ERROR] No passphrase provided for validation." >&2
|
echo "[ERROR] No passphrase provided for validation." >&2
|
||||||
exit 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$check_password" ]]; then
|
if [[ -z "$check_password" ]]; then
|
||||||
echo "[ERROR] No check passphrase provided for validation." >&2
|
echo "[ERROR] No check passphrase provided for validation." >&2
|
||||||
exit 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$raw_password" != "$check_password" ]]; then
|
if [[ "$raw_password" != "$check_password" ]]; then
|
||||||
echo "[ERROR] Passphrases do not match!" >&2
|
echo "[ERROR] Passphrases do not match!" >&2
|
||||||
exit 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset check_password
|
unset check_password
|
||||||
@@ -125,7 +125,7 @@ audit_passphrase() {
|
|||||||
local pass_len="${#raw_password}"
|
local pass_len="${#raw_password}"
|
||||||
if [ "$pass_len" -lt 35 ]; then
|
if [ "$pass_len" -lt 35 ]; then
|
||||||
echo "❌ REJECTED: Passphrase is too short ($pass_len characters). Minimum length required is 35."
|
echo "❌ REJECTED: Passphrase is too short ($pass_len characters). Minimum length required is 35."
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo " [PASS] Length verification satisfied ($pass_len characters)."
|
echo " [PASS] Length verification satisfied ($pass_len characters)."
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ audit_passphrase() {
|
|||||||
|
|
||||||
if [[ "$cracklib_result" != "OK" ]]; then
|
if [[ "$cracklib_result" != "OK" ]]; then
|
||||||
echo "❌ REJECTED by cracklib-check: $cracklib_result"
|
echo "❌ REJECTED by cracklib-check: $cracklib_result"
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo " [PASS] Local dictionary and structural complexity audit clear."
|
echo " [PASS] Local dictionary and structural complexity audit clear."
|
||||||
fi
|
fi
|
||||||
@@ -160,7 +160,7 @@ audit_passphrase() {
|
|||||||
|
|
||||||
if ! response=$(curl -s -H "User-Agent: Bash-Passphrase-Audit-Script" "$api_url"); then
|
if ! response=$(curl -s -H "User-Agent: Bash-Passphrase-Audit-Script" "$api_url"); then
|
||||||
echo "[FATAL] Failed to communicate with HIBP API." >&2
|
echo "[FATAL] Failed to communicate with HIBP API." >&2
|
||||||
exit 3
|
return 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local match
|
local match
|
||||||
@@ -170,7 +170,7 @@ audit_passphrase() {
|
|||||||
local pwn_count
|
local pwn_count
|
||||||
pwn_count=$(echo "$match" | cut -d':' -f2 | tr -d $'\r')
|
pwn_count=$(echo "$match" | cut -d':' -f2 | tr -d $'\r')
|
||||||
echo "❌ VULNERABLE: This passphrase has appeared in $pwn_count known public breaches."
|
echo "❌ VULNERABLE: This passphrase has appeared in $pwn_count known public breaches."
|
||||||
exit 1
|
return 1
|
||||||
else
|
else
|
||||||
echo "✅ SUCCESS: Passphrase meets all local criteria and was not found in HIBP records."
|
echo "✅ SUCCESS: Passphrase meets all local criteria and was not found in HIBP records."
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user