OverTheWire Bandit Guide

here's how to solve the bandit level 8 → 9

Back to the Bandit Guides

Previous Level Guide: Bandit Level 7 → 8


Access

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

Password: lluKkeJYKiGSwBDlAetZmv6JYgpIGfK8

Info

Description: 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: grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd

Theory

To get the password, the instructions say that it's inside a file where it's the only line that occurs once. Just like the last level, this data.txt file must be another file with a bunch of lines that repeat that have wrong passwords, and the right password is the one that doesn't repeat. This gives me an idea, the uniq command, which if we use the manual on this command, it says that says lines that repeat, but we can use the -u option to only print the lines that don't repeat. But then there's another two problems, we need to do it on the data.txt file because this command only accepts text inputs, and that it first has to be sorted alphabetically, this is because after testing a bit on my terminal and researching online, I found out that the only thing the command does, is to check for both the previous and current line, and check if they're the same, then report that repeated line. So to solve all of this, we just need to use the command that fixes all of those problems, the sort command, which after going through the manual, it does have a file input, so we can put data.txt on there, and using a pipe character after sort we can execute the uniq command at the same time, and that way, use a file as input for uniq, and because it is sorted alphabetically by default, all of the repeated wrong passwords will be all together, that way letting uniq -u do its work and print the single unique line. With all of that, we get a command like this:

sort data.txt | uniq -u

Solution

Now you just have to get into the level and do the command:

~$ sort data.txt | uniq -u
iwUb1RZFttts3xdhYfIgrWKjVxGJaJDY

And that's it! Now we should be good to go to the next level.

https://overthewire.org/wargames/bandit/bandit9.html
Next Level Guide: Bandit Level 9 → Level 10