OverTheWire Bandit - LVL4 (Completed)
The goal for → LVL 4::
Level Goal:
→ The password for the next level is stored in the only human-readable file in the inhere directory.
Tip: if your terminal is messed up, try the “reset” command.
Commands you may need to solve this level: →ls , cd , cat , file , du , find
Explanation:
Password for Bandit4 Access: 2WmrDFRmJIq3IPxneAaMGhap0pFhF3NJ
First, ssh into Bandit Lvl 4. We can do this by entering the following:
→ ssh bandit4@bandit.labs.overthewire.org -p2220
You’ll then be asked top enter the password for Bandit4. Type it in and press enter (REMEMBER, you wont see the password type out on screen so type it carefully and correctly).
Once this is done you’ll successfully connect.
This level comes at the same level of difficulty as the previous one.
Here we are using the same ls command as well as the not previously used file command.
Similar to the previous level, we want to view the content of bandit 4 inhere directory, so we run the ls -la
command. It lists out what contents are in the directory but doesnt give us much clue as to what file is human-readable or in ASCII text. To understand what type of data these files are holding, we shall use the file command.
File command:
The file
command in Linux identifies the type of a file.
By running file [filename]
, it examines the file's content and tells you if it's a text file, executable, image, etc. This helps understand the nature of files without opening them.
So, lets look specifically at the command file ./-file*
:
./
refers to the current directory. It ensures the command looks for files starting withfile
in the current directory, rather than anywhere else.The asterisk
*
is a wildcard that matches any number of characters. Sofile*
matches any file whose name starts withfile
, likefile1
,file.txt
,fileABC
, etc.
Therefore, file ./-file*
will check the type of all files in the current directory that start with -file
.
Now we know that the only human-readable file in -file07 we can target this using the cat command and output its content.
The password for Level 5 access is: 4oQYVPkxZOOEOO5pTW81FB8j8lxXGUQw
That is Bandit Level 4 complete, Head over to Bandit Level 5!
Subscribe to my newsletter
Read articles from Mike Kobbie Tieku TABI directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by