OverTheWire Bandit - LVL8 (Complete)

The goal for → LVL 8::

Level Goal:

→ The password for the next level is stored in the file data.txt and is the only line of text that occurs only once

Commands you may need to solve this level: → grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd

Explanation:

Password for Bandit8 Access: dfwvzFQi4mU0wfNbFOe9RoWskMLg7eEc

First, ssh into Bandit Lvl 8. We can do this by entering the following:

ssh bandit8@bandit.labs.overthewire.org -p2220

You’ll then be asked top enter the password for Bandit8.

Type it in and press enter (REMEMBER, you wont see the password type out on screen so type it carefully and correctly).

Once this is done you’ll successfully connect.


Since the line of text we are looking for only occurs once, this makes it unique, so i think it only makes sense to utilise the uniq command.

Uniq & Sort command:

The uniq command in Linux filters out adjacent duplicate lines from a file or input, displaying only unique lines. It's often used after sort to remove all duplicate lines.

The sort command in Linux arranges lines of text files in a specified order. By default, it sorts lines alphabetically and in ascending order.

For example, sort file.txt | uniq sorts the file and removes duplicates.

Options you can use:

  • -c count occurrences

  • -d shows only duplicate lines

  • -u shows only unique lines.

We could utilise just the uniq command but as you see in the image below, we get ALL the unique lines in the file.

So our password is somewhere in that mess but we need a way to filter it out.

If you use uniq -u without sorting the input first, it will only filter out lines that are unique among adjacent lines.

It will not effectively identify unique lines across the entire file if duplicates are scattered.

So lets use both sort and uniq commands together and see what we come up with

sort data.txt | uniq -u

Through the use of this command we have sorted the data.txt file AND outputted ONLY unique lines or in this case line which is our password:

4CKMh1JI91bUIZZPXDqGanal4xvAg0JM


The password for Level 9 access is: 4CKMh1JI91bUIZZPXDqGanal4xvAg0JM

That is Bandit Level 8 complete, Head over to Bandit Level 9!


0
Subscribe to my newsletter

Read articles from Mike Kobbie Tieku TABI directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mike Kobbie Tieku TABI
Mike Kobbie Tieku TABI