Bandit Level 1 → Level 2
Introduction
Bandit2 is the third level of the OverTheWire Bandit wargame. In this level, we will learn how to handle special characters in filenames and how to read the contents of a file that has a hyphen in its name. By completing this level, we will gain access to the password for the next level.
Steps
- Open your terminal application.
- Enter the following command to ssh into the remote server:
ssh bandit1@bandit.labs.overthewire.org -p 2220
- You will be prompted to enter a password. Enter the password from the previous level, "NH2SXQwcBdpmTEzi3bvBHMM9H66vVXjL", and hit enter.
- You are now connected to the remote server and are able to execute commands.
- Enter the following command to search for files with a hyphen in their name:
find /home -name "-" 2>/dev/null
- The output should show the path to the file with a hyphen in its name. In this case, the path is /home/bandit1/-.
- Enter the following command to read the contents of the file:
cat /home/bandit1/-
- The output should show the password for the next level: rRGizSaX8Mk1RTb1CNQoXTcYZWU6lgzi.
Congratulations! You have successfully completed Bandit2 and gained access to the password for the next level.
Conclusion
In this level, we learned how to handle special characters in filenames and how to read the contents of a file that has a hyphen in its name. These are important skills to have when working with files in Linux command line, and mastering them will be useful for solving future levels in the OverTheWire Bandit wargame.