BanditOverTheWire

Bandit5

Website URL: http://overthewire.org/wargames/bandit/bandit5.html

Log into bandit4 from the password obtained in Bandit4

 

 

Fig 1.

Reading through the OverTheWire webpage for bandit4, we see:

The password for the next level is stored in the only human-readable file in the inhere directory. Tip: if your terminal is messed up, try the “reset” command.

Let’s run a ls -al command on the inhere directory and see it’s output:

ls -al inhere
Fig 2.

Now among all the files in the inhere directory, there is supposed to be only one human readable file, which would be containing the password to bandit5. One way to go about it would be to use cat command on all the files and parse their outputs one by one. But of course, that’s  a long and inefficient method. This might not be that preferable when the number of files is large. Another, quicker way is by using grep.

Now, if the file contents are human-readable, then it must contain one or more of the alphabets A-Z, a-z and numerals 0-9. Let’s frame a grep command that searches for one occurrence of this character set in the files of the inhere directory.

grep -ir "[abcdefghijklmnopqrstuvwxyz0123456789]" inhere
Fig 3.

Notice the -file007 contents, that’s the only file having completely human readable content, that must be the password.

Leave a Reply

Your email address will not be published. Required fields are marked *