OverTheWire - Bandit - Level 8 → Level 9

Warning: This post contains a solution!

Only continue if:
1.) you want to see a possible alternative solution or
2.) you are stuck and need a hint!

Connect to the server using the following credentials:

Server: bandit.labs.overthewire.org
Port: 2220
Username: bandit8
Password: cvX2xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Level Goal is:

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

With this information in mind, we can search for a unique line in the file. We can use the uniq command to do that.

bandit8@bandit:~$ man uniq
UNIQ(1)                                                               User Commands                                                               UNIQ(1)

       uniq - report or omit repeated lines

       uniq [OPTION]... [INPUT [OUTPUT]]

       Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output).

       With no options, matching lines are merged to the first occurrence.


       Note:  'uniq'  does  not  detect  repeated lines unless they are adjacent.  You may want to sort the input first, or use 'sort -u' without 'uniq'.
       Also, comparisons honor the rules specified by 'LC_COLLATE'.


As described under 'Note:', we first have to sort the list.
So, just combine sort and uniq:

bandit8@bandit:~$ sort data.txt | uniq -u
Show Comments