meatballs i wanted meatballs god damn it
This commit is contained in:
@@ -108,22 +108,22 @@ reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
audit_passphrase() {
|
audit_passphrase() {
|
||||||
local raw_password="${1:-}"
|
local raw_password="$1"
|
||||||
local check_password="${2:-}"
|
local check_password="$2"
|
||||||
|
|
||||||
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
|
||||||
@@ -131,14 +131,14 @@ 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)."
|
||||||
|
|
||||||
if command -v cracklib-check >/dev/null 2>&1; then
|
if command -v cracklib-check >/dev/null 2>&1; then
|
||||||
if ! printf '%s' "$raw_password" | cracklib-check | grep -q 'OK$'; then
|
if ! printf '%s' "$raw_password" | cracklib-check | grep -q 'OK$'; then
|
||||||
echo '❌ REJECTED by cracklib-check.'
|
echo '❌ REJECTED by cracklib-check.'
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo '[PASS] Local dictionary and structural complexity audit clear.'
|
echo '[PASS] Local dictionary and structural complexity audit clear.'
|
||||||
else
|
else
|
||||||
@@ -152,15 +152,19 @@ audit_passphrase() {
|
|||||||
|
|
||||||
if ! response=$(curl -fsS -A 'Bash-Passphrase-Audit-Script' "https://api.pwnedpasswords.com/range/$prefix"); then
|
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
|
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
|
fi
|
||||||
|
|
||||||
if printf '%s\n' "$response" | grep -qi "^$suffix:"; then
|
if printf '%s\n' "$response" | grep -qi "^$suffix:"; then
|
||||||
echo -e "${RED}[FATAL]${RESET} Passphrase has been leaked!" >&2
|
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
|
fi
|
||||||
|
|
||||||
echo -e "not leaked! (via hibp)... ${GREEN}OK${RESET}"
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
error_handle() {
|
error_handle() {
|
||||||
|
|||||||
Reference in New Issue
Block a user