0

I copied that code to make a THM exercise, I understand it and it does his job that's passing names from a wordlist ($2) to steghide to try to crack the image ($1), and it works, but the problem is that it doesn't show correctly the correct password, it just stops in the word before it, and if you click enter it keeps going, I would like to just stop when it finds it and show me the password, here's the code:

for word in $(cat $2); do
    steghide extract -sf $1 -p $word &> /dev/null
    if [ $? == 0 ]; then
        echo
        echo "[!] PWD FOUND - $word [!]"
        break
    else
        echo "NOPE - $word"
    fi
done
19
  • Are there spaces in the passphrases? Your loop will split them into separate words. Commented May 6, 2021 at 18:47
  • 2
    Reading your wordlist with for ... in will probably mangle it. See "Why you don't read lines with for" and BashFAQ #1: "How can I read a file (data stream, variable) line-by-line (and/or field-by-field)?" Also, you have several variable references that really should be double-quoted; shellcheck.net will point them out (along with some other recommendations). Commented May 6, 2021 at 19:06
  • @Pol Porta - What do you mean by you click enter? Commented May 6, 2021 at 19:23
  • 1
    Why do you need to press return? There's nothing in your loop that waits for input. Unless steghide does that itself. Commented May 6, 2021 at 19:34
  • 1
    @Barmar okay, I just feel so stupid right now, as I already extracted the file from the image once, steghide was asking me if i wanted to re-write the file, so that was the whole problem, I'm still a newbie, thank you so much for your help! Commented May 6, 2021 at 19:49

1 Answer 1

1

Steghide was asking me if I wanted to re-write the output file as I already did this process once, so that was the only problem, my script wasn't expecting another input request from steghide.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.