The Goal
The password for Level 5 is stored in the only human-readable file inside inhere.
The directory contains ten files named -file00 through -file09.
The Approach
Checking files one by one would be tedious. Since the filenames follow a numbered pattern, a loop can print the contents of each file in sequence. Most output garbled binary data; the one human-readable file stands out immediately:
bandit4@bandit:~/inhere$ ls
-file00 -file01 -file02 -file03 -file04 -file05 -file06 -file07 -file08 -file09
bandit4@bandit:~/inhere$ for i in {1..9}; do echo "File 0"$i" - "; cat ./-file0$i; echo "\n"; done
File 01 -
[binary data]
File 02 -
[binary data]
File 03 -
[binary data]
File 04 -
[binary data]
File 05 -
[binary data]
File 06 -
[binary data]
File 07 -
password
File 08 -
[binary data]
File 09 -
[binary data]
File 07 is the only one with human-readable output. This connects back to the previous level where the same distinction between binary and human-readable content came up.
Commands Covered
for i in {1..9}; do ...; done, iterate over a numeric range in bashcat ./-filename, read a file whose name starts with a dash using an explicit path