DEV Community

Micheal Mac Donnacha
Micheal Mac Donnacha

Posted on

Overthewire.org Bandit Level 2 -> 3

Description
A walkthrough for Bandit Level 2 → Level 3

Level Goal

The password for the next level is stored in a file called spaces in this filename located in the home directory

Walkthrough

Login to the server using the password obtained from the previous level Bandit level 1 -> 2.

username: bandit2

ssh bandit2@bandit.labs.overthewire.org -p 2220
Enter fullscreen mode Exit fullscreen mode

This time there is a file with spaces in the name.

bandit2@bandit:~$ ls 
spaces in this filename 
Enter fullscreen mode Exit fullscreen mode

Running cat spaces in the filename will cause errors as it will think each word in spaces in the filename is its own separate file.

bandit2@bandit:~$ cat spaces in this filename
cat: spaces: No such file or directory 
cat: in: No such file or directory 
cat: this: No such file or directory
cat: filename: No such file or directory
Enter fullscreen mode Exit fullscreen mode

Printing the contents of the file can be done 2 ways.

One using \ before each space to indicate to the terminal that the filename continues and the other is surrounding the file name with quotes ' or ".

bandit2@bandit:~$ cat 'spaces in this filename'
UmHadQ##########################
bandit2@bandit:~$ cat spaces\ in\ this\ filename
UmHadQ##########################
Enter fullscreen mode Exit fullscreen mode

Top comments (0)