Recap of Level 1: We logged into the overthewire Bandit 1 after reading the file “readme” located in the /home/bandit0 directory. 

Bandit Level 2

Objective:

Find the password to the next level

Intel Given:

  • Password is in a file named ‘-‘
  • ‘-‘ is in the home directory

How to:

Normally we would read this simple human readable text document by using the command ‘cat -‘ however the usage of the dash as a filename presents some problems. – In BASH is used to redirect from/to STDIN(Standard In) or STDOUT (Standard Out). Technically you can change STDIN and STDOUT to anything, but for the sake of simplicity trust me when I say the defaults are your Keyboard and Bash prompt.

So what happens when we type ‘cat -‘? Essentially what this command is saying is “read standard in, and display it on standard out”. Which if we break down into further layman terms means, everything I type AFTER I enter this command, will be repeated. Go ahead and give it a try.

So how to get around this? Well we just explicitly tell Bash that we mean – the FILE and not – the operator. To do that we just list the entire path in the command. This is a concept that you’ll discover will help execute files as you advance further in your linux experience.

‘cat ./-‘ should give you the results you’re looking for. A period in bash denotes the current working directory, in this case it means /home/bandit1/ so you could also type ‘cat /home/bandit1/-‘ and have the same result, but its much simpler and a much more common syntax to type it in the way I showed above.

 

Conclusion:

I recommend research what STDIN and STDOUT as well as briefly search for Bash or Linux special characters.

Previous Level
Next Level
You were not leaving your cart just like that, right?

You were not leaving your cart just like that, right?

Enter your details below to save your shopping cart for later. And, who knows, maybe we will even send you a sweet discount code :)