Login
SSH: ssh [email protected] -p 2220
Challenge URL: https://overthewire.org/wargames/bandit/bandit3.html
Task
The password for the next level is stored in a file called --spaces in this filename-- located in the home directory.
Solution
Let's see the files present:
bandit2@bandit:~$ pwd
/home/bandit2
bandit2@bandit:~$ ls
--spaces in this filename--If the filename had only spaces in between, enclosing it with quotes would be enough but there are dashes present in the beginning.
Few ways to solve this:
- We can append the current path in the beginning just like the previous level and escape the spaces using a backslash \
So it should look something like this:
bandit2@bandit:~$ cat ./--spaces\ in\ this\ filename--- We can also add 2 hyphens after the cat command, which means anything after that will be considered as part of the filename like this:
bandit2@bandit:~$ cat -- "--spaces in this filename--"- We can use the redirection symbol (used in prev level) as well. Additionally, we have to enclose the filename in quotes or escape the spaces.
bandit2@bandit:~$ cat < --spaces\ in\ this\ filename--
# or
bandit2@bandit:~$ cat < "--spaces in this filename--"One liner: `cat ./--spaces\ in\ the\ filename--`