Bandit Walkthrough – Level 9
Level Description
http://www.overthewire.org/wargames/bandit/bandit10.shtml
The purpose of this level is to teach you how to read and search through a file that is not “human readable”. The password for bandit10 is hidden in the file data.txt and is on a line that starts with a few = symbols.
Hint
There are a number of different ways to parse “unreadable” files. There is no wrong way to do this, it is just about being able to find the information you are looking for.
Solution | Show> |
---|---|
Thanks for this blog and your time. I feel like your approach is very much in the spirit of OTW (i.e. you provide a ‘spoiler alert’).
I’ve been having a lot of fun working through the Bandit exercises, and have been doing my best not to ‘cheat’ before exhausting all resources. That said, as a noob, there are certain things that are above my skill level. I found your blog (after reading man pages, etc.) looking for hints at this level. Hints. Not solutions. Again, Kudos.
I do wonder about your solution, however, because the output seems ambiguous unless you are familiar with the form of the previous Bandit passwords.
There are several possible solutions in this output, but there doesn’t seem to be information about which one contains the character “=…=” at the start of a line (which, if I’m understanding, is what the exercise mandates) e.g. the password could also be “password” given the approach you’ve posted. Correct me if I’m missing something though. Thanks again for all your time — this blog is a great resource!
Thanks for the kind comments. I’ll be entirely honest and say it has been years since I actually worked through these, and remember very little about the specifics of them. So, sorry in advance for that. If I recall correctly, all of the passwords pretty much had the same format throughout. If multiple lines showed up when running the grep command, I assume there was only one that fit the “normal” format for the password.
EDIT: Scratch that. I just went ahead and ran through this level to check. The results you get when running the command I provide in the Spoilers section make it pretty clear. It returns 4 lines: “the6 | password | ism |“
The question says the password is human unreadable but “password” in readable by human.
I always check this blog after I find the answer to see other ways of solving the problem. The way I found it was:
tr -cd ‘\11\12\15\40-\176\’ < data.txt | grep ====
tr : translate command
-c: tells program to reverse SET1
-d: tells program to delete SET1 from SET2
'\11\12\15\40-\176': This is SET1, which I defined as tabs (\11), linefeed (\12), carriage returns (\15), and all keyboard characters (\40-\176). Remember the -c option reversed this and changes it to the opposite.
< data.txt : This is SET2, the given file
| grep ==== : pipes into grep telling it to return lines with ====
Youre right, it was a messy return, but I was able to pick out the answer. Your way was better, but at least I learned how to use the 'tr' command.