I have noticed that my intros to this series are getting very repetitive, but it’s a bit difficult trying to say that I’ve completed a level and am now on the next one, in unique ways. So, I’ve completed the last level and here’s my write up for bandit level 8. If you haven’t had a chance to read my OverTheWire Bandit Write Up – Level 7 write up give it a quick read then head back over here. Now I’ve got the boring bits out the way here we go.

Level 8

So the hints that I’ve got this time are; the password is in a file named data.txt, and its the only unique line in the file. Reading these and after doing the previous levels I can make some assumptions. Number one; the file is most likely going to be stored in the users home directory. Number two; the file is probably going to contain more lines than I could manually work through to find the password.

Let’s Start Hacking Then

As always I load up a fresh terminal to initiate a SSH connection to the machine.

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

I enter the password from the last level when asked and I’m into the bandit level 8 users home directory. To start as always I have a look at what’s available to me. I run the ls command to see if I was right in my assumptions and the data.txtwas in the home directory, and it is. So let’s take a look inside.

cat ./data.txt

The file is filled with so many lines, that there’s no for me to go through each to find the unique one. However, looking at the uniq manual page I know that I can omit the repeated lines from the file. I give it a try with the following command.

uniq -u ./data.tx

But it doesn’t seem to make a difference, I’m still left with lots of lines. Looking back at the manual page I notice that the lines need to be adjacent. At the moment the file has the lines scattered all over the file. First I need to sort the line so all duplicate lines are next to each other. I can do this using the sort command. I run the following to check that it’s sorting the file correctly.

cat ./data.txt | sort

From the output I can see that the file has been sorted correctly. I should now be able to pipe the previous command into the uniq. So I run the following command.

cat ./data.txt | sort | uniq -u

…and Wham! Bam! Thank you ma’am! I have the password now for level 9.

Level 8 Complete

I have hidden the password here, if you are playing along don’t peek! Please! It’s more fun getting it yourself.


Justin Byrne

Justin Byrne is a self motivated tech enthusiasts. Spending more than half his life dedicated to the tech industry. He built his first computer at the age of 11, and has been building ever since. His interests have changed across the years from system building to web programming and even a dab of software engineering, and just like his interests, his operating system has changed sometimes more then 4 times a year.


Leave a Reply