Over The Wire Bandit Walk-through 1

For the last few weeks I have been playing a war game at OverTheWire.org called Bandit. The game essentially teaches linux basics. I thought it would be a great opportunity to share what how I came to the results in my blog. This specific blog post goes through levels zero through 3.

Level 0:

This level is simple. The object is to login to the server using SSH, next look for the readme file that  has the password stored in it and read it.

First I log into the server then use the listing command ls to show the files. There is a file named readme so I use the cat command to print the contents of the readme file.

The password for level 1 is boJ9jbbUNNfktd78OOpsqOltutMc3MY1

Level 1:

In level 1 I need to read a file that does not have a traditional filename, but it has a special character as the filename. When reading files in Linux it is necessary to use an escape character to read a file that uses special characters. This is done by using the string combination of ./

For this level I again used ls to read the listing of files in the directory. I see that the directory has a file named -, in order to read a file that is named using a special character I have to use the escape combination of ./ and the cat command.

The password for level 2 is CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9

Level 2:

This level requires that I read a file that has spaces in it. Again an escape character is needed to do this, if an escape character was not used then cat would try to read each word in the filename as a different file and would likely give an error saying “spaces does not exist in this directory” or something to that degree. The solution to this problem would be to used the escape character \ after each word, and include the space. The command would look like that cat spaces\ in\ this\ filename

Since we use the escape character it continues to read through the file as  if it were one string.

The password for level 3 is UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK

Level 3:

This level requires that I find a hidden file in the inhere directory. For this level it is necessary to use a few other commands. First I use the change directory to command to change to the inhere directory. Since the file is hidden if I were to ls I would not find any directories. So I have to use a special command that shows all files in a directory. I use the listing all command by using ls with a flag a. The command would be crafted as such ls -a. As can be seen in the screen shot below we see a .hidden file. In order to read the file an escape character is required because the file begins with a special character. I used the forward slash again for this so the command reads cat \.hidden

The password for level 4 is  pIwrPrtPN36QITSp3EQaw936yaFoFgAB

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s