Bandit 2 ( level 1->2 )

Level Goal

The password for the next level is stored in a file called - located in the home directory

Commands you may need to solve this level

ls , cd , cat , file , du , find

Helpful Reading Material

Solving

ssh into bandit1:

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

In this level we'll be dealing with a tricky file name.

img1

As you can see in the img1, we have a file named - (dash). Which we can't just cat it ordinary.

img2

You can see in img2 that the cat command is not reading texts inside the - file. The reason is in the command cat - : the - tells cat to read from stdin rather than a file.

Quick note: stdin refers to standard input. In Unix-like operating systems, it's one of the three standard data streams used for input and output in programs, along with stdout (standard output) and stderr (standard error).

To solve our scenario we can use './' before a file name to directly reference to a file like:

cat ./-
FLAG !

There we go, we captured our flag.

263JGJPfgU6LtdEvgfWU1XP5yac29mFx

Last updated