Featured image of post OverTheWire - Bandit - Level 8

OverTheWire - Bandit - Level 8

The solution to OverTheWires Bandit, Level 8

Bandit 8

Challenge

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

Approaches

Since we know the line of text only occurs once, we can probably cat the text, then use the uniq command to find the uniq value. As it turns out, there is a handy --count switch we can use to figure out how many times a string shows up. One thing I did realize was that i needed to sort the list before passing to uniq otherwise it would not tally the counts properly.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
bandit8@bandit:~$ ls -la
total 56
drwxr-xr-x  2 root    root     4096 Feb 21 22:03 .
drwxr-xr-x 70 root    root     4096 Feb 21 22:04 ..
-rw-r--r--  1 root    root      220 Jan  6  2022 .bash_logout
-rw-r--r--  1 root    root     3771 Jan  6  2022 .bashrc
-rw-r-----  1 bandit9 bandit8 33033 Feb 21 22:03 data.txt
-rw-r--r--  1 root    root      807 Jan  6  2022 .profile

bandit8@bandit:~$ cat data.txt | sort | uniq -c
     10 06JGEzd0h7SG9ezN0TNJ4HiObh9NFrjA
     10 11f8uKsc6DxBivROEF8Uifg1mMKD6usK
     10 26nn1hqu3aiBMnRrS0BHAVsNmT0NWOYL
     10 2Kwg7gB03cpPvMklMtGz9OjfSkOF82tW
     10 2PKvVpiRjaQl1KgbufZZqmlbyQeS7Agx
     ...
     10 eiI4YqWjOEej0dYPvJFk5HR0wdVZQbJv
      1 FLAG_FLAG_FLAG_FLAG_FLAG_FLAG_FL
     10 eqQvViWw3MSA8eHfMlTpk2Cw23TGv9X5
     ...
Built with Hugo
Theme Stack designed by Jimmy