The Goal

The password for Level 10 is stored in data.txt as one of the few human-readable strings, preceded by several = characters.

The Approach

The file is mostly binary data, which causes a plain grep to refuse and report "binary file matches":

bandit9@bandit:~$ cat data.txt | grep "=="
grep: (standard input): binary file matches

The -a flag tells grep to treat binary files as text. Searching for multiple = signs filters out most of the noise and surfaces the human-readable lines, including the one ending with the password:

bandit9@bandit:~$ cat data.txt | grep -a "=="
[binary data]========== the
[binary data]========== password
[binary data]========== is
[binary data]========== password

Commands Covered

  • grep -a, treat binary files as text when searching