MayADevBe Blog

A Blog about Computer Science

OverTheWire Bandit Level 8 -> 9 - Walkthrough

Previous Level: Level 8


Login

SSH: ssh bandit8@bandit.labs.overthewire.org -p 2220

Password: cvX2JJa4CFALtqS87jk27qwqGhBM9plV

Task

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

A little bit of Theory

uniq is a command that filters input and writes to the output. Specifically, it filters based on identical lines. It has a flag -u, which filters for unique lines (lines that appear only ones). Another interesting functionality is, for example, that it can also count (-c) or only return duplicate lines (-d).

The command is often used with sort. For uniq to filter for unique lines, the lines need to be sorted. sort sorts the lines of a text file. Furthermore, it has flags for sorting in reverse (-r) and sorting numerically (-n).

Solution

To find the line that occurs only once in the file, we first sort the lines and then filter for the unique one.

1
2
bandit8@bandit:~$ sort data.txt | uniq -u
UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR

https://overthewire.org/wargames/bandit/bandit9.html


Next Level: Level 10


Share on: