Bandit 5
Objectives
The password for the next level is stored in the only human-readable file in the inheredirectory. Tip: if your terminal is messed up, try the “reset” command.
Solution
Ok
so after we login we see a familiar inhere directory listed in the home directory for bandit 4 lets see whats in there
we see 10 files named in the convention -file0* let's see what type of files they are
we also could have checked the mime types here
Either way we see that -file07 is a text ascii file. Give the the requirement that the password is in the only human readable file I think we can assume from here that -file07 is where our password is
And there it is our password for the next level
now lets do it with python
I spent hours trying to script out a file that would read the mime types of the files and then put them through and while state statement with an if inside to parse our just file07 but I at this point in my python journey just couldn't get there especially since I couldn't use the magic library on the overthewire server...
so in the in the end I just made this script that gets all the files in the directory and prints the content out to the screen... its ugly but its was the best I could do right now
import os
bandit4@bandit:~/inhere$ pythonPython 2.7.13 (default, Sep 26 2018, 18:42:22)[GCC 6.3.0 20170516] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import os>>>>>>>>> filesvar = os.listdir(os.curdir)>>> count = 0>>>>>>>>> while count <=len(filesvar):... print filesvar[count]... f = open(filesvar[count])... f.read()
Objectives
The password for the next level is stored in the only human-readable file in the inheredirectory. Tip: if your terminal is messed up, try the “reset” command.
Solution
Ok
so after we login we see a familiar inhere directory listed in the home directory for bandit 4 lets see whats in there
bandit4@bandit:~$ cd ./inhere/ && ls -ltotal 40-rw-r----- 1 bandit5 bandit4 33 Oct 16 2018 -file00-rw-r----- 1 bandit5 bandit4 33 Oct 16 2018 -file01-rw-r----- 1 bandit5 bandit4 33 Oct 16 2018 -file02-rw-r----- 1 bandit5 bandit4 33 Oct 16 2018 -file03-rw-r----- 1 bandit5 bandit4 33 Oct 16 2018 -file04-rw-r----- 1 bandit5 bandit4 33 Oct 16 2018 -file05-rw-r----- 1 bandit5 bandit4 33 Oct 16 2018 -file06-rw-r----- 1 bandit5 bandit4 33 Oct 16 2018 -file07-rw-r----- 1 bandit5 bandit4 33 Oct 16 2018 -file08-rw-r----- 1 bandit5 bandit4 33 Oct 16 2018 -file09
we see 10 files named in the convention -file0* let's see what type of files they are
bandit4@bandit:~/inhere$ file ./-file0*./-file00: data./-file01: data./-file02: data./-file03: data./-file04: data./-file05: data./-file06: data./-file07: ASCII text./-file08: data./-file09: data
we also could have checked the mime types here
bandit4@bandit:~/inhere$ file --mime-type ./-file0*./-file00: application/octet-stream./-file01: application/octet-stream./-file02: application/octet-stream./-file03: application/octet-stream./-file04: application/octet-stream./-file05: application/octet-stream./-file06: application/octet-stream./-file07: text/plain./-file08: application/octet-stream./-file09: application/octet-stream
Either way we see that -file07 is a text ascii file. Give the the requirement that the password is in the only human readable file I think we can assume from here that -file07 is where our password is
bandit4@bandit:~/inhere$ cat ./-file07koReBOKuIDDepwhWk7jZC0RTdopnAYKh
And there it is our password for the next level
now lets do it with python
I spent hours trying to script out a file that would read the mime types of the files and then put them through and while state statement with an if inside to parse our just file07 but I at this point in my python journey just couldn't get there especially since I couldn't use the magic library on the overthewire server...
so in the in the end I just made this script that gets all the files in the directory and prints the content out to the screen... its ugly but its was the best I could do right now
Comments
Post a Comment