Bandit Level 4 Solution

Bandit level 4 teaches you how to use find command in order to search for files with specific preferences.

Let’s start by logging into the machine

ssh bandit4@bandit.labs.overthewire.org -p 2220

with the password that we got from our previous level.

pIwrPrtPN36QITSp3EQaw936yaFoFgAB

let’s list all the files that in our home directory

let’s access the “inhere” directory with

cd inhere

now let’s list all the files inside the directory

you can access the manual for “find” command to see all the arguments, but to save time I’ll structure the find command directly.

first of all, we don’t have so many files, so we can just print the type of all the files

now let’s structure the command

find . -type  f   -exec file {} +

Now, let’s explain what is the above

  • “.” is for current directory
  • -type f is for the type which is “file”
  • -exec to execute a command (which we are executing the “file” command
  • {} is the find output ( which are the files we have)
  • + is to combine the arguments (more info from here)

You should get the following results:

So, here we can see that “-file07” has the ASCII text that can be readable.

so let’s read the file like we did in level 1

and here we get the password for our next level.

koReBOKuIDDepwhWk7jZC0RTdopnAYKh

You can access the next level from here.