OTW - Bandit Level 5 to 6
Hello World! So far you have gained the knowledge of working with Linux, executing command, reading files and importantly how to read man pages when you are stuck somewhere, which is an achievement. It's time to level up the difficulty from this here, and I swear it will be interesting.
Introducing you a new tool explain-shell! If you have a browser and access to internet, you can use this tool shamelessly to get explanations of each part of the shell commands. It would be helpful to understand you the meaning of parameters while copying from the online services like stack overflow.
ls -la command using explainshell.comSolution
In this challenge you are supposed to find the password for next level in a human readable file of size 1033 bytes and without executable permission set.
./your-exec-program or your-exec-program (assuming it's in the directory listed in $PATH). The shell then calls the execve(2) syscall, which determines the file type internally (ELF or shebang) and launches the loader accordingly.I have an introductory post on Linux File Permissions, please do read it after you are done with this one for better understanding.
Okay, Back to the solution! So you will see that inhere directory contains multiple directory located in it with maybehereXX format.
ls -la
ls -la inhere/~/inhere directories.When you will the contents of just two directories, it would start feeling overwhelmed while seeing lots of files with different colours (they have meaning), coming from dircolors(1).
inhere/maybehere00/-file1 is an executable file.ls -l inhere/maybehere00/
ls -l inhere/maybehere01//inhere/maybehere00~ and ~/inhere/maybehere01 directories.If you are wishing for any command-line utility in Linux, then I must say find(1) is at your disposal.
If you want to search for files in a particular directory, you MUST specify it just after find name and the followed by other flags, otherwise it will search for files in the current directory recursively.
find inhere/ -size 1033c -not -executable -exec file '{}' \;Great! The command returned an ASCII file confirmed by the file(1) command using -exec parameter of find(1) command.
If you will read the contains of this file, it will print the password of the next level. Isn't that sweet?
cat inhere/maybehere07/.file2Give yourself a pat on the back for coming this far π! This was my reaction back in 2015, when I solved this challenge for the first time.