From c99e75e4aba3818fba45633dee9b64f7c4c16443 Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Sat, 23 May 2026 14:20:23 -0600 Subject: [PATCH] meatballs i wanted meatballs god damn it --- create-attributable-archive.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/create-attributable-archive.sh b/create-attributable-archive.sh index 53a157c..9972219 100755 --- a/create-attributable-archive.sh +++ b/create-attributable-archive.sh @@ -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() {