meatballs i wanted meatballs god damn it

This commit is contained in:
2026-05-23 14:20:23 -06:00
parent 2bc28a462d
commit c99e75e4ab
+14 -10
View File
@@ -108,22 +108,22 @@ reset() {
}
audit_passphrase() {
local raw_password="${1:-}"
local check_password="${2:-}"
local raw_password="$1"
local check_password="$2"
if [[ -z "$raw_password" ]]; then
echo '[ERROR] No passphrase provided for validation.' >&2
exit 2
return 2
fi
if [[ -z "$check_password" ]]; then
echo '[ERROR] No check passphrase provided for validation.' >&2
exit 2
return 2
fi
if [[ "$raw_password" != "$check_password" ]]; then
echo '[ERROR] Passphrases do not match!' >&2
exit 2
return 2
fi
unset check_password
@@ -131,14 +131,14 @@ audit_passphrase() {
local pass_len=${#raw_password}
if [[ "$pass_len" -lt 35 ]]; then
echo "❌ REJECTED: Passphrase is too short ($pass_len characters). Minimum length required is 35."
exit 1
return 1
fi
echo "[PASS] Length verification satisfied ($pass_len characters)."
if command -v cracklib-check >/dev/null 2>&1; then
if ! printf '%s' "$raw_password" | cracklib-check | grep -q 'OK$'; then
echo '❌ REJECTED by cracklib-check.'
exit 1
return 1
fi
echo '[PASS] Local dictionary and structural complexity audit clear.'
else
@@ -152,15 +152,19 @@ audit_passphrase() {
if ! response=$(curl -fsS -A 'Bash-Passphrase-Audit-Script' "https://api.pwnedpasswords.com/range/$prefix"); then
echo -e "${RED}[FATAL]${RESET} Failed to communicate with HIBP API." >&2
exit 3
return 3
else
echo -e "connected to hibp...${GREEN}OK${RESET}"
fi
if printf '%s\n' "$response" | grep -qi "^$suffix:"; then
echo -e "${RED}[FATAL]${RESET} Passphrase has been leaked!" >&2
exit 1
return 1
else
echo -e "not leaked! (via hibp)... ${GREEN}OK${RESET}"
fi
echo -e "not leaked! (via hibp)... ${GREEN}OK${RESET}"
return 0
}
error_handle() {