Bandit Level 5 -> 6
Finders Keepers
The password for the next level is stored in a file somewhere under the inhere directory and has all of the following properties:
- human-readable
- 1033 bytes in size
- not executable
Commands we may need to solve this level: ls , cd , cat , file , du , find
Solution
First, let's ssh to the level 6 server:
Let's find it
So now we're in the level 6 server, and apart from some details about the server and NDA details, there is just a shell prompt.
The problem we're solving this time around is multi-faceted, the file needs to be human-readable, with some specific file size and executable:
First of let's move into the inhere directory and list the files and folder inside there:
From here, it's obvious that we have a lot of folders, of which the file we want could be in any of them, so the commands we used earlier, are of no use to us, but there's one we haven't used so far from the possible commands, "find", let's RTFM of find:
If we know how to find text files and with the specific size then we can find our flag, so let's work the command and its options:
So we got the file, but what did we do, we used the find command to search within the current directory and sub-directories, then we used the "-type" option to specify that we're looking human readable and non-executable file, and finally we used the "-size" option to specify the size of the file we're looking for, so now we just have to concatenate the content of the file we've found.
That's it and see you on the next one.
Thank you, Enjoy.