Monday, March 7, 2016

Solving Over The Wire Bandit Levels 0 - 5

The Over The Wire Bandit challenges are a cool way to learn your way around a Linux shell. Some of the levels are easier to figure out than others. I highly encourage working through these challenges on your own. If you get really stuck to the point of giving up, then read on. Also, some of the challenges can be solved multiple ways. This is how I solved them.

Level 0
This level is about getting logged into the system using ssh. Log in with the username bandit0 and password bandit0 as provided on the page

$ ssh -l bandit0 bandit.labs.overthewire.org


Level 0 -> 1
This level is about learning to read files. The password is stored in a file called readme stored in the home directory

$ cat readme 
boJ9jbbUNNfktd78OOpsqOltutMc3MY1


Level 1 -> 2
For the next and all subsequent levels, you'll probably want to exit out of the ssh connection and then reconnect using the next sequentially higher username (bandit1, bandit2, bandit3, etc.) along with the password unlocked in the previous challenge.

This challenge is figuring out how to read a file that starts with special character, in this case a hyphen (-). This can be solved by specifying the full path to the file
$ cat ./-
CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9


Level 2 -> 3
This level is learning how to handle spaces in a file name. The answer is by using the backslash (\) character. Also, once you start typing the name, you can use the tab key to autocomplete the name of the file and the backslashes are put in automatically

$ cat spaces\ in\ this\ filename 
UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK


Level 3 -> 4
This level is learning how to look around the directory structure and find hidden files. The password is stored in the inhere directory. Start by having a look around

$ ls
inhere
$ ls -a inhere/
.  ..  .hidden
$ cat inhere/.hidden 
pIwrPrtPN36QITSp3EQaw936yaFoFgAB


Level 4 -> 5
All of the files in the inhere directory are in binary format (not human unreadable), except one. Sure, you can just read all of them until you find the correct file, but there's a better way to do it using the file command to see what type of files they are

$ file inhere/*
./-file00: data
./-file01: data
./-file02: data
./-file03: data
./-file04: data
./-file05: data
./-file06: data
./-file07: ASCII text
./-file08: data
./-file09: data
$ cat inhere/-file07 
koReBOKuIDDepwhWk7jZC0RTdopnAYKh

No comments:

Post a Comment