Goal: Find the password and log into level 7. The password file is owned by user bandit7, owned by group bandit6 and is 33 bytes in size
To start searching for this file we will first use a similar method as Bandit Level 5 where we used the find
command. This time we will be using the additional parameter /
which just means we will be searching from the root directory which will allow us to search the entire filesystem.
This command will output a lot of information. We could stop here and look through all the files it has outputted and find the files without errors. However, I wanted to try and solve this in a single line. Next lets get rid of all the errors.
The first thing we will need to do is redirect stderr to stdout which we can do with 2>&1
. We will then pipe this output to grep. With grep we will exclude lines with the word ‘find’ with the -v
flag.
Now we have a single file! However, trying to solve this with a single command involves us trying to involve cat into this command. To do this we can use the exec flag which can use the result as a file location for the cat command.
Now we have our password for level 7 and we sign into the next level!